Skip to content

Commit 3b63082

Browse files
cexbrayatdylhunn
authored andcommitted
fix(migrations): avoid migrating route component in tests (#57317)
The migration was migrating all files in a project (like most migrations). As there is no gain in migrating components used in test files. Excluding the test files reduces the migration noise. PR Close #57317
1 parent 25bc810 commit 3b63082

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • packages/core/schematics/ng-generate/route-lazy-loading

packages/core/schematics/ng-generate/route-lazy-loading/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ interface Options {
2222

2323
export default function (options: Options): Rule {
2424
return async (tree, context) => {
25-
const {buildPaths, testPaths} = await getProjectTsConfigPaths(tree);
25+
const {buildPaths} = await getProjectTsConfigPaths(tree);
2626
const basePath = process.cwd();
27-
const allPaths = [...buildPaths, ...testPaths];
2827
// TS and Schematic use paths in POSIX format even on Windows. This is needed as otherwise
2928
// string matching such as `sourceFile.fileName.startsWith(pathToMigrate)` might not work.
3029
const pathToMigrate = normalizePath(join(basePath, options.path));
3130

32-
if (!allPaths.length) {
31+
if (!buildPaths.length) {
3332
throw new SchematicsException(
3433
'Could not find any tsconfig file. Cannot run the route lazy loading migration.',
3534
);
@@ -38,7 +37,7 @@ export default function (options: Options): Rule {
3837
let migratedRoutes: RouteMigrationData[] = [];
3938
let skippedRoutes: RouteMigrationData[] = [];
4039

41-
for (const tsconfigPath of allPaths) {
40+
for (const tsconfigPath of buildPaths) {
4241
const {migratedRoutes: migrated, skippedRoutes: skipped} = standaloneRoutesMigration(
4342
tree,
4443
tsconfigPath,

0 commit comments

Comments
 (0)