Skip to content

chore: remove outFile,module:amd config from test cases - #64122

Open
Cameron (camc314) wants to merge 15 commits into
microsoft:mainfrom
camc314:c/test-cov-8013-8016
Open

chore: remove outFile,module:amd config from test cases#64122
Cameron (camc314) wants to merge 15 commits into
microsoft:mainfrom
camc314:c/test-cov-8013-8016

Conversation

@camc314

@camc314 Cameron (camc314) commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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=amd specified in their configuration. Any test fixture with @outFile/module=amd is skipped.

This PR is split into 5x logical commits:

  1. remove outFile-specific test cases
  2. remove incidental outFile test options
  3. remove AMD specific test cases
  4. remove incidental AMD test options
  5. remove the test harness logic to skip these test cases.

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.

@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 1, 2026
@camc314
Cameron (camc314) marked this pull request as ready for review September 1, 2026 16:15
Copilot AI balanced review requested due to automatic review settings September 1, 2026 16:15
@typescript-automation

Copy link
Copy Markdown

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@camc314
Cameron (camc314) marked this pull request as draft September 1, 2026 16:19
@camc314

Cameron (camc314) commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Hmm actually this makes sense to just remove outFile from all fixtures so that they can start to be tested - i'll update this PR.

@camc314 Cameron (camc314) changed the title chore: re-enable test coverage for TS8013, TS8016 chore: remove outFile config from most test cases Sep 1, 2026
@camc314
Cameron (camc314) marked this pull request as ready for review September 1, 2026 16:27
@camc314
Cameron (camc314) marked this pull request as draft September 1, 2026 16:34
@camc314 Cameron (camc314) changed the title chore: remove outFile config from most test cases chore: remove outFile,module:amd config from test cases Sep 1, 2026
@camc314
Cameron (camc314) marked this pull request as ready for review September 1, 2026 16:50
func SkipUnsupportedCompilerOptions(t *testing.T, options *core.CompilerOptions) {
t.Helper()
switch options.Module {
case core.ModuleKindAMD, core.ModuleKindUMD, core.ModuleKindSystem:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of surprised this matters for you at all? These are our internal tests, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just filter out cases that are skipped here, but then we risk not testing everything and possibly introducing regressions.

@camc314
Cameron (camc314) marked this pull request as draft September 1, 2026 17:40
@camc314
Cameron (camc314) marked this pull request as ready for review September 1, 2026 19:21

@jakebailey Jake Bailey (jakebailey) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts is the sole remaining legacy @out fixture and is still permanently listed in skippedTests; it seems like it should be removed with the other outFile-only cases.
  • SkipUnsupportedCompilerOptions only sees fourslash global directives. An embedded tsconfig.json containing module: "amd" or outFile still 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"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored > 0164435

// @Filename: file2.ts
/// <reference path="file0.ts" />
/// <reference path="file1.ts" />
/// <amd-dependency path="/js/libs/hgn.js!app/templates/home" name="compiler"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored > 0164435

@@ -1,5 +1,5 @@
// @target: es2015
// @module: amd
// @module: commonjs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here > 3b74e9d

@@ -1,6 +1,6 @@
// @target: es2015
// @strict: false
//@module: amd
//@module: commonjs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3b74e9d

@@ -1,5 +1,5 @@
// @target: es6
// @module: amd
// @module: commonjs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in bbb8283460

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @AllowSyntheticDefaultImports: false
// @Module: amd
// @Module: commonjs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep fixed here > 1a68930

@@ -1,4 +1,4 @@
//@module: amd
//@module: commonjs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted the test as it's no longer relevant > 568f7ce

"compilerOptions": {
"module": "amd",
"target": "ES3",
"compilerOptions": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@camc314 Cameron (camc314) Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops - my find and replace has not worked as expected > 987c8e5

@@ -0,0 +1,29 @@
//// [tests/cases/conformance/statements/VariableStatements/usingDeclarations/usingDeclarationsTopLevelOfModule.2.ts] ////

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed here > 62c5f229a2

@camc314

Copy link
Copy Markdown
Contributor Author
  • tsc/testdata/tests/cases/compiler/isolatedModulesOut.ts is the sole remaining legacy @out fixture and is still permanently listed in skippedTests; it seems like it should be removed with the other outFile-only cases.

Fixed in Remove the last legacy outFile fixture

  • SkipUnsupportedCompilerOptions only sees fourslash global directives. An embedded tsconfig.json containing module: "amd" or outFile still 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.

Fixed in 5a7da7f - it now fails on invalid 4slash configs.

Thanks - updated all comments based on the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants