ci(test): migrate from jest to vitest - #13989
Conversation
shreemaan-abhishek
left a comment
There was a problem hiding this comment.
lago tests are still being skipped pls fix this first.
Line 20 in 271e799
|
The issues with the lago tests will not be fixed in this PR. The timeout duration for Node.js child processes is unpredictable, but This PR is merely the first part of a broader refactoring, serving as the starting point for splitting the TypeScript-based tests from test::nginx. Currently, the tests rely on |
Description
Migrate the TypeScript test suite under
t/from Jest (with ts-jest) to Vitest. The.spec.mtssuffix only existed to satisfy ts-jest's ESM mode, so the specs are now plain.tsfiles, which are ESM by default becauset/package.jsonalready sets"type": "module".Changes:
jest,ts-jest,@jest/globals,@types/jestandts-node(it was only used to loadjest.config.ts), and addvitest. Thetestscript becomesvitest run --reporter=verbose, soNODE_OPTIONS=--experimental-vm-modulesis no longer needed.jest.config.tsis replaced byvitest.config.tswithglobals: trueandinclude: ['**/*.{spec,test}.ts'].tsconfig.jsonusestypes: ["node", "vitest/globals"](the setup documented by Vitest) andmoduleResolution: "bundler", sodescribe,it,expect,viand friends are available without imports.@jest/globalsimports, replacejest.setTimeout(15000)withvi.setConfig({ testTimeout: 15000 }), and rename*.spec.mtsto*.spec.ts.plugin/grpc-web/client.ctsis not a Vitest spec (it is run bytsxfromgrpc-web.t), so it is left as is..tfiles: the Test::Nginx cases used to assert Jest's output (PASS <file>andTests: N passed, N total), which Vitest does not print. They now match Vitest's summary (Test Files 1 passed (1)andTests N passed (N)) and run with--no-color, because ANSI colors leak into the captured output underproveand break the regexes.*.mtsentry from the codespell skip list inlint.yml.Notes for reviewers:
tsc --noEmit -p tstill reports no errors in the project files.metadata.t,standalone.tandwebsocket-proxy.tagainst a local etcd, all pass.Which issue(s) this PR fixes:
#13939 (comment)
Checklist