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,43 +31,31 @@ const install = () => {
|
||||||
|
|
||||||
const cleanAll = () => Promise.resolve();
|
const cleanAll = () => Promise.resolve();
|
||||||
|
|
||||||
const test = () => {
|
const runTestsWithFixture = (server, client) => () => new Promise((resolve, reject) => {
|
||||||
// run mocha tests matching a glob with a pre-required fixture,
|
const fixture = `${server}_${client}`;
|
||||||
// returning the associated gulp stream
|
gulp.src(`${apiTestDir}/*.js`)
|
||||||
if (!semver.satisfies(process.version, '>=10.10.0')) {
|
.pipe(mocha({
|
||||||
console.log(`Skipping cross-implementation tests for Node ${process.version}`);
|
reporter: 'mocha-jenkins-reporter',
|
||||||
return Promise.resolve();
|
require: [`${testDir}/fixtures/${fixture}.js`]
|
||||||
}
|
}))
|
||||||
const apiTestGlob = `${apiTestDir}/*.js`;
|
.resume() // put the stream in flowing mode
|
||||||
const runTestsWithFixture = (server, client) => new Promise((resolve, reject) => {
|
.on('end', resolve)
|
||||||
const fixture = `${server}_${client}`;
|
.on('error', reject);
|
||||||
console.log(`Running ${apiTestGlob} with ${server} server + ${client} client`);
|
});
|
||||||
gulp.src(apiTestGlob)
|
|
||||||
.pipe(mocha({
|
const testNativeClientNativeServer = runTestsWithFixture('native', 'native');
|
||||||
reporter: 'mocha-jenkins-reporter',
|
const testJsClientNativeServer = runTestsWithFixture('native', 'js');
|
||||||
require: [`${testDir}/fixtures/${fixture}.js`]
|
const testNativeClientJsServer = runTestsWithFixture('js', 'native');
|
||||||
}))
|
const testJsClientJsServer = runTestsWithFixture('js', 'js');
|
||||||
.resume() // put the stream in flowing mode
|
|
||||||
.on('end', resolve)
|
const test = semver.satisfies(process.version, '^8.13.0 || >=10.10.0') ?
|
||||||
.on('error', reject);
|
gulp.series(
|
||||||
});
|
testNativeClientNativeServer,
|
||||||
var runTestsArgPairs;
|
testJsClientNativeServer,
|
||||||
if (semver.satisfies(process.version, '^8.13.0 || >=10.10.0')) {
|
testNativeClientJsServer,
|
||||||
runTestsArgPairs = [
|
testJsClientJsServer
|
||||||
['native', 'native'],
|
) :
|
||||||
['native', 'js'],
|
testNativeClientNativeServer;
|
||||||
['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());
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
install,
|
install,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue