Skip to content

Commit

Permalink
Add Repeat and Retry functionality to sigh test (#2590)
Browse files Browse the repository at this point in the history
* repeat and retry functionality added

* added comments and returned output of test run in test()

* Remove package-lock.json from pull request

* added number validation

* removing retries flag and adding run summary
  • Loading branch information
Brian Chen authored Jan 29, 2019
1 parent 165b170 commit 9295cb3
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions tools/sigh.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ function test(args) {
explore: ['explore'],
exceptions: ['exceptions'],
boolean: ['manual', 'all'],
repeat: ['repeat'],
alias: {g: 'grep'},
});

Expand Down Expand Up @@ -581,20 +582,36 @@ 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 = parseInt(JSON.stringify(options.repeat || 1));
const testResults = [];
const failedRuns = [];
for (let i = 1; i < repeatCount + 1; i++) {
console.log('RUN %s STARTING [%s]:', i, (new Date).toLocaleTimeString());
const testResult = 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'});
if (testResult === false) {
failedRuns.push(i);
}
testResults.push(testResult);
}
console.log('%s runs completed. %s runs failed.', repeatCount, failedRuns.length);
if (failedRuns.length > 0) {
console.log('Failed runs: ', failedRuns);
}
return testResults;
}

async function importSpotify(args) {
Expand Down

0 comments on commit 9295cb3

Please sign in to comment.