Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Repeat and Retry functionality to sigh test #2590

Merged
merged 5 commits into from
Jan 29, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions tools/sigh.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ function test(args) {
explore: ['explore'],
exceptions: ['exceptions'],
boolean: ['manual', 'all'],
retries: ['retries'],
repeat: ['repeat'],
alias: {g: 'grep'},
});

Expand Down Expand Up @@ -536,6 +538,12 @@ function test(args) {
mocha.suite.emit('require', null, '${test}', mocha);
mocha.suite.emit('post-require', global, '${test}', mocha);
`);
if (options.retries) {
thebrianchen marked this conversation as resolved.
Show resolved Hide resolved
chain.push(`
import {mocha} from '${mochaInstanceFile}';
mocha.suite.retries(${JSON.stringify(options.retries)})
`);
}
}
const chainImports = chain.map((entry, i) => {
const file = path.join(tempDir, `chain${i}.js`);
Expand Down Expand Up @@ -581,20 +589,28 @@ function test(args) {
}

const runner = buildTestRunner();
return saneSpawn(
'node',
[
'--experimental-modules',
'--trace-warnings',
'--no-deprecation',
...extraFlags,
'--loader',
fixPathForWindows(path.join(__dirname, 'custom-loader.mjs')),
'-r',
'source-map-support/register.js',
runner
],
{stdio: 'inherit'});
// Spawn processes as needed to repeat tests specified by 'repeat' flag.
const repeatCount = JSON.stringify(options.repeat || 1);
const testResults = [];
for (let i = 0; i < repeatCount; i++) {
console.log('RUN %s [%s]:', i+1, (new Date).toLocaleTimeString());
testResults.push(saneSpawn(
'node',
[
'--experimental-modules',
'--trace-warnings',
'--no-deprecation',
...extraFlags,
'--loader',
fixPathForWindows(path.join(__dirname, 'custom-loader.mjs')),
'-r',
'source-map-support/register.js',
runner
],
{stdio: 'inherit'})
);
}
return testResults;
}

async function importSpotify(args) {
Expand Down