Migrate to ESM with esbuild, vitest (#227)

* Migrate to ESM, esbuild, vitest, and update actions/* to latest

- Update @actions/core to 3.x, @actions/exec to 3.x, @actions/io to 3.x
- Replace @vercel/ncc + babel with esbuild (build.mjs) targeting Node 20 ESM
- Replace jest/babel-jest/ts-jest with vitest and @vitest/coverage-v8
- Update tsconfig to NodeNext module resolution with strict mode
- Add explicit .js extensions to all relative imports (NodeNext requirement)
- Fix implicit any index signatures in parseCluster and parseMethod
- Migrate all test files from jest to vi.mock/vi.mocked APIs
- Fix ESM module spying limitations using vi.mock() at module level
- Fix env var test pollution in default.test.ts with afterEach cleanup

* remove build.mjs and update build script

* update pkg lock

* update pkg lock
This commit is contained in:
Suneha Bose
2026-03-26 14:25:46 -07:00
committed by GitHub
parent eb220500b5
commit 1f527c033f
22 changed files with 1821 additions and 10364 deletions
+6 -3
View File
@@ -1,14 +1,17 @@
import {vi, describe, test, expect, beforeEach} from 'vitest'
import * as actions from '@actions/exec'
import {runAzCliCommand} from './azCommands'
import {runAzCliCommand} from './azCommands.js'
vi.mock('@actions/exec')
describe('Az commands', () => {
test('it runs an az cli command', async () => {
const path = 'path'
const args = ['args']
jest.spyOn(actions, 'exec').mockImplementation(async () => 0)
vi.mocked(actions.exec).mockResolvedValue(0)
expect(await runAzCliCommand(path, args))
await runAzCliCommand(path, args)
expect(actions.exec).toHaveBeenCalledWith(path, args, {})
})
})