I am trying to create a gulp build system so that I can test both src file and the minimized file. Say I have foo.src.js and foo.min.js, my test file is test.js, which contains something like
var Foo = require(../FOO);
...
Then in my gulp file I have
var replace = require('gulp-replace');
var mocha = require('gulp-mocha');
gulp.task('test-prepare', function() {
return gulp.src('test.js')
.pipe(replace(/FOO/g, 'foo'))
.pipe(gulp.dest('build'));
});
gulp.task('test-build-prepare', function() {
return gulp.src('test.js')
.pipe(replace(/FOO/g, 'foo.min'))
.pipe(gulp.dest('build'));
});
gulp.task('test', ['test-prepare'], function() {
return gulp.src('build/test.js').pipe(mocha());
});
gulp.task('test-build', ['test-build-prepare'], function() {
return gulp.src('build/test.js').pipe(mocha());
});
After I run gulp test I can see that build folder and the test.js file has the FOO been replaced with foo correctly. However the test is not running correctly as there is zero test cases been run. It shows:
[12:04:44] Using gulpfile ~/Projects/genEnum/gulpfile.js
[12:04:44] Starting 'test-prepare'...
[12:04:44] Finished 'test-prepare' after 23 ms
[12:04:44] Starting 'test'...
0 passing (0ms)
[12:04:44] Finished 'test' after 5.82 ms
Anyone know where is the problem?
Aucun commentaire:
Enregistrer un commentaire