@@ -28,6 +28,7 @@ def jasmine_node_test(
2828 deps = [],
2929 expected_exit_code = 0 ,
3030 tags = [],
31+ config_file = None ,
3132 coverage = False ,
3233 jasmine = "@npm//@bazel/jasmine" ,
3334 jasmine_entry_point = "@npm//:node_modules/@bazel/jasmine/jasmine_runner.js" ,
@@ -43,6 +44,15 @@ def jasmine_node_test(
4344 deps: Other targets which produce JavaScript, such as ts_library
4445 expected_exit_code: The expected exit code for the test.
4546 tags: Bazel tags applied to test
47+ config_file: (experimental) label of a file containing Jasmine JSON config.
48+
49+ Note that not all configuration options are honored, and
50+ we expect some strange feature interations.
51+ For example, if you list spec_files, they will be tested
52+ but not instrumented for code coverage.
53+
54+ See https://jasmine.github.io/setup/nodejs.html#configuration
55+
4656 coverage: Enables code coverage collection and reporting.
4757 jasmine: A label providing the `@bazel/jasmine` npm dependency.
4858 jasmine_entry_point: A label providing the `@bazel/jasmine` entry point.
@@ -61,12 +71,21 @@ def jasmine_node_test(
6171 all_data += [Label ("@bazel_tools//tools/bash/runfiles" )]
6272
6373 # If the target specified templated_args, pass it through.
64- templated_args = kwargs .pop ("templated_args" , []) + ["$(location :%s_devmode_srcs.MF)" % name ]
74+ templated_args = kwargs .pop ("templated_args" , [])
75+ templated_args .append ("$(location :%s_devmode_srcs.MF)" % name )
6576
6677 if coverage :
67- templated_args = templated_args + ["--coverage" ]
78+ templated_args .append ("--coverage" )
79+ else :
80+ templated_args .append ("--nocoverage" )
81+
82+ if config_file :
83+ # Calculate a label relative to the user's BUILD file
84+ pkg = Label ("%s//%s:__pkg__" % (native .repository_name (), native .package_name ()))
85+ all_data .append (pkg .relative (config_file ))
86+ templated_args .append ("$(location %s)" % config_file )
6887 else :
69- templated_args = templated_args + [ "--nocoverage" ]
88+ templated_args . append ( "--noconfig" )
7089
7190 nodejs_test (
7291 name = name ,
0 commit comments