From 60d023449b374e0fe1e81b1903c845ce8e239a83 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 13 Apr 2021 15:47:50 +0100 Subject: [PATCH] build(docs-infra): ensure that jasmine node tests fail on build error (#41596) Previously if there was a problem when building the tests, the error would be swallowed as an unhandled promise rejection. Now these are caught and the process is exited with a non-zero value to prevent any CI jobs from passing incorrectly. PR Close #41596 --- aio/tests/deployment/unit/test.js | 6 +++++- aio/tools/examples/test.js | 6 +++++- aio/tools/firebase-test-utils/test.js | 6 +++++- aio/tools/transforms/test.js | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/aio/tests/deployment/unit/test.js b/aio/tests/deployment/unit/test.js index f154bf5faf..d5f82d6330 100644 --- a/aio/tests/deployment/unit/test.js +++ b/aio/tests/deployment/unit/test.js @@ -18,4 +18,8 @@ register({project: join(__dirname, 'tsconfig.json')}); const runner = new Jasmine({projectBaseDir: __dirname}); runner.loadConfig({spec_files: ['**/*.spec.ts']}); -runner.execute(); +runner.execute().catch((error) => { + // Something broke so non-zero exit to prevent the process from succeeding. + console.error(error); + process.exit(1); +}); diff --git a/aio/tools/examples/test.js b/aio/tools/examples/test.js index 4620f9204f..d13a4335d6 100644 --- a/aio/tools/examples/test.js +++ b/aio/tools/examples/test.js @@ -14,4 +14,8 @@ const Jasmine = require('jasmine'); const jasmine = new Jasmine({ projectBaseDir: __dirname }); jasmine.loadConfig({ spec_files: ['*.spec.js'] }); -jasmine.execute(); +jasmine.execute().catch((error) => { + // Something broke so non-zero exit to prevent the process from succeeding. + console.error(error); + process.exit(1); +}); diff --git a/aio/tools/firebase-test-utils/test.js b/aio/tools/firebase-test-utils/test.js index 7b99c4e39d..0d29873bf1 100644 --- a/aio/tools/firebase-test-utils/test.js +++ b/aio/tools/firebase-test-utils/test.js @@ -18,4 +18,8 @@ register({project: join(__dirname, 'tsconfig.json')}); const runner = new Jasmine({projectBaseDir: __dirname}); runner.loadConfig({spec_files: ['**/*.spec.ts']}); -runner.execute(); +runner.execute().catch((error) => { + // Something broke so non-zero exit to prevent the process from succeeding. + console.error(error); + process.exit(1); +}); diff --git a/aio/tools/transforms/test.js b/aio/tools/transforms/test.js index b8d3671461..e77d7d325a 100644 --- a/aio/tools/transforms/test.js +++ b/aio/tools/transforms/test.js @@ -14,4 +14,8 @@ const Jasmine = require('jasmine'); const jasmine = new Jasmine({ projectBaseDir: __dirname }); jasmine.loadConfig({ random: true, spec_files: ['**/*.spec.js'] }); -jasmine.execute(); +jasmine.execute().catch((error) => { + // Something broke so non-zero exit to prevent the process from succeeding. + console.error(error); + process.exit(1); +});