From c3f9335a9d1c3a4618606a30eb04652892c82ad8 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 4 Jun 2019 08:43:51 -0700 Subject: [PATCH] port #398 to new jasmine_node_test add a test case for it --- packages/jasmine/src/jasmine_node_test.bzl | 4 +++- packages/jasmine/test/BUILD.bazel | 10 ++++++++++ packages/jasmine/test/templated_args_test.js | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/jasmine/test/templated_args_test.js diff --git a/packages/jasmine/src/jasmine_node_test.bzl b/packages/jasmine/src/jasmine_node_test.bzl index ef8541db35..e50d67cbe3 100644 --- a/packages/jasmine/src/jasmine_node_test.bzl +++ b/packages/jasmine/src/jasmine_node_test.bzl @@ -59,7 +59,9 @@ def jasmine_node_test( all_data += [Label("@bazel_tools//tools/bash/runfiles")] entry_point = "@bazel/jasmine/src/jasmine_runner.js" - templated_args = ["$(location :%s_devmode_srcs.MF)" % name] + # If the target specified templated_args, pass it through. + templated_args = kwargs.pop("templated_args", []) + ["$(location :%s_devmode_srcs.MF)" % name] + if coverage: templated_args = templated_args + ["--coverage"] else: diff --git a/packages/jasmine/test/BUILD.bazel b/packages/jasmine/test/BUILD.bazel index 8cf49e9811..3283dc972d 100644 --- a/packages/jasmine/test/BUILD.bazel +++ b/packages/jasmine/test/BUILD.bazel @@ -71,3 +71,13 @@ jasmine_node_test( "@npm//v8-coverage", ], ) + +jasmine_node_test( + name = "templated_args_test", + srcs = ["templated_args_test.js"], + jasmine = "@npm//jasmine", + deps = ["//:jasmine_runner"], + templated_args = [ + "--node_options=--experimental-modules", + ], +) diff --git a/packages/jasmine/test/templated_args_test.js b/packages/jasmine/test/templated_args_test.js new file mode 100644 index 0000000000..bb090e040d --- /dev/null +++ b/packages/jasmine/test/templated_args_test.js @@ -0,0 +1,7 @@ +describe('args', () => { + it('should pass through templated_args', () => { + // without --node_options=--experimental-modules this will fail + import('../index'); + }); +}); + \ No newline at end of file