1212 *
1313 * Supported command line flags:
1414 *
15- * --local | If specified, no browser will be launched.
16- * --firefox | Instead of Chrome being used for tests, Firefox will be used.
17- * --no-watch | Watch mode is enabled by default. This flag opts-out to standard Bazel.
15+ * --debug | If specified, no browser will be launched.
16+ * --firefox | Instead of Chrome being used for tests, Firefox will be used.
17+ * --no-watch | Watch mode is enabled by default. This flag opts-out to standard Bazel.
1818 */
1919
2020const yargs = require ( 'yargs' ) ;
@@ -35,13 +35,14 @@ shelljs.set('-e');
3535shelljs . cd ( projectDir ) ;
3636
3737// Extracts the supported command line options.
38- const { components, local , firefox, watch} = yargs ( args )
38+ const { components, debug , firefox, watch} = yargs ( args )
3939 . command ( '* <components..>' , 'Run tests for specified components' , args =>
4040 args . positional ( 'components' , { type : 'array' } ) ,
4141 )
42- . option ( 'local' , {
42+ . option ( 'debug' , {
43+ alias : 'local' ,
4344 type : 'boolean' ,
44- description : 'Whether test should run in local mode. You can manually connect a browser then.' ,
45+ description : 'Whether test should run in debug mode. You can manually connect a browser then.' ,
4546 } )
4647 . option ( 'firefox' , {
4748 type : 'boolean' ,
@@ -58,13 +59,13 @@ const {components, local, firefox, watch} = yargs(args)
5859// Whether tests for all components should be run.
5960const all = components . length === 1 && components [ 0 ] === 'all' ;
6061
61- // We can only run a single target with "--local ". Running multiple targets within the
62+ // We can only run a single target with "--debug ". Running multiple targets within the
6263// same Karma server is not possible since each test target runs isolated from the others.
63- if ( local && ( components . length > 1 || all ) ) {
64+ if ( debug && ( components . length > 1 || all ) ) {
6465 console . error (
6566 chalk . red (
66- 'Unable to run multiple components tests in local mode. ' +
67- 'Only one component at a time can be run with "--local "' ,
67+ 'Unable to run multiple components tests in debug mode. ' +
68+ 'Only one component at a time can be run with "--debug "' ,
6869 ) ,
6970 ) ;
7071 process . exit ( 1 ) ;
@@ -105,7 +106,7 @@ if (!components.length) {
105106 process . exit ( 1 ) ;
106107}
107108
108- const bazelAction = local ? 'run' : 'test' ;
109+ const bazelAction = debug ? 'run' : 'test' ;
109110const testLabels = components . map ( t => `${ getBazelPackageOfComponentName ( t ) } :${ getTargetName ( t ) } ` ) ;
110111
111112// Runs Bazel for the determined test labels.
@@ -152,10 +153,10 @@ function convertPathToBazelLabel(name) {
152153
153154/** Gets the name of the target that should be run. */
154155function getTargetName ( packageName ) {
155- // Schematics don't have _local and browser targets.
156+ // Schematics don't have _debug and browser targets.
156157 if ( packageName && packageName . endsWith ( 'schematics' ) ) {
157158 return 'unit_tests' ;
158159 }
159160
160- return `unit_tests_${ local ? 'local ' : browserName } ` ;
161+ return `unit_tests_${ debug ? 'debug ' : browserName } ` ;
161162}
0 commit comments