12
12
*
13
13
* Supported command line flags:
14
14
*
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.
18
18
*/
19
19
20
20
const yargs = require ( 'yargs' ) ;
@@ -35,13 +35,14 @@ shelljs.set('-e');
35
35
shelljs . cd ( projectDir ) ;
36
36
37
37
// Extracts the supported command line options.
38
- const { components, local , firefox, watch} = yargs ( args )
38
+ const { components, debug , firefox, watch} = yargs ( args )
39
39
. command ( '* <components..>' , 'Run tests for specified components' , args =>
40
40
args . positional ( 'components' , { type : 'array' } ) ,
41
41
)
42
- . option ( 'local' , {
42
+ . option ( 'debug' , {
43
+ alias : 'local' ,
43
44
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.' ,
45
46
} )
46
47
. option ( 'firefox' , {
47
48
type : 'boolean' ,
@@ -58,13 +59,13 @@ const {components, local, firefox, watch} = yargs(args)
58
59
// Whether tests for all components should be run.
59
60
const all = components . length === 1 && components [ 0 ] === 'all' ;
60
61
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
62
63
// 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 ) ) {
64
65
console . error (
65
66
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 "' ,
68
69
) ,
69
70
) ;
70
71
process . exit ( 1 ) ;
@@ -105,7 +106,7 @@ if (!components.length) {
105
106
process . exit ( 1 ) ;
106
107
}
107
108
108
- const bazelAction = local ? 'run' : 'test' ;
109
+ const bazelAction = debug ? 'run' : 'test' ;
109
110
const testLabels = components . map ( t => `${ getBazelPackageOfComponentName ( t ) } :${ getTargetName ( t ) } ` ) ;
110
111
111
112
// Runs Bazel for the determined test labels.
@@ -152,10 +153,10 @@ function convertPathToBazelLabel(name) {
152
153
153
154
/** Gets the name of the target that should be run. */
154
155
function getTargetName ( packageName ) {
155
- // Schematics don't have _local and browser targets.
156
+ // Schematics don't have _debug and browser targets.
156
157
if ( packageName && packageName . endsWith ( 'schematics' ) ) {
157
158
return 'unit_tests' ;
158
159
}
159
160
160
- return `unit_tests_${ local ? 'local ' : browserName } ` ;
161
+ return `unit_tests_${ debug ? 'debug ' : browserName } ` ;
161
162
}
0 commit comments