chore: remove outFile,module:amd config from test cases - #64122
chore: remove outFile,module:amd config from test cases#64122Cameron (camc314) wants to merge 15 commits into
outFile,module:amd config from test cases#64122Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
|
|
outFile config from most test cases
outFile config from most test casesoutFile,module:amd config from test cases
4f948ef to
ec02195
Compare
86bafc9 to
60eb165
Compare
| func SkipUnsupportedCompilerOptions(t *testing.T, options *core.CompilerOptions) { | ||
| t.Helper() | ||
| switch options.Module { | ||
| case core.ModuleKindAMD, core.ModuleKindUMD, core.ModuleKindSystem: |
There was a problem hiding this comment.
Why remove the skips here? Is this leftover from you finding tests to fix? I'd hope we would still error if someone tries to introduce them somehow.
There was a problem hiding this comment.
Why remove the skips here? Is this leftover from you finding tests to fix? I'd hope we would still error if someone tries to introduce them somehow.
It felt like the logical thing to do. But I see your point - let me push a commit that does t.Fail() if an old compiler option is specified.
There was a problem hiding this comment.
Ah there's actually a bunch of stuff here I missed - let me take another proper look - apologies for marking it draft a little too early!
There was a problem hiding this comment.
Should be fixed now - I've changed these cases to fail with t.Fatalf rather than silently skip. This flagged some other issues, so I've changed those tests using outFile to outDir, and module:amd to module:commonjs where needed to prevent excess diagnostics
There was a problem hiding this comment.
Thanks; I wonder how much more it'd take to do this for all of the other options.
Probably also the func is misnamed but, it is somewhat temporary.
There was a problem hiding this comment.
Thanks; I wonder how much more it'd take to do this for all of the other options.
happy to send followup PRs if this is directionally right - these were the first two I noticed that caused us issues. But I don't want to make this any harder to review
There was a problem hiding this comment.
Sort of surprised this matters for you at all? These are our internal tests, right?
There was a problem hiding this comment.
We read all of the fixtures to know what we should be succeeding/failing to parse. (since there's not really a TS conformance suite anywhere).
Since some of these have no errors.txt (because they were skipped), our harness was expecting these to parse without errors (incorrect behaviour)
There was a problem hiding this comment.
We could just filter out cases that are skipped here, but then we risk not testing everything and possibly introducing regressions.
60eb165 to
d7f5e11
Compare
d7f5e11 to
5f3eef8
Compare
Jake Bailey (jakebailey)
left a comment
There was a problem hiding this comment.
I had copilot look at everything and it noticed a few things.
The inline comments cover the concrete test/baseline issues. Two additional cleanup/hardening notes do not land on changed lines:
tsc/testdata/tests/cases/compiler/isolatedModulesOut.tsis the sole remaining legacy@outfixture and is still permanently listed inskippedTests; it seems like it should be removed with the other outFile-only cases.SkipUnsupportedCompilerOptionsonly sees fourslash global directives. An embeddedtsconfig.jsoncontainingmodule: "amd"oroutFilestill runs; I confirmed both with temporary probes. There are no such configs left in this PR, so this is future-proofing rather than a current failing fixture, but the new rejection is not comprehensive.
For context, I also ran npx hereby build, npx hereby test, npx hereby lint, and npx hereby format at this commit; they all passed.
| // @Filename: file0.ts | ||
| /// <reference path="file1.ts" /> | ||
| /// <reference path="file2.ts" /> | ||
| /// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/> |
There was a problem hiding this comment.
This was a live test with existing JS/symbol/type baselines. The only AMD-specific part is this one directive; the rest covers removeComments stripping triple-slash references from files that still emit JavaScript, which the surviving ...OnNotEmittedNode test does not cover. Could we retain this test and remove only this directive?
| // @Filename: file2.ts | ||
| /// <reference path="file0.ts" /> | ||
| /// <reference path="file1.ts" /> | ||
| /// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/> |
There was a problem hiding this comment.
Same concern here: this test was running before the PR, and its primary empty-file/triple-slash-reference coverage is not AMD-specific. Removing this directive should let us retain the test and its existing baselines.
| @@ -1,5 +1,5 @@ | |||
| // @target: es2015 | |||
| // @module: amd | |||
| // @module: commonjs | |||
There was a problem hiding this comment.
This now becomes byte-for-byte identical to pathMappingBasedModuleResolution2_node.ts. The AMD/CommonJS distinction was what made the _classic/_node pair exercise different resolution behavior, so this silently loses the classic scenario. Could this use an explicit supported classic-resolution configuration, or otherwise be retired rather than duplicated?
| @@ -1,6 +1,6 @@ | |||
| // @target: es2015 | |||
| // @strict: false | |||
| //@module: amd | |||
| //@module: commonjs | |||
There was a problem hiding this comment.
This file is now byte-for-byte identical to sourceMapValidationExportAssignmentCommonjs.ts, so the newly generated baselines duplicate existing CommonJS coverage rather than preserving a distinct scenario. I think this should be removed rather than converted into a duplicate.
| @@ -1,5 +1,5 @@ | |||
| // @target: es6 | |||
| // @module: amd | |||
| // @module: commonjs | |||
There was a problem hiding this comment.
This change makes test 3 identical to test 1; similarly, test 4 becomes identical to test 2. These look like AMD-only matrix entries that should be removed instead of rewritten into duplicate CommonJS tests.
There was a problem hiding this comment.
updated in bbb8283460
| defer testutil.RecoverAndFail(t, "Panic on fourslash test") | ||
| const content = `// @AllowSyntheticDefaultImports: false | ||
| // @Module: amd | ||
| // @Module: commonjs |
There was a problem hiding this comment.
After this change, this test is identical to TestImportNameCodeFixNewImportAllowSyntheticDefaultImports3 except for the Go function name. Could we remove the unsupported AMD matrix entry instead of keeping duplicate CommonJS coverage?
| @@ -1,4 +1,4 @@ | |||
| //@module: amd | |||
| //@module: commonjs | |||
There was a problem hiding this comment.
The test still says it should emit react-router in the AMD dependency list, but its new baseline emits CommonJS require calls. This rewrite no longer exercises the stated behavior; the test should either be retired or updated to assert a genuinely relevant CommonJS behavior.
There was a problem hiding this comment.
Deleted the test as it's no longer relevant > 568f7ce
| "compilerOptions": { | ||
| "module": "amd", | ||
| "target": "ES3", | ||
| "compilerOptions": { |
There was a problem hiding this comment.
This edit changes only the touched lines from CRLF to LF, leaving this fixture with mixed line endings. The same happened in deprecatedCompilerOptions6.ts, emitHelpersWithLocalCollisions.ts, moduleImportedForTypeArgumentPosition.ts, tsconfigMapOptionsAreCaseInsensitive.ts, and varArgsOnConstructorTypes.ts. Could these edits preserve each file’s existing CRLF endings?
There was a problem hiding this comment.
oops - my find and replace has not worked as expected > 987c8e5
| @@ -0,0 +1,29 @@ | |||
| //// [tests/cases/conformance/statements/VariableStatements/usingDeclarations/usingDeclarationsTopLevelOfModule.2.ts] //// | |||
There was a problem hiding this comment.
The old usingDeclarationsTopLevelOfModule.2(module=commonjs).js baseline still exists and is byte-for-byte identical to this new unparameterized baseline. Since the module variation collapsed to one value, the old parameterized baseline should be deleted; unused-baseline tracking is currently disabled, so CI does not catch it.
There was a problem hiding this comment.
Removed here > 62c5f229a2
Fixed in Remove the last legacy outFile fixture
Fixed in 5a7da7f - it now fails on invalid 4slash configs. Thanks - updated all comments based on the feedback. |
Summary
There is currently no test coverage for some error codes (e.g. TS8013, TS8016 errors).
This is because these test cases have
@outFile/module=amdspecified in their configuration. Any test fixture with@outFile/module=amdis skipped.This PR is split into 5x logical commits:
This adds the missing baselines back into the repo allowing for these code paths to be properly tested.
This also has the advantage of removing the dead test cases that are not supported (and will not be supported), following the removal/deprecation of these options.
For context, we (oxc) use TS as baselines to ensure that we are correctly reporting errors. While trying to upgrade to the new repo structure, I've noticed that we are (incorrectly) expecting some stuff to parse when it should be failing - this PR helps to address that.