mirror of https://github.com/grpc/grpc-node.git
Simplify test gulpfile and improve test order visibility
This commit is contained in:
parent
0c61981ffc
commit
eaae8fb3b6
|
|
@ -31,18 +31,9 @@ const install = () => {
|
|||
|
||||
const cleanAll = () => Promise.resolve();
|
||||
|
||||
const test = () => {
|
||||
// run mocha tests matching a glob with a pre-required fixture,
|
||||
// returning the associated gulp stream
|
||||
if (!semver.satisfies(process.version, '>=10.10.0')) {
|
||||
console.log(`Skipping cross-implementation tests for Node ${process.version}`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
const apiTestGlob = `${apiTestDir}/*.js`;
|
||||
const runTestsWithFixture = (server, client) => new Promise((resolve, reject) => {
|
||||
const runTestsWithFixture = (server, client) => () => new Promise((resolve, reject) => {
|
||||
const fixture = `${server}_${client}`;
|
||||
console.log(`Running ${apiTestGlob} with ${server} server + ${client} client`);
|
||||
gulp.src(apiTestGlob)
|
||||
gulp.src(`${apiTestDir}/*.js`)
|
||||
.pipe(mocha({
|
||||
reporter: 'mocha-jenkins-reporter',
|
||||
require: [`${testDir}/fixtures/${fixture}.js`]
|
||||
|
|
@ -50,24 +41,21 @@ const test = () => {
|
|||
.resume() // put the stream in flowing mode
|
||||
.on('end', resolve)
|
||||
.on('error', reject);
|
||||
});
|
||||
var runTestsArgPairs;
|
||||
if (semver.satisfies(process.version, '^8.13.0 || >=10.10.0')) {
|
||||
runTestsArgPairs = [
|
||||
['native', 'native'],
|
||||
['native', 'js'],
|
||||
['js', 'native'],
|
||||
['js', 'js']
|
||||
];
|
||||
} else {
|
||||
runTestsArgPairs = [
|
||||
['native', 'native']
|
||||
];
|
||||
}
|
||||
return runTestsArgPairs.reduce((previousPromise, argPair) => {
|
||||
return previousPromise.then(runTestsWithFixture.bind(null, argPair[0], argPair[1]));
|
||||
}, Promise.resolve());
|
||||
};
|
||||
});
|
||||
|
||||
const testNativeClientNativeServer = runTestsWithFixture('native', 'native');
|
||||
const testJsClientNativeServer = runTestsWithFixture('native', 'js');
|
||||
const testNativeClientJsServer = runTestsWithFixture('js', 'native');
|
||||
const testJsClientJsServer = runTestsWithFixture('js', 'js');
|
||||
|
||||
const test = semver.satisfies(process.version, '^8.13.0 || >=10.10.0') ?
|
||||
gulp.series(
|
||||
testNativeClientNativeServer,
|
||||
testJsClientNativeServer,
|
||||
testNativeClientJsServer,
|
||||
testJsClientJsServer
|
||||
) :
|
||||
testNativeClientNativeServer;
|
||||
|
||||
export {
|
||||
install,
|
||||
|
|
|
|||
Loading…
Reference in New Issue