refactor(core): static-query migration should not fail for test files (#30034)
Currently when someone runs `ng update` with the static-query migration, the migration can fail with an error saying that the `AOT` compiler could not be created. This can happen if the CLI project contains a test `tsconfig.json` that is picked up by the schematic. Due to the fact that spec tsconfig files cannot be ran with NGC (e.g. test components are not part of a module; not all source files are guaranteed to be included), test `tsconfig` projects will now use a new `test` migration strategy where all queries within tests are left untouched and a TODO is added. PR Close #30034
This commit is contained in:

committed by
Ben Lesh

parent
00ce9aab5b
commit
364250e7a6
@ -19,15 +19,15 @@ import {addToImport, createImport, removeFromImport} from './move-import';
|
||||
/** Entry point for the V8 move-document migration. */
|
||||
export default function(): Rule {
|
||||
return (tree: Tree) => {
|
||||
const projectTsConfigPaths = getProjectTsConfigPaths(tree);
|
||||
const {buildPaths, testPaths} = getProjectTsConfigPaths(tree);
|
||||
const basePath = process.cwd();
|
||||
|
||||
if (!projectTsConfigPaths.length) {
|
||||
if (!buildPaths.length && !testPaths.length) {
|
||||
throw new SchematicsException(`Could not find any tsconfig file. Cannot migrate DOCUMENT
|
||||
to new import source.`);
|
||||
}
|
||||
|
||||
for (const tsconfigPath of projectTsConfigPaths) {
|
||||
for (const tsconfigPath of [...buildPaths, ...testPaths]) {
|
||||
runMoveDocumentMigration(tree, tsconfigPath, basePath);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user