File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,46 @@ var yargs = require('yargs');
88var buildFolder = path . join ( 'dist' , process . platform + '-' + process . arch ) ;
99
1010module . 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
You can’t perform that action at this time.
0 commit comments