From 9c01f364d456380d929098166e2c993275b9f018 Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Fri, 8 May 2020 16:05:56 -0400 Subject: [PATCH] Catch promise errors and exit with code 1 --- test/integration/pick-tests.js | 7 ++++++- test/integration/scratch-tests.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/integration/pick-tests.js b/test/integration/pick-tests.js index 4012bcd..f8f1463 100644 --- a/test/integration/pick-tests.js +++ b/test/integration/pick-tests.js @@ -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); +}); diff --git a/test/integration/scratch-tests.js b/test/integration/scratch-tests.js index bad0774..c67e559 100644 --- a/test/integration/scratch-tests.js +++ b/test/integration/scratch-tests.js @@ -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); +});