Skip to content

Prepare tooling for repository-wide ESM - #9615

Closed
dibarbet wants to merge 1 commit into
dibarbet-esm-extension-pilotfrom
dibarbet-esm-tooling-foundation
Closed

Prepare tooling for repository-wide ESM#9615
dibarbet wants to merge 1 commit into
dibarbet-esm-extension-pilotfrom
dibarbet-esm-tooling-foundation

Conversation

@dibarbet

@dibarbet dibarbet commented Aug 3, 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

Validation

  • npm run compileDev
  • npm run test:unit
  • npm run packageDev
  • node --import tsx tasks/tests/testUnit.ts
  • ESM ts-jest preset/config inspection with JEST_USE_ESM=true

@dibarbet
dibarbet requested a review from a team as a code owner August 3, 2026 21:26
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: fe7d6411-cf1e-4cc8-97a8-8561d9404205
Copilot AI review requested due to automatic review settings August 4, 2026 00:42
@dibarbet
dibarbet force-pushed the dibarbet-esm-tooling-foundation branch from 97cc912 to fd7f51c Compare August 4, 2026 00:42

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 vscode-csharp repository’s tooling for a future switch to repository-wide ESM by replacing the ts-node task runner with tsx, migrating build/test configs to explicit .mjs modules, and centralizing Jest project naming.

Changes:

  • Replace ts-node usage in npm scripts and VS Code launch configs with tsx (CLI + --import tsx loader).
  • Convert esbuild + Jest configuration files to .mjs, update references, and introduce an ESM-aware ts-jest preset selection mechanism.
  • Centralize Jest project displayName strings via a shared jestProjectNames module and update callers.
Show a summary per file
File Description
tsconfig.json Stops excluding removed/renamed Jest config files from compilation.
test/untrustedWorkspace/integrationTests/jest.config.mjs Migrates project Jest config to ESM + shared base config/project names.
test/untrustedWorkspace/integrationTests/index.ts Uses centralized Jest project name for selecting the Jest project.
test/tasks/jest.config.mjs Migrates tasks Jest config to ESM + shared base config/project names.
test/runIntegrationTests.ts Points integration test runner to jest.config.mjs at repo root.
test/razor/razorTests/jest.config.mjs Migrates Razor unit Jest config to ESM + centralized project names.
test/razor/razorIntegrationTests/jest.config.mjs Migrates Razor integration Jest config to ESM + centralized project names.
test/razor/razorIntegrationTests/index.ts Uses centralized Jest project name for selecting the Jest project.
test/omnisharp/omnisharpUnitTests/jest.config.mjs Migrates OmniSharp unit Jest config to ESM + centralized project names.
test/omnisharp/omnisharpIntegrationTests/jest.config.mjs Migrates OmniSharp integration Jest config to ESM + centralized project names.
test/omnisharp/omnisharpIntegrationTests/index.ts Uses centralized Jest project name for selecting the Jest project.
test/lsptoolshost/unitTests/jest.config.mjs Migrates LSP Tools Host unit Jest config to ESM + centralized project names.
test/lsptoolshost/integrationTests/jest.config.mjs Migrates LSP Tools Host integration Jest config to ESM + centralized project names.
test/lsptoolshost/integrationTests/index.ts Uses centralized Jest project name for selecting the Jest project.
test/lsptoolshost/artifactTests/jest.config.mjs Migrates artifact Jest config to ESM + centralized project names.
test/jestProjectNames.mjs Introduces centralized Jest project display names (ESM module).
test/jestProjectNames.d.mts Adds types for the centralized Jest project names module.
tasks/tests/testTasks.ts Updates task test orchestration to use centralized Jest project names.
tasks/tests/testHelpers.ts Updates Jest runner to use jest.config.mjs.
tasks/tests/omnisharptestTasks.ts Updates OmniSharp test tasks to use centralized Jest project names.
package.json Switches task runner scripts to tsx; renames esbuild.jsesbuild.mjs; bumps ts-jest; adds tsx.
package-lock.json Reflects dependency changes from ts-node to tsx and ts-jest update.
jest.config.mjs Updates root Jest config to reference .mjs project configs.
eslint.config.mjs Updates ignored build file name from esbuild.js to esbuild.mjs.
esbuild.mjs Converts the build script to ESM imports and updates formatting.
baseJestConfig.ts Removes the old TypeScript base Jest config.
baseJestConfig.mjs Adds new ESM base Jest config with conditional ESM/CJS ts-jest preset selection.
.vscodeignore Updates ignored build script name to esbuild.mjs.
.vscode/launch.json Updates task/debug launch configs to run TS scripts via node --import tsx.

Copilot's findings

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

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';

Comment thread tasks/tests/testTasks.ts
Comment on lines 6 to 9
import path from 'path';
import { integrationTestProjects, runDevKitIntegrationTests, runIntegrationTest, runJestTest } from './testHelpers';
import { jestArtifactTestsProjectName } from '../../test/lsptoolshost/artifactTests/jest.config';
import { jestUnitTestProjectName } from '../../test/lsptoolshost/unitTests/jest.config';
import { razorTestProjectName } from '../../test/razor/razorTests/jest.config';
import { jestTasksTestProjectName } from '../../test/tasks/jest.config';
import { jestProjectNames } from '../../test/jestProjectNames.mjs';

Comment on lines 6 to 10
import path from 'path';
import { codeExtensionPath, rootPath } from '../projectPaths';
import { runJestIntegrationTest, runJestTest } from './testHelpers';
import { jestOmniSharpUnitTestProjectName } from '../../test/omnisharp/omnisharpUnitTests/jest.config';
import { jestProjectNames } from '../../test/jestProjectNames.mjs';

@dibarbet

dibarbet commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Superseded by #9631 on dev/esm-tooling-foundation so the updated branch trigger runs CI. The replacement PR is part of stack #9634.

@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