test(compiler-cli): disable `emitDecoratorMetadata` in the compiler test environment (#41557)
The `emitDecoratorMetadata` compiler option does not have to be enabled as Angular decorators are transformed by the AOT compiler. Having the option enabled in our tests can hide issues around import preservation, as with `emitDecoratorMetadata` enabled the TypeScript compiler itself does not elide imports even if they are only used in type-positions. This is unlike having `emitDecoratorMetadata` disabled, however; in that case the Angular compiler has to actively trick TypeScript into retaining default imports when an identifier in a type-only position has been reified into a value position for DI purposes. A subsequent commit addresses a bug in default import preservation that relies on this flag being `false`. PR Close #41557
This commit is contained in:
parent
528e7d787c
commit
9b9e7ad5cf
|
@ -53,7 +53,7 @@ export class NgtscTestEnvironment {
|
|||
|
||||
env.write(absoluteFrom('/tsconfig-base.json'), `{
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": true,
|
||||
|
|
|
@ -4648,7 +4648,7 @@ function allTests(os: string) {
|
|||
|
||||
env.driveMain();
|
||||
const jsContents = trim(env.getContents('test.js'));
|
||||
expect(jsContents).toContain(`import { KeyCodes } from './keycodes';`);
|
||||
expect(jsContents).toContain(`import * as i1 from "./keycodes";`);
|
||||
expect(jsContents).toMatch(setClassMetadataRegExp('type: i1.KeyCodes'));
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue