Skip to content

Commit

Permalink
test: test for regression where jasmine_node_test passes silently
Browse files Browse the repository at this point in the history
Adds tests 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 bazel-contrib/rules_nodejs#1540 for an example of a potential regression.
  • Loading branch information
gregmagolan committed Jan 11, 2020
1 parent c0c0432 commit 3d027d4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tools/testing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ts_library")
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -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,
)
8 changes: 8 additions & 0 deletions tools/testing/fail.spec.js
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 3d027d4

Please sign in to comment.