fix: disable injectable-pipe migration (#30180)

Disables the injectable pipe migration until we can decide whether this is the right solution for Ivy. Rolling it out properly will involve a more detailed plan and more changes like updating the styleguide, scaffolding schematics etc.

Context for the new `test-migrations.json`: since we use the `migrations.json` both for the real migrations and for tests, it doesn't allow us to disable a schematic, but continue running its tests. This change adds the test-specific file so that we can continue running the `injectable-pipe` tests, even though the schematic itself is disabled.

PR Close #30180
This commit is contained in:
crisbeto 2019-04-28 23:04:09 +02:00 committed by Andrew Kushnir
parent 6f433887e0
commit 572b54967c
9 changed files with 234 additions and 220 deletions

View File

@ -3,6 +3,7 @@ load("//tools:defaults.bzl", "npm_package")
exports_files([ exports_files([
"tsconfig.json", "tsconfig.json",
"migrations.json", "migrations.json",
"test-migrations.json",
]) ])
npm_package( npm_package(

View File

@ -14,11 +14,6 @@
"version": "8-beta", "version": "8-beta",
"description": "Warns developers if values are assigned to template variables", "description": "Warns developers if values are assigned to template variables",
"factory": "./migrations/template-var-assignment/index" "factory": "./migrations/template-var-assignment/index"
},
"migration-v8-injectable-pipe": {
"version": "8-beta",
"description": "Migrates all Pipe classes so that they have an Injectable annotation",
"factory": "./migrations/injectable-pipe/index"
} }
} }
} }

View File

@ -0,0 +1,20 @@
{
"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"
}
}
}

View File

@ -5,7 +5,7 @@ ts_library(
testonly = True, testonly = True,
srcs = glob(["**/*.ts"]), srcs = glob(["**/*.ts"]),
data = [ data = [
"//packages/core/schematics:migrations.json", "//packages/core/schematics:test-migrations.json",
], ],
deps = [ deps = [
"//packages/core/schematics/migrations/injectable-pipe", "//packages/core/schematics/migrations/injectable-pipe",

View File

@ -20,7 +20,7 @@ describe('injectable pipe migration', () => {
let previousWorkingDir: string; let previousWorkingDir: string;
beforeEach(() => { beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json'));
host = new TempScopedNodeJsSyncHost(); host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host)); tree = new UnitTestTree(new HostTree(host));
@ -123,5 +123,5 @@ describe('injectable pipe migration', () => {
host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents)); host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents));
} }
function runMigration() { runner.runSchematic('migration-v8-injectable-pipe', {}, tree); } function runMigration() { runner.runSchematic('migration-injectable-pipe', {}, tree); }
}); });

View File

@ -20,7 +20,7 @@ describe('move-document migration', () => {
let previousWorkingDir: string; let previousWorkingDir: string;
beforeEach(() => { beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json'));
host = new TempScopedNodeJsSyncHost(); host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host)); tree = new UnitTestTree(new HostTree(host));
@ -151,5 +151,5 @@ describe('move-document migration', () => {
host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents)); host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents));
} }
function runMigration() { runner.runSchematic('migration-v8-move-document', {}, tree); } function runMigration() { runner.runSchematic('migration-move-document', {}, tree); }
}); });

View File

@ -21,7 +21,7 @@ describe('static-queries migration with template strategy', () => {
let warnOutput: string[]; let warnOutput: string[];
beforeEach(() => { beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json'));
host = new TempScopedNodeJsSyncHost(); host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host)); tree = new UnitTestTree(new HostTree(host));
@ -97,7 +97,7 @@ describe('static-queries migration with template strategy', () => {
} }
async function runMigration() { async function runMigration() {
await runner.runSchematicAsync('migration-v8-static-queries', {}, tree).toPromise(); await runner.runSchematicAsync('migration-static-queries', {}, tree).toPromise();
} }
describe('ViewChild', () => { describe('ViewChild', () => {

View File

@ -26,7 +26,7 @@ describe('static-queries migration with usage strategy', () => {
afterAll(() => process.env['NG_STATIC_QUERY_USAGE_STRATEGY'] = ''); afterAll(() => process.env['NG_STATIC_QUERY_USAGE_STRATEGY'] = '');
beforeEach(() => { beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json'));
host = new TempScopedNodeJsSyncHost(); host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host)); tree = new UnitTestTree(new HostTree(host));
@ -145,7 +145,7 @@ describe('static-queries migration with usage strategy', () => {
} }
async function runMigration() { async function runMigration() {
await runner.runSchematicAsync('migration-v8-static-queries', {}, tree).toPromise(); await runner.runSchematicAsync('migration-static-queries', {}, tree).toPromise();
} }
function createQueryTests(queryType: 'ViewChild' | 'ContentChild') { function createQueryTests(queryType: 'ViewChild' | 'ContentChild') {

View File

@ -21,7 +21,7 @@ describe('template variable assignment migration', () => {
let warnOutput: string[]; let warnOutput: string[];
beforeEach(() => { beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('../migrations.json')); runner = new SchematicTestRunner('test', require.resolve('../test-migrations.json'));
host = new TempScopedNodeJsSyncHost(); host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host)); tree = new UnitTestTree(new HostTree(host));
@ -58,9 +58,7 @@ describe('template variable assignment migration', () => {
host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents)); host.sync.write(normalize(filePath), virtualFs.stringToFileBuffer(contents));
} }
function runMigration() { function runMigration() { runner.runSchematic('migration-template-local-variables', {}, tree); }
runner.runSchematic('migration-v8-template-local-variables', {}, tree);
}
it('should warn for two-way data binding variable assignment', () => { it('should warn for two-way data binding variable assignment', () => {
writeFile('/index.ts', ` writeFile('/index.ts', `