diff --git a/packages/core/schematics/migrations/undecorated-classes-with-di/create_ngc_program.ts b/packages/core/schematics/migrations/undecorated-classes-with-di/create_ngc_program.ts index 3eb0c52a956e1..35b6c764ae004 100644 --- a/packages/core/schematics/migrations/undecorated-classes-with-di/create_ngc_program.ts +++ b/packages/core/schematics/migrations/undecorated-classes-with-di/create_ngc_program.ts @@ -12,12 +12,14 @@ import * as ts from 'typescript'; /** Creates an NGC program that can be used to read and parse metadata for files. */ export function createNgcProgram( - createHost: (options: ts.CompilerOptions) => ts.CompilerHost, tsconfigPath: string | null, - parseConfig: () => { - rootNames: readonly string[], - options: ts.CompilerOptions - } = () => readConfiguration(tsconfigPath !)) { - const {rootNames, options} = parseConfig(); + createHost: (options: ts.CompilerOptions) => ts.CompilerHost, tsconfigPath: string) { + const {rootNames, options} = readConfiguration(tsconfigPath); + + // https://github.com/angular/angular/commit/ec4381dd401f03bded652665b047b6b90f2b425f made Ivy + // the default. This breaks the assumption that "createProgram" from compiler-cli returns the + // NGC program. In order to ensure that the migration runs properly, we set "enableIvy" to false. + options.enableIvy = false; + const host = createHost(options); const ngcProgram = createProgram({rootNames, options, host}); const program = ngcProgram.getTsProgram(); diff --git a/packages/core/schematics/test/BUILD.bazel b/packages/core/schematics/test/BUILD.bazel index a73ec1a3c71ac..d863cfd32c6d4 100644 --- a/packages/core/schematics/test/BUILD.bazel +++ b/packages/core/schematics/test/BUILD.bazel @@ -25,7 +25,7 @@ ts_library( ) jasmine_node_test( - name = "google3", + name = "test", deps = [ ":test_lib", "@npm//shelljs", diff --git a/packages/core/schematics/test/google3/BUILD.bazel b/packages/core/schematics/test/google3/BUILD.bazel index 8effc74710d8e..61bf979319e6f 100644 --- a/packages/core/schematics/test/google3/BUILD.bazel +++ b/packages/core/schematics/test/google3/BUILD.bazel @@ -12,7 +12,7 @@ ts_library( ) jasmine_node_test( - name = "test", + name = "google3", deps = [ ":test_lib", "@npm//shelljs", diff --git a/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts b/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts index e51b34644ada3..4c53708688bea 100644 --- a/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts +++ b/packages/core/schematics/test/undecorated_classes_with_di_migration_spec.ts @@ -32,7 +32,6 @@ describe('Undecorated classes with DI migration', () => { compilerOptions: { lib: ['es2015'], }, - angularCompilerOptions: {enableIvy: false} })); writeFile('/angular.json', JSON.stringify({ projects: {t: {architect: {build: {options: {tsConfig: './tsconfig.json'}}}}}