Skip to content

Commit

Permalink
Merge pull request #697 from rwjblue/make-suite-setup-util-more-resil…
Browse files Browse the repository at this point in the history
…ient

Refactor suite-setup-util to avoid knock on errors.
  • Loading branch information
rwjblue authored Mar 1, 2021
2 parents d3bcce0 + 50153f4 commit 17e1efa
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions test-packages/support/suite-setup-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,33 +152,29 @@ export async function emitDynamicSuites() {
}
}

if (require.main === module) {
if (process.argv.includes('--list')) {
allSuites()
.then(result => {
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
})
.catch(err => {
process.stderr.write(err);
process.exit(-1);
});
}
async function main() {
try {
if (process.argv.includes('--list')) {
const result = await allSuites();

if (process.argv.includes('--matrix')) {
githubMatrix()
.then(result => {
process.stdout.write(JSON.stringify(result));
})
.catch(err => {
process.stderr.write(err);
process.exit(-1);
});
}
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
}

if (process.argv.includes('--emit')) {
emitDynamicSuites().catch(err => {
console.log(err);
process.exit(-1);
});
if (process.argv.includes('--matrix')) {
const result = await githubMatrix();

process.stdout.write(JSON.stringify(result));
}

if (process.argv.includes('--emit')) {
await emitDynamicSuites();
}
} catch (error) {
console.error(error);
process.exitCode = -1;
}
}

if (require.main === module) {
main();
}

0 comments on commit 17e1efa

Please sign in to comment.