Skip to content

Commit dcbba89

Browse files
crisbetojelbourn
authored andcommitted
build: unable to run schematics tests through test script (#19230)
Fixes not being able to run the schematics tests through `yarn test`. The logic for resolving the package was correct, but we were appending the wrong target name. Fixes #19182.
1 parent d509ff7 commit dcbba89

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/run-component-tests.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,10 @@ if (!components.length) {
8686
process.exit(1);
8787
}
8888

89-
const testTargetName = `unit_tests_${local ? 'local' : browserName}`;
9089
const bazelAction = local ? 'run' : 'test';
9190
const testLabels = components
9291
.map(t => correctTypos(t))
93-
.map(t => `${getBazelPackageOfComponentName(t)}:${testTargetName}`);
92+
.map(t => `${getBazelPackageOfComponentName(t)}:${getTargetName(t)}`);
9493

9594
// Runs Bazel for the determined test labels.
9695
shelljs.exec(`${bazelBinary} ${bazelAction} ${testLabels.join(' ')} ${configFlag}`);
@@ -143,3 +142,13 @@ function correctTypos(target) {
143142
function convertPathToPosix(pathName) {
144143
return pathName.replace(/\\/g, '/');
145144
}
145+
146+
/** Gets the name of the target that should be run. */
147+
function getTargetName(packageName) {
148+
// Schematics don't have _local and browser targets.
149+
if (packageName && packageName.endsWith('schematics')) {
150+
return 'unit_tests';
151+
}
152+
153+
return `unit_tests_${local ? 'local' : browserName}`;
154+
}

0 commit comments

Comments
 (0)