Skip to content

Commit

Permalink
test(ivy): enable //packages/bazel/test/ngc-wrapped/... tests for Ivy
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alxhub committed Dec 5, 2018
1 parent fd4c4c2 commit 31c0000
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/bazel/test/ngc-wrapped/empty/BUILD.bazel
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/bazel/test/ngc-wrapped/empty/tsconfig.json
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"paths": {
"@angular/core": ["../../../../dist/packages/core"]
}
},
"skipLibCheck": true
}
}
2 changes: 1 addition & 1 deletion packages/bazel/test/ngc-wrapped/index_test.ts
Expand Up @@ -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', `
Expand Down
1 change: 1 addition & 0 deletions packages/bazel/test/ngc-wrapped/tsconfig_template.ts
Expand Up @@ -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,
Expand Down

0 comments on commit 31c0000

Please sign in to comment.