From 06525cfed3b8db949952e71c787e76c7c318929e Mon Sep 17 00:00:00 2001 From: JoostK Date: Sat, 26 Sep 2020 22:28:12 +0200 Subject: [PATCH] test(compiler-cli): fix tests to have at least one component (#39011) With the introduction of incremental type checking in #36211, an intermediate `ts.Program` for type checking is only created if there are any templates to check. This rendered some tests ineffective at avoiding regressions, as the intermediate `ts.Program` was required for the tests to fail if the scenario under test would not be accounted for. This commit adds a single component to these tests, to ensure the intermediate `ts.Program` is in fact created. PR Close #39011 --- .../compiler-cli/test/ngtsc/incremental_spec.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/compiler-cli/test/ngtsc/incremental_spec.ts b/packages/compiler-cli/test/ngtsc/incremental_spec.ts index a7fd2024f9..59be3f750d 100644 --- a/packages/compiler-cli/test/ngtsc/incremental_spec.ts +++ b/packages/compiler-cli/test/ngtsc/incremental_spec.ts @@ -433,8 +433,13 @@ runInEachFileSystem(() => { }); it('should compile incrementally with template type-checking turned on', () => { - env.tsconfig({ivyTemplateTypeCheck: true}); - env.write('main.ts', 'export class Foo {}'); + env.tsconfig({fullTemplateTypeCheck: true}); + env.write('main.ts', ` + import {Component} from '@angular/core'; + + @Component({template: ''}) + export class MyComponent {} + `); env.driveMain(); env.invalidateCachedFile('main.ts'); env.driveMain(); @@ -482,8 +487,12 @@ runInEachFileSystem(() => { env.write('node_modules/b/index.js', `export {ServiceA as ServiceB} from 'a';`); env.write('node_modules/b/index.d.ts', `export {ServiceA as ServiceB} from 'a';`); env.write('test.ts', ` + import {Component} from '@angular/core'; import {ServiceA} from 'a'; import {ServiceB} from 'b'; + + @Component({template: ''}) + export class MyComponent {} `); env.driveMain(); env.flushWrittenFileTracking();