diff --git a/packages/core/schematics/BUILD.bazel b/packages/core/schematics/BUILD.bazel index f83cb584a8..29546e0172 100644 --- a/packages/core/schematics/BUILD.bazel +++ b/packages/core/schematics/BUILD.bazel @@ -3,7 +3,6 @@ load("//tools:defaults.bzl", "npm_package") exports_files([ "tsconfig.json", "migrations.json", - "test-migrations.json", ]) npm_package( diff --git a/packages/core/schematics/test-migrations.json b/packages/core/schematics/test-migrations.json deleted file mode 100644 index c057a763a4..0000000000 --- a/packages/core/schematics/test-migrations.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "schematics": { - "migration-move-document": { - "description": "Migrates DOCUMENT Injection token from platform-browser imports to common import", - "factory": "./migrations/move-document/index" - }, - "migration-static-queries": { - "description": "Migrates ViewChild and ContentChild to explicit query timing", - "factory": "./migrations/static-queries/index" - }, - "migration-template-local-variables": { - "description": "Warns developers if values are assigned to template variables", - "factory": "./migrations/template-var-assignment/index" - }, - "migration-injectable-pipe": { - "description": "Migrates all Pipe classes so that they have an Injectable annotation", - "factory": "./migrations/injectable-pipe/index" - } - } -} diff --git a/packages/core/schematics/test/BUILD.bazel b/packages/core/schematics/test/BUILD.bazel index cdb4814bc6..f61d48e0dc 100644 --- a/packages/core/schematics/test/BUILD.bazel +++ b/packages/core/schematics/test/BUILD.bazel @@ -5,7 +5,8 @@ ts_library( testonly = True, srcs = glob(["**/*.ts"]), data = [ - "//packages/core/schematics:test-migrations.json", + "test-migrations.json", + "//packages/core/schematics:migrations.json", ], deps = [ "//packages/core/schematics/migrations/injectable-pipe", diff --git a/packages/core/schematics/test/injectable_pipe_migration_spec.ts b/packages/core/schematics/test/injectable_pipe_migration_spec.ts index ba73bf49b9..a37399414e 100644 --- a/packages/core/schematics/test/injectable_pipe_migration_spec.ts +++ b/packages/core/schematics/test/injectable_pipe_migration_spec.ts @@ -20,7 +20,7 @@ describe('injectable pipe migration', () => { let previousWorkingDir: string; beforeEach(() => { - runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json')); + runner = new SchematicTestRunner('test', require.resolve('./test-migrations.json')); host = new TempScopedNodeJsSyncHost(); tree = new UnitTestTree(new HostTree(host)); diff --git a/packages/core/schematics/test/move_document_migration_spec.ts b/packages/core/schematics/test/move_document_migration_spec.ts index 2cd3df8ec3..85f55411ac 100644 --- a/packages/core/schematics/test/move_document_migration_spec.ts +++ b/packages/core/schematics/test/move_document_migration_spec.ts @@ -20,7 +20,7 @@ describe('move-document migration', () => { let previousWorkingDir: string; beforeEach(() => { - runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json')); + runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); host = new TempScopedNodeJsSyncHost(); tree = new UnitTestTree(new HostTree(host)); @@ -151,5 +151,5 @@ describe('move-document migration', () => { host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents)); } - function runMigration() { runner.runSchematic('migration-move-document', {}, tree); } + function runMigration() { runner.runSchematic('migration-v8-move-document', {}, tree); } }); diff --git a/packages/core/schematics/test/static_queries_migration_template_spec.ts b/packages/core/schematics/test/static_queries_migration_template_spec.ts index e9ae5ad0a3..cdb8b62061 100644 --- a/packages/core/schematics/test/static_queries_migration_template_spec.ts +++ b/packages/core/schematics/test/static_queries_migration_template_spec.ts @@ -21,7 +21,7 @@ describe('static-queries migration with template strategy', () => { let warnOutput: string[]; beforeEach(() => { - runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json')); + runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); host = new TempScopedNodeJsSyncHost(); tree = new UnitTestTree(new HostTree(host)); @@ -97,7 +97,7 @@ describe('static-queries migration with template strategy', () => { } async function runMigration() { - await runner.runSchematicAsync('migration-static-queries', {}, tree).toPromise(); + await runner.runSchematicAsync('migration-v8-static-queries', {}, tree).toPromise(); } describe('ViewChild', () => { diff --git a/packages/core/schematics/test/static_queries_migration_usage_spec.ts b/packages/core/schematics/test/static_queries_migration_usage_spec.ts index 258d7ff9e7..1b30aadf8b 100644 --- a/packages/core/schematics/test/static_queries_migration_usage_spec.ts +++ b/packages/core/schematics/test/static_queries_migration_usage_spec.ts @@ -26,7 +26,7 @@ describe('static-queries migration with usage strategy', () => { afterAll(() => process.env['NG_STATIC_QUERY_USAGE_STRATEGY'] = ''); beforeEach(() => { - runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json')); + runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); host = new TempScopedNodeJsSyncHost(); tree = new UnitTestTree(new HostTree(host)); @@ -145,7 +145,7 @@ describe('static-queries migration with usage strategy', () => { } async function runMigration() { - await runner.runSchematicAsync('migration-static-queries', {}, tree).toPromise(); + await runner.runSchematicAsync('migration-v8-static-queries', {}, tree).toPromise(); } function createQueryTests(queryType: 'ViewChild' | 'ContentChild') { diff --git a/packages/core/schematics/test/template_var_assignment_migration_spec.ts b/packages/core/schematics/test/template_var_assignment_migration_spec.ts index 5797cfdaaf..742ced7e15 100644 --- a/packages/core/schematics/test/template_var_assignment_migration_spec.ts +++ b/packages/core/schematics/test/template_var_assignment_migration_spec.ts @@ -21,7 +21,7 @@ describe('template variable assignment migration', () => { let warnOutput: string[]; beforeEach(() => { - runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json')); + runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); host = new TempScopedNodeJsSyncHost(); tree = new UnitTestTree(new HostTree(host)); @@ -58,7 +58,9 @@ describe('template variable assignment migration', () => { host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents)); } - function runMigration() { runner.runSchematic('migration-template-local-variables', {}, tree); } + function runMigration() { + runner.runSchematic('migration-v8-template-local-variables', {}, tree); + } it('should warn for two-way data binding variable assignment', () => { writeFile('/index.ts', ` diff --git a/packages/core/schematics/test/test-migrations.json b/packages/core/schematics/test/test-migrations.json new file mode 100644 index 0000000000..cdb97750a4 --- /dev/null +++ b/packages/core/schematics/test/test-migrations.json @@ -0,0 +1,10 @@ +{ + // Migrations which are not publicly enabled but still run as part of tests need to + // be part of a schematic collection in order to be able to run it. + "schematics": { + "migration-injectable-pipe": { + "description": "Migrates all Pipe classes so that they have an Injectable annotation", + "factory": "../migrations/injectable-pipe/index" + } + } +}