Catch promise errors and exit with code 1

This commit is contained in:
adroitwhiz 2020-05-08 16:05:56 -04:00
parent 5d085f678f
commit 9c01f364d4
2 changed files with 12 additions and 2 deletions

View file

@ -103,4 +103,9 @@ const runFile = async (file, action, page, script) => {
// close the browser window we used
await browser.close();
})();
})().catch(err => {
// Handle promise rejections by exiting with a nonzero code to ensure that tests don't erroneously pass
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
});

View file

@ -117,4 +117,9 @@ const testFile = (file, page) => test(file, async t => {
// close the browser window we used
await browser.close();
})();
})().catch(err => {
// Handle promise rejections by exiting with a nonzero code to ensure that tests don't erroneously pass
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
});