Skip to content

Comments

Migrate to esbuild/Vitest and upgrade @actions/* to ESM-only versions#492

Merged
bosesuneha merged 2 commits intoAzure:mainfrom
davidgamero:migrate-esbuild-vitest
Feb 24, 2026
Merged

Migrate to esbuild/Vitest and upgrade @actions/* to ESM-only versions#492
bosesuneha merged 2 commits intoAzure:mainfrom
davidgamero:migrate-esbuild-vitest

Conversation

@davidgamero
Copy link
Collaborator

Note: big diff is mostly package-lock.json +2000/-9000 lines from reducing transitive dependencies

Upgrade @actions/core@3, @actions/exec@3, @actions/io@3, @actions/tool-cache@4 which are now ESM-only, and migrate the build toolchain accordingly.

  • Replace @vercel/ncc with esbuild (targeting node20, ESM bundle)
  • Replace Jest/ts-jest with Vitest
  • Convert all 29 test files from Jest API to Vitest API
  • Add vi.mock() for ESM modules that cannot be spied on directly
  • Update tsconfig to ES2022 module/target with bundler resolution
  • Update CI workflow to use npm run build instead of ncc

Replace the legacy ncc/Jest/Babel build stack with a modern ESM toolchain:

Build:
- Replace @vercel/ncc with esbuild (--platform=node --target=node20 --format=esm)
- Add createRequire banner for CJS interop in ESM bundle
- Add "type": "module" to package.json
- Add tsc --noEmit typecheck script (esbuild strips types without checking)
- Add typecheck to husky pre-commit hook

Dependencies:
- Bump @actions/core@3, exec@3, io@3, tool-cache@4 (ESM-only)
- Replace jest/ts-jest/@babel/* with vitest@4

Tests:
- Convert 29 test files: jest.fn()→vi.fn(), jest.mock()→vi.mock(), jest.spyOn()→vi.spyOn()
- Fix vitest 4 compat: mockImplementation requires args, mock call tracking, await .rejects

CI:
- Update build step from ncc build → npm run build
- Update composite action to use npm run build
Change module/moduleResolution from ES2022/bundler to NodeNext/NodeNext
and target from ES2022 to ES2020.

- Add .js extensions to all relative imports across 59 source/test files
  (required by NodeNext module resolution)
- Add vitest/globals to tsconfig types array for global test API declarations
@davidgamero davidgamero force-pushed the migrate-esbuild-vitest branch from cca8b01 to bea96e2 Compare February 19, 2026 03:03
@davidgamero davidgamero marked this pull request as ready for review February 24, 2026 19:21
@davidgamero davidgamero requested a review from a team as a code owner February 24, 2026 19:21
Copy link
Member

@bosesuneha bosesuneha left a comment

Choose a reason for hiding this comment

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

lgtm

@bosesuneha bosesuneha merged commit 01cfe40 into Azure:main Feb 24, 2026
13 checks passed
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.

3 participants