File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,22 +74,19 @@ def jasmine_node_test(
7474 all_data += [":%s_devmode_srcs.MF" % name ]
7575 all_data += [Label ("@bazel_tools//tools/bash/runfiles" )]
7676
77- # If the target specified templated_args, pass it through .
78- templated_args = kwargs . pop ( " templated_args" , [])
79- templated_args . append ( "$(location :%s_devmode_srcs.MF)" % name )
80-
81- if coverage :
82- templated_args . append ( "--coverage" )
83- else :
84- templated_args . append ( "--nocoverage" )
77+ # jasmine_runner.js consumes the first 3 args .
78+ # The remaining target templated_args will be passed through to jasmine or
79+ # specs to consume.
80+ templated_args = [
81+ "$(location :%s_devmode_srcs.MF)" % name ,
82+ "--coverage" if coverage else "--nocoverage" ,
83+ "$(location %s)" % config_file if config_file else "--noconfig" ,
84+ ] + kwargs . pop ( "templated_args" , [] )
8585
8686 if config_file :
8787 # Calculate a label relative to the user's BUILD file
8888 pkg = Label ("%s//%s:__pkg__" % (native .repository_name (), native .package_name ()))
8989 all_data .append (pkg .relative (config_file ))
90- templated_args .append ("$(location %s)" % config_file )
91- else :
92- templated_args .append ("--noconfig" )
9390
9491 nodejs_test (
9592 name = name ,
Original file line number Diff line number Diff line change @@ -97,7 +97,12 @@ jasmine_node_test(
9797 "dynamic_import.js" ,
9898 ],
9999 args = [
100+ # the --node_options arg will be consumed by the node launcher
100101 "--node_options=--experimental-modules" ,
102+ # the remaining args should be passed to the spec
103+ "arg1" ,
104+ "arg2" ,
105+ "arg3" ,
101106 ],
102107)
103108
@@ -107,8 +112,16 @@ jasmine_node_test(
107112 "args_test.js" ,
108113 "dynamic_import.js" ,
109114 ],
115+ args = [
116+ # args should be passed after templated_args
117+ "arg3" ,
118+ ],
110119 templated_args = [
120+ # the --node_options templated arg will be consumed by the node launcher
111121 "--node_options=--experimental-modules" ,
122+ # the remaining args should be passed to the spec
123+ "arg1" ,
124+ "arg2" ,
112125 ],
113126)
114127
Original file line number Diff line number Diff line change 11describe ( 'args' , ( ) => {
2- it ( 'should pass through templated_args' , async ( ) => {
2+ it ( 'should pass through other templated_args' , async ( ) => {
3+ // args that are not consumed by the node launcher should be passed through
4+ // to the spec
5+ expect ( process . argv . slice ( 2 ) ) . toEqual ( [ 'arg1' , 'arg2' , 'arg3' ] ) ;
6+ } ) ;
7+
8+ it ( 'should apply --node_options in templated_args' , async ( ) => {
39 // without --node_options=--experimental-modules this will fail
410 const dynamicImport = await import ( './dynamic_import.js' ) ;
511 dynamicImport . default . hello ( ) ;
You can’t perform that action at this time.
0 commit comments