Skip to content

Commit

Permalink
travis ci serve
Browse files Browse the repository at this point in the history
  • Loading branch information
noyobo committed Feb 15, 2015
1 parent 09b4238 commit a8cadb7
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
@@ -0,0 +1,10 @@
root=true

[*.js]
end_of_line = lf
insert_final_newline = false
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -3,4 +3,4 @@ node_modules
.swap
.orig
.log
test/gulpfile.js
**/*.log
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
language: node_js
node_js:
- 0.10

before_script:
- npm i coveralls istanbul mocha
- npm i -g gulp
- cd test/
- gulp
- cd ../

script:
- npm test

after_script:
- NODE_ENV=test istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -33,6 +33,8 @@
},
"devDependencies": {
"gulp": "^3.8.10",
"gulp-handlebars": "^3.0.1",
"gulp-wrap": "^0.11.0",
"should": "^4.4.2",
"stream-assert": "^2.0.2"
},
Expand Down
4 changes: 2 additions & 2 deletions test/build/q.js
@@ -1,6 +1,6 @@
define('u',function(){return Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
{"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
return "<div>This is test Handlebars tpl.</div>";
},"useData":true})});
},"useData":true}
define('d',function(){
return 'd';
});
Expand Down
27 changes: 14 additions & 13 deletions test/test.js
@@ -1,4 +1,5 @@
var fs = require( 'fs' ),
path = require('path');
gulp = require( 'gulp' ),
should = require( 'should' ),
gutil = require( 'gulp-util' ),
Expand All @@ -19,24 +20,24 @@ describe( 'gulp-seajs-combo', function(){

// 测试普通的模块
it( 'should combo module a & b, no seajs.use', function( done ){
var moduleA = fs.readFileSync( './build/a.js', 'utf-8' );
var moduleA = fs.readFileSync( path.resolve('./test/build/a.js'), 'utf-8' );

gulp.src( 'src/a.js' )
.pipe( seajsCombo() )
.pipe( assert.first(function( data ){
data.contents.toString().should.equal( moduleA );
data.contents.toString().should.equal( moduleA );
}))
.pipe( assert.end(done) );
});

// 测试有seajs.use的情况
it( 'should combo module f, have seajs.use', function( done ){
var moduleF = fs.readFileSync( './build/f.js', 'utf-8' );
var moduleF = fs.readFileSync( path.resolve('./test/build/f.js'), 'utf-8' );

gulp.src( 'src/f.js' )
.pipe( seajsCombo() )
.pipe( assert.first(function( data ){
data.contents.toString().should.equal( moduleF );
data.contents.toString().should.equal( moduleF );
}))
.pipe( assert.end(done) );
});
Expand All @@ -45,35 +46,35 @@ describe( 'gulp-seajs-combo', function(){
describe( 'options', function(){
// 测试options.ignore
it( 'should ignore module e', function( done ){
var moduleC = fs.readFileSync( './build/c.js', 'utf-8' );
var moduleC = fs.readFileSync( path.resolve('./test/build/c.js'), 'utf-8' );

gulp.src( 'src/c.js' )
.pipe( seajsCombo({ ignore : ['e'] }) )
.pipe( assert.first(function( data ){
data.contents.toString().should.equal( moduleC );
data.contents.toString().should.equal( moduleC );
}))
.pipe( assert.end(done) );
});

// 测试options.map
it( 'should use map', function( done ){
var moduleK = fs.readFileSync( './build/k.js', 'utf-8' );
var moduleK = fs.readFileSync( path.resolve('./test/build/k.js'), 'utf-8' );

gulp.src( 'src/k.js' )
.pipe( seajsCombo({
map : {
map : {
'test/src/l' : './l'
}
}))
.pipe( assert.first(function( data ){
data.contents.toString().should.equal( moduleK );
data.contents.toString().should.equal( moduleK );
}))
.pipe( assert.end(done) );
});

// 测试options.plugins
it( 'should use plugins for handlebars tpl', function( done ){
var moduleK = fs.readFileSync( './build/q.js', 'utf-8' );
var moduleK = fs.readFileSync( path.resolve('./test/build/q.js'), 'utf-8' );

gulp.src( 'src/q.js' )
.pipe( seajsCombo({
Expand All @@ -86,7 +87,7 @@ describe( 'gulp-seajs-combo', function(){
}]
}))
.pipe( assert.first(function( data ){
data.contents.toString().should.equal( moduleK );
data.contents.toString().should.equal( moduleK );
}))
.pipe( assert.end(done) );
});
Expand All @@ -95,12 +96,12 @@ describe( 'gulp-seajs-combo', function(){
describe( 'seajs.config', function(){
// 测试解析seajs.config中的配置
it( 'should parse alias & paths & vars in seajs.config', function( done ){
var moduleM = fs.readFileSync( './build/m.js', 'utf-8' );
var moduleM = fs.readFileSync( path.resolve('./test/build/m.js'), 'utf-8' );

gulp.src( 'src/m.js' )
.pipe( seajsCombo() )
.pipe( assert.first(function( data ){
data.contents.toString().should.equal( moduleM );
data.contents.toString().should.equal( moduleM );
}))
.pipe( assert.end(done) );
});
Expand Down

0 comments on commit a8cadb7

Please sign in to comment.