diff --git a/tools/testing/BUILD.bazel b/tools/testing/BUILD.bazel index e29e450f40..8d00f94bd3 100644 --- a/tools/testing/BUILD.bazel +++ b/tools/testing/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ts_library") +load("//tools:defaults.bzl", "jasmine_node_test", "ts_library") package(default_visibility = ["//visibility:public"]) @@ -38,3 +38,27 @@ ts_library( "//packages:types", ], ) + +# A test to verify that jasmine_node_test targets fail as expected. +# This is to catch any future regressions to jasmine_node_test where +# tests pass silently without executing. +# See https://github.com/bazelbuild/rules_nodejs/pull/1540 for an example +# of a potential regression. +jasmine_node_test( + name = "fail_test", + srcs = ["fail.spec.js"], + expected_exit_code = 55, +) + +# A test to verify that jasmine_node_test targets fail as expected +# when there is a bootstrap script set. +# This is to catch any future regressions to jasmine_node_test where +# tests pass silently without executing. +# See https://github.com/bazelbuild/rules_nodejs/pull/1540 for an example +# of a potential regression. +jasmine_node_test( + name = "fail_bootstrap_test", + srcs = ["fail.spec.js"], + bootstrap = ["//tools/testing:node_es5"], + expected_exit_code = 55, +) diff --git a/tools/testing/fail.spec.js b/tools/testing/fail.spec.js new file mode 100644 index 0000000000..051229b33e --- /dev/null +++ b/tools/testing/fail.spec.js @@ -0,0 +1,8 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +process.exit(55); \ No newline at end of file