@@ -34,6 +34,11 @@ const packagesDir = path.join(projectDir, 'src/');
3434// e.g. "button" will become "material/button", and "overlay" becomes "cdk/overlay".
3535const orderedGuessPackages = [ 'material' , 'cdk' , 'material-experimental' , 'cdk-experimental' ] ;
3636
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+
3742// ShellJS should exit if any command fails.
3843shelljs . set ( '-e' ) ;
3944shelljs . cd ( projectDir ) ;
@@ -82,7 +87,9 @@ if (!components.length) {
8287}
8388
8489const 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 } ` ) ;
8693
8794// Runs Bazel for the determined test labels.
8895shelljs . exec ( `${ bazelBinary } ${ bazelAction } ${ testLabels . join ( ' ' ) } ` ) ;
@@ -121,6 +128,16 @@ function convertPathToBazelLabel(name) {
121128 return null ;
122129}
123130
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+
124141/** Converts an arbitrary path to a Posix path. */
125142function convertPathToPosix ( pathName ) {
126143 return pathName . replace ( / \\ / g, '/' ) ;
0 commit comments