Skip to content

Commit

Permalink
chore: replace jest with vitest (#11270)
Browse files Browse the repository at this point in the history
**Related Issue:** N/A

## Summary

Unifies testing by leveraging existing `vitest` setup.

### Notes

- test workflows are mostly unchanged (key change involves imports – see
https://vitest.dev/api/)
- `jest-axe` is still used as it works with our current Puppeteer setup
- [`vitest-axe`](https://github.com/chaance/vitest-axe#readme) is still
in prerelease and has a known issue when integrated with `happy-dom`
- updates ESLint, Renovate configs, VS Code launch action and _some_ doc
- Preact example [still uses
jest](https://github.com/Esri/calcite-design-system/blob/dev/examples/components/preact/package.json#L16)
– we can tackle this in a follow-up
- Moves `vitest` dep to monorepo root (might need to keep under
`calcite-components` to ensure Lumina doesn't remove matching
triple-slash directives
- Removes obsolete `commonTests`-scoped ESLint config

---------

Co-authored-by: Ben Elan <[email protected]>
  • Loading branch information
jcfranco and benelan authored Jan 13, 2025
1 parent 03a0aad commit 539fb2b
Show file tree
Hide file tree
Showing 28 changed files with 315 additions and 3,412 deletions.
4 changes: 0 additions & 4 deletions .renovaterc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@
"schedule": ["before 5am every weekday"],
"labels": ["dependencies"],
"ignoreDeps": [
"@types/jest",
"@types/node",
"@types/react",
"@types/react-dom",
"jest",
"jest-cli",
"node",
"npm",
"puppeteer",
"react",
"react-dom",
"ts-jest",
"typescript"
],
"ignorePaths": ["packages/calcite-ui-icons/**", "examples/**"],
Expand Down
5 changes: 1 addition & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@
"name": "Design Tokens Spec Test {currentFile}",
"cwd": "${workspaceFolder}/packages/calcite-design-tokens",
"sourceMaps": true,
"runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/jest/bin/jest.js", "--runInBand", "${file}"],
"env": {
"NODE_OPTIONS": "--experimental-vm-modules"
},
"runtimeArgs": ["--inspect-brk", "${workspaceRoot}/node_modules/vitest/vitest.mjs", "${file}"],
"skipFiles": ["<node_internals>/**"],
"internalConsoleOptions": "neverOpen",
"console": "integratedTerminal"
Expand Down
Loading

0 comments on commit 539fb2b

Please sign in to comment.