From 8f425701e468eee041afa0a258d97ce50edd522f Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Tue, 4 Dec 2018 17:22:19 -0800 Subject: [PATCH] test(ivy): enable //packages/bazel/test/ngc-wrapped/... tests for Ivy (#27470) This commit allows //packages/bazel/test/ngc-wrapped/... tests to run under Ivy mode. To get them to pass, it addresses a problem with the way the tests are configured: both test targets have sloppy .d.ts dependencies configured, leading to many type errors being generated in TypeScript for the .d.ts files. Due to the way ngc directs TypeScript emit, it avoids type-checking .d.ts files and thus this issue does not surface. ngtsc does a whole- program emit which results in full .d.ts type-checking by default, catching this configuration issue. To fix this, skipLibCheck is added to the tsconfig.jsons for these tests, which tells TypeScript to skip type-checking of the .d.ts files, avoiding this problem in a similar way to ngc. PR Close #27470 --- packages/bazel/test/ngc-wrapped/empty/BUILD.bazel | 1 - packages/bazel/test/ngc-wrapped/empty/tsconfig.json | 3 ++- packages/bazel/test/ngc-wrapped/index_test.ts | 2 +- packages/bazel/test/ngc-wrapped/tsconfig_template.ts | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel b/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel index 7fe7d72d9777a..68e33b75fa28d 100644 --- a/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel +++ b/packages/bazel/test/ngc-wrapped/empty/BUILD.bazel @@ -5,7 +5,6 @@ package(default_visibility = ["//packages/bazel/test:__subpackages__"]) ng_module( name = "empty", srcs = ["empty.ts"], - tags = ["fixme-ivy-aot"], # FW-741: ngtsc breaks tsc module resolution tsconfig = ":tsconfig.json", deps = [ "//packages/core", diff --git a/packages/bazel/test/ngc-wrapped/empty/tsconfig.json b/packages/bazel/test/ngc-wrapped/empty/tsconfig.json index 35ac957478e13..dbbfea0bed944 100644 --- a/packages/bazel/test/ngc-wrapped/empty/tsconfig.json +++ b/packages/bazel/test/ngc-wrapped/empty/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "paths": { "@angular/core": ["../../../../dist/packages/core"] - } + }, + "skipLibCheck": true } } diff --git a/packages/bazel/test/ngc-wrapped/index_test.ts b/packages/bazel/test/ngc-wrapped/index_test.ts index 5d61112da7827..9560450274b77 100644 --- a/packages/bazel/test/ngc-wrapped/index_test.ts +++ b/packages/bazel/test/ngc-wrapped/index_test.ts @@ -17,7 +17,7 @@ describe('ngc_wrapped', () => { // fixmeIvy placeholder to prevent jasmine from erroring out because there are no specs it('should be removed once the fixmeIvy below is resolved', () => {}); - fixmeIvy('FW-741: ngtsc breaks tsc module resolution').it('should work', () => { + it('should work', () => { const {read, write, runOneBuild, writeConfig, shouldExist, basePath} = setup(); write('some_project/index.ts', ` diff --git a/packages/bazel/test/ngc-wrapped/tsconfig_template.ts b/packages/bazel/test/ngc-wrapped/tsconfig_template.ts index 77d408e107bdb..5459a6e62ffd8 100644 --- a/packages/bazel/test/ngc-wrapped/tsconfig_template.ts +++ b/packages/bazel/test/ngc-wrapped/tsconfig_template.ts @@ -55,6 +55,7 @@ export function createTsConfig(options: TsConfigOptions) { // declaration in the same tsconfig.json, otherwise ts will error. 'declaration': true, 'declarationDir': options.outDir, + 'skipLibCheck': true, }, 'bazelOptions': { ...result.bazelOptions,