experimentalDecorators and emitDecoratorMetadata affect builder state (#36297)

* experimentalDecorators and emitDecoratorMetadata affect builder state

* better test
This commit is contained in:
Klaus Meinhardt
2020-01-21 20:28:55 +01:00
committed by Sheetal Nandi
parent 2dd21a08f5
commit bc1e7728df
3 changed files with 252 additions and 0 deletions

View File

@@ -743,12 +743,15 @@ namespace ts {
{
name: "experimentalDecorators",
type: "boolean",
affectsSemanticDiagnostics: true,
category: Diagnostics.Experimental_Options,
description: Diagnostics.Enables_experimental_support_for_ES7_decorators
},
{
name: "emitDecoratorMetadata",
type: "boolean",
affectsSemanticDiagnostics: true,
affectsEmit: true,
category: Diagnostics.Experimental_Options,
description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
},

View File

@@ -243,6 +243,49 @@ namespace ts.tscWatch {
]
});
verifyTscWatch({
scenario,
subScenario: "updates diagnostics and emit for decorators",
commandLineArgs: ["-w"],
sys: () => {
const aTs: File = {
path: "/a.ts",
content: `import {B} from './b'
@((_) => {})
export class A {
constructor(p: B) {}
}`,
};
const bTs: File = {
path: "/b.ts",
content: `export class B {}`,
};
const tsconfig: File = {
path: "/tsconfig.json",
content: JSON.stringify({
compilerOptions: { target: "es6", importsNotUsedAsValues: "error" }
})
};
return createWatchedSystem([libFile, aTs, bTs, tsconfig]);
},
changes: [
sys => {
sys.modifyFile("/tsconfig.json", JSON.stringify({
compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true }
}));
sys.checkTimeoutQueueLengthAndRun(1);
return "Enable experimentalDecorators";
},
sys => {
sys.modifyFile("/tsconfig.json", JSON.stringify({
compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true, emitDecoratorMetadata: true }
}));
sys.checkTimeoutQueueLengthAndRun(1);
return "Enable emitDecoratorMetadata";
}
]
});
verifyTscWatch({
scenario,
subScenario: "files explicitly excluded in config file",