Skip to content

Commit 1798507

Browse files
committed
New gulp task to run tests one by one
1 parent 0984ea7 commit 1798507

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

gulp-tasks/tests.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,46 @@ var yargs = require('yargs');
88
var buildFolder = path.join('dist', process.platform + '-' + process.arch);
99

1010
module.exports = function(gulp) {
11+
12+
function createMocha() {
13+
return new mochaa({
14+
recursive: true,
15+
compilers: 'js:babel-core/register',
16+
env: {
17+
NODE_PATH: '.'
18+
},
19+
grep: yargs.argv.grep,
20+
g: yargs.argv.g,
21+
reporter: yargs.argv.reporter,
22+
istanbul: {
23+
report: yargs.argv.report || 'lcov'
24+
}
25+
});
26+
}
27+
28+
gulp.task('unit-test-1by1', function() {
29+
return globby('test/unit/**/*.js', {root: '.'}).then(function(files) {
30+
files.reduce((promises, file) => {
31+
return promises.then(function() {
32+
return new Promise(function(resolve) {
33+
gulp.src([file], {
34+
read: false
35+
}).pipe(mocha({
36+
recursive: false,
37+
compilers: 'js:babel-core/register',
38+
env: {
39+
NODE_PATH: '.'
40+
},
41+
grep: yargs.argv.grep,
42+
g: yargs.argv.g,
43+
reporter: yargs.argv.reporter
44+
})).on('end', resolve);
45+
});
46+
});
47+
}, Promise.resolve());
48+
});
49+
});
50+
1151
gulp.task('unit-test', function() {
1252
return gulp.src([yargs.argv['spec-file'] || 'test/unit/**/*.js'], {
1353
read: false

0 commit comments

Comments
 (0)