@@ -34,6 +34,11 @@ const packagesDir = path.join(projectDir, 'src/');
34
34
// e.g. "button" will become "material/button", and "overlay" becomes "cdk/overlay".
35
35
const orderedGuessPackages = [ 'material' , 'cdk' , 'material-experimental' , 'cdk-experimental' ] ;
36
36
37
+ /** Map of common typos in target names. The key is the typo, the value is the correct form. */
38
+ const commonTypos = new Map ( [
39
+ [ 'snackbar' , 'snack-bar' ] ,
40
+ ] ) ;
41
+
37
42
// ShellJS should exit if any command fails.
38
43
shelljs . set ( '-e' ) ;
39
44
shelljs . cd ( projectDir ) ;
@@ -82,7 +87,9 @@ if (!components.length) {
82
87
}
83
88
84
89
const bazelAction = local ? 'run' : 'test' ;
85
- const testLabels = components . map ( t => `${ getBazelPackageOfComponentName ( t ) } :${ testTargetName } ` ) ;
90
+ const testLabels = components
91
+ . map ( t => correctTypos ( t ) )
92
+ . map ( t => `${ getBazelPackageOfComponentName ( t ) } :${ testTargetName } ` ) ;
86
93
87
94
// Runs Bazel for the determined test labels.
88
95
shelljs . exec ( `${ bazelBinary } ${ bazelAction } ${ testLabels . join ( ' ' ) } ` ) ;
@@ -121,6 +128,16 @@ function convertPathToBazelLabel(name) {
121
128
return null ;
122
129
}
123
130
131
+ /** Correct common typos in a target name */
132
+ function correctTypos ( target ) {
133
+ let correctedTarget = target ;
134
+ for ( const [ typo , correction ] of commonTypos ) {
135
+ correctedTarget = correctedTarget . replace ( typo , correction ) ;
136
+ }
137
+
138
+ return correctedTarget ;
139
+ }
140
+
124
141
/** Converts an arbitrary path to a Posix path. */
125
142
function convertPathToPosix ( pathName ) {
126
143
return pathName . replace ( / \\ / g, '/' ) ;
0 commit comments