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
This commit is contained in:
Pete Bacon Darwin 2021-04-13 15:47:50 +01:00 committed by Zach Arend
parent b3d9dea52b
commit 60d023449b
4 changed files with 20 additions and 4 deletions

View File

@ -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);
});

View File

@ -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);
});

View File

@ -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);
});

View File

@ -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);
});