Skip to content

Prepare tooling for repository-wide ESM - #9631

Closed
dibarbet wants to merge 2 commits into
dev/esm-extension-pilotfrom
dev/esm-tooling-foundation
Closed

Prepare tooling for repository-wide ESM#9631
dibarbet wants to merge 2 commits into
dev/esm-extension-pilotfrom
dev/esm-tooling-foundation

Conversation

@dibarbet

@dibarbet dibarbet commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the legacy ts-node task runner with the ESM-capable tsx CLI and loader paths
  • convert esbuild and Jest configuration files to explicit .mjs modules and update all references
  • automatically select ts-jest's supported ESM preset when the package becomes ESM, while preserving the current CommonJS test path
  • preserve the native dist/extension.mjs bundle and its createRequire compatibility bridge
  • replace Prepare tooling for repository-wide ESM #9615 on the dev/* branch stack so CI runs against dev/esm-extension-pilot

This layer intentionally excludes the repository-wide NodeNext source conversion and later audit cleanup.

CI fix design

  • enable allowJs in the existing tsc -p tsconfig.json compilation and list test/jestProjectNames.mjs before its colocated declaration so TypeScript emits out/test/jestProjectNames.mjs
  • retain explicit .ts include globs for src, tasks, test, typings, and __mocks__; no other JavaScript or .mjs configuration file is a compiler input
  • resolve the ts-jest tsconfig.json path relative to baseJestConfig.mjs, so integration launchers work when VS Code changes the process working directory
  • do not add a separate copy task or pull NodeNext/package-type/source-import conversion into this layer

Validation

  • clean npm run compileDev
  • compiler input audit: test/jestProjectNames.mjs is the only JavaScript input and test/jestProjectNames.d.mts remains included
  • emitted module audit: out/test/jestProjectNames.mjs exists, exports match the source, and zero out/**/jest.config.mjs files are emitted
  • npm run test:unit; post-fix npx tsx tasks/tests/testUnit.ts
  • npm run packageDev
  • raw inspection of all four emitted integration entries resolving ../../jestProjectNames.mjs
  • npx tsx tasks/tests/testIntegrationUntrusted.ts
  • npx tsx tasks/tests/testIntegrationCsharp.ts
  • OmniSharp integration not run locally because the standard component restore did not provide .omnisharp
  • git diff --check
  • replay range retained from 39d6e800f5d4b8f280962a9253f9747409a8e21e..fd7f51ce8210568a57590a93cbb9ed832af77517 onto bf96ad36dccdcb799bd838345db8c693503ba147

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: fe7d6411-cf1e-4cc8-97a8-8561d9404205
(cherry picked from commit fd7f51c)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d7d912c6-9485-44f0-a1ad-ede156ecd575
Copilot AI review requested due to automatic review settings August 4, 2026 22:35

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.

Pull request overview

This PR prepares the repo’s tooling for an eventual repository-wide ESM migration by switching task execution from ts-node to tsx, converting build/test configuration entrypoints to explicit .mjs modules, and centralizing Jest project display names for consistent selection across unit/integration test entrypoints.

Changes:

  • Replace ts-node usage in npm scripts and VS Code launch configurations with tsx (npx tsx / node --import tsx).
  • Convert Jest + esbuild configuration entrypoints to .mjs, and update callers to reference the new module paths.
  • Add a centralized test/jestProjectNames.mjs (with .d.mts) and update Jest project configs + test runners to use it.
Show a summary per file
File Description
tsconfig.json Enables allowJs and adds explicit files entries to include/emit test/jestProjectNames.mjs for tooling compatibility.
package.json Switches task scripts to npx tsx, updates packaging to use esbuild.mjs, bumps ts-jest, replaces ts-node with tsx.
package-lock.json Reflects dependency updates for ts-jest and new tsx install (and related transitive changes).
esbuild.mjs Migrates esbuild driver script to ESM imports and minor formatting cleanup.
eslint.config.mjs Updates ignore list to match esbuild.mjs rename.
.vscodeignore Updates ignored build script name to esbuild.mjs.
.vscode/launch.json Updates task debugging to run TS directly via node --import tsx instead of ts-node bin.
jest.config.mjs Updates root Jest config to reference per-project jest.config.mjs files.
baseJestConfig.ts Deletes the legacy TS base Jest config.
baseJestConfig.mjs Introduces ESM base Jest config that selects ts-jest ESM preset when appropriate and resolves tsconfig path reliably.
test/jestProjectNames.mjs Adds centralized frozen map of Jest project display names (ESM).
test/jestProjectNames.d.mts Adds type declarations for jestProjectNames for TS consumers.
test/runIntegrationTests.ts Points integration test runner at jest.config.mjs instead of jest.config.ts.
test/lsptoolshost/artifactTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/lsptoolshost/unitTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/lsptoolshost/integrationTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/lsptoolshost/integrationTests/index.ts Updates integration entrypoint to use centralized project name constant.
test/omnisharp/omnisharpUnitTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/omnisharp/omnisharpIntegrationTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/omnisharp/omnisharpIntegrationTests/index.ts Updates integration entrypoint to use centralized project name constant.
test/razor/razorTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/razor/razorIntegrationTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/razor/razorIntegrationTests/index.ts Updates integration entrypoint to use centralized project name constant.
test/untrustedWorkspace/integrationTests/jest.config.mjs Converts project config to ESM and uses centralized jestProjectNames.
test/untrustedWorkspace/integrationTests/index.ts Updates integration entrypoint to use centralized project name constant.
test/tasks/jest.config.mjs Converts tasks unit test project config to ESM and uses centralized jestProjectNames.
tasks/tests/testTasks.ts Switches task test orchestration to use centralized jestProjectNames instead of importing from per-project configs.
tasks/tests/testHelpers.ts Updates unit-test Jest runner to use jest.config.mjs.
tasks/tests/omnisharptestTasks.ts Switches OmniSharp test task to use centralized jestProjectNames.

Copilot's findings

  • Files reviewed: 27/29 changed files
  • Comments generated: 4

Comment on lines 6 to 8
import { runIntegrationTests } from '../../runIntegrationTests';
import { jestIntegrationTestProjectName } from './jest.config';
import { jestProjectNames } from '../../jestProjectNames.mjs';

Comment on lines 6 to 8
import { runIntegrationTests } from '../../runIntegrationTests';
import { jestIntegrationTestProjectName } from './jest.config';
import { jestProjectNames } from '../../jestProjectNames.mjs';

Comment on lines 6 to 8
import { runIntegrationTests } from '../../runIntegrationTests';
import { jestIntegrationTestProjectName } from './jest.config';
import { jestProjectNames } from '../../jestProjectNames.mjs';

Comment on lines 6 to 8
import { runIntegrationTests } from '../../runIntegrationTests';
import { jestIntegrationTestProjectName } from './jest.config';
import { jestProjectNames } from '../../jestProjectNames.mjs';

@dibarbet

dibarbet commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Superseded by #9635, which consolidates the complete native ESM migration into one final-state commit and removes intermediate workaround history.

@dibarbet dibarbet closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants