diff --git a/test/gulpfile.js b/test/gulpfile.js index c020ff76..6d4ac5a0 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -22,7 +22,6 @@ const execa = require('execa'); const path = require('path'); const del = require('del'); const linkSync = require('../util').linkSync; -const merge = require('merge2'); // gulp-help monkeypatches tasks to have an additional description parameter const gulp = help(_gulp); @@ -52,17 +51,30 @@ gulp.task('internal.test.link.add', 'Link local copies of dependencies', () => { gulp.task('internal.test.test', 'Run API-level tests', () => { // run mocha tests matching a glob with a pre-required fixture, // returning the associated gulp stream - const runTestsWithFixture = (glob, fixture) => gulp - .src(glob) - .pipe(mocha({ - reporter: 'mocha-jenkins-reporter', - require: `${testDir}/fixtures/${fixture}.js` - })); - const interopTest = `${testDir}/interop/interop_test.js`; - const tasks = [].concat( - ['native_native'/*, 'js_js'*/] - .map((fixture) => runTestsWithFixture(`${apiTestDir}/*.js`, fixture)), - ['native_native', 'native_js'/*, 'js_native', 'js_js'*/] - .map((fixture) => runTestsWithFixture(interopTest, fixture))) - return merge(tasks); + const runTestsWithFixture = (glob, fixture) => new Promise((resolve, reject) => { + const server = fixture.split('_')[0]; + const client = fixture.split('_')[1]; + console.log(`Running ${glob} with ${server} server + ${client} client`); + gulp.src(glob) + .pipe(mocha({ + reporter: 'mocha-jenkins-reporter', + require: `${testDir}/fixtures/${fixture}.js` + })) + .resume() // put the stream in flowing mode + .on('end', resolve) + .on('error', reject); + }); + const apiTestGlob = `${apiTestDir}/*.js`; + const interopTestGlob = `${testDir}/interop/interop_sanity_test.js`; + const runTestsArgPairs = [ + [apiTestGlob, 'native_native'], + [apiTestGlob, 'js_js'], + [interopTestGlob, 'native_native'], + [interopTestGlob, 'native_js'], + [interopTestGlob, 'js_native'], + [interopTestGlob, 'js_js'] + ]; + return runTestsArgPairs.reduce((previousPromise, argPair) => { + return previousPromise.then(runTestsWithFixture.bind(null, argPair[0], argPair[1])); + }, Promise.resolve()); });