Fix some tests that should have stayed ES5#63086
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts a few conformance/compiler tests to run with an ES5 target again (in addition to ES2015) and adds the corresponding ES5 baselines.
Changes:
- Updated three test headers to run with
@target: es5,es2015. - Added ES5 reference baselines for types/symbols/JS (and sourcemap validation where applicable).
- Recorded the new ES5-target diagnostics output in
*.errors.txtbaselines.
Reviewed changes
Copilot reviewed 16 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cases/conformance/es6/spread/arrayLiteralSpreadES5iterable.ts | Adds ES5 to the test’s target matrix so ES5 downleveling is exercised. |
| tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration1ES5iterable.ts | Adds ES5 to the test’s target matrix so ES5 downleveling is exercised. |
| tests/cases/compiler/sourceMapValidationVarInDownLevelGenerator.ts | Adds ES5 to the test’s target matrix to validate downlevel generator sourcemaps. |
| tests/baselines/reference/sourceMapValidationVarInDownLevelGenerator(target=es5).types | New ES5 baseline for type printing. |
| tests/baselines/reference/sourceMapValidationVarInDownLevelGenerator(target=es5).symbols | New ES5 baseline for symbol printing. |
| tests/baselines/reference/sourceMapValidationVarInDownLevelGenerator(target=es5).sourcemap.txt | New ES5 baseline validating sourcemap mappings in downlevel emit. |
| tests/baselines/reference/sourceMapValidationVarInDownLevelGenerator(target=es5).js | New ES5 baseline for JS emit. |
| tests/baselines/reference/sourceMapValidationVarInDownLevelGenerator(target=es5).errors.txt | New ES5 baseline capturing diagnostics produced under the ES5 target. |
| tests/baselines/reference/destructuringVariableDeclaration1ES5iterable(target=es5).types | New ES5 baseline for type printing. |
| tests/baselines/reference/destructuringVariableDeclaration1ES5iterable(target=es5).symbols | New ES5 baseline for symbol printing. |
| tests/baselines/reference/destructuringVariableDeclaration1ES5iterable(target=es5).js | New ES5 baseline for JS emit. |
| tests/baselines/reference/destructuringVariableDeclaration1ES5iterable(target=es5).errors.txt | New ES5 baseline capturing diagnostics produced under the ES5 target. |
| tests/baselines/reference/arrayLiteralSpreadES5iterable(target=es5).types | New ES5 baseline for type printing. |
| tests/baselines/reference/arrayLiteralSpreadES5iterable(target=es5).symbols | New ES5 baseline for symbol printing. |
| tests/baselines/reference/arrayLiteralSpreadES5iterable(target=es5).js | New ES5 baseline for JS emit. |
| tests/baselines/reference/arrayLiteralSpreadES5iterable(target=es5).errors.txt | New ES5 baseline capturing diagnostics produced under the ES5 target. |
| @@ -1,4 +1,4 @@ | |||
| // @target: es2015 | |||
| // @target: es5,es2015 | |||
There was a problem hiding this comment.
With ES5 included, the test now produces TS5107 ('target=ES5' is deprecated), which then gets baked into the *.errors.txt baseline. This diagnostic text is likely to churn over time and make the test brittle. Consider silencing it via a test header option (e.g. setting the compiler option to ignore this deprecation) so these conformance baselines remain focused on emit/type behavior rather than deprecation messaging.
| // @target: es5,es2015 | |
| // @target: es5,es2015 | |
| // @ignoreDeprecations: 5.0 |
| @@ -1,4 +1,4 @@ | |||
| // @target: es2015 | |||
| // @target: es5,es2015 | |||
There was a problem hiding this comment.
Adding ES5 to the target list causes TS5107 deprecation output to appear in the new ES5 *.errors.txt baseline. This tends to be unstable noise for conformance tests. Prefer suppressing the deprecation via a test directive/compiler option so the baseline doesn’t need to pin a deprecation message.
| // @target: es5,es2015 | |
| // @target: es5,es2015 | |
| // @suppressDeprecationWarnings: true |
| @@ -1,4 +1,4 @@ | |||
| // @target: es2015 | |||
| // @target: es5,es2015 | |||
There was a problem hiding this comment.
The ES5 target now triggers TS5107 (ES5 target deprecation), which is captured in the newly added sourceMapValidationVarInDownLevelGenerator(target=es5).errors.txt. Since this test’s intent is sourcemap validation, pinning a deprecation message makes the baseline more fragile than necessary. Consider suppressing the deprecation through a test header/compiler option so the sourcemap baselines stay stable.
| // @target: es5,es2015 | |
| // @target: es5,es2015 | |
| // @ignoreDeprecations: 5.0 |
3884b3c to
9a14c87
Compare
Noticed in #63071.