Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from jest to vitest #5022

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
83c0ba1
install and create basic vitest configs
with-heart Jul 23, 2024
0168bb9
replace jest.* with vi.* in tests
with-heart Jul 31, 2024
db0ea01
replace done callback with promise resolve in tests
with-heart Jul 31, 2024
b5c7133
use fake timers to avoid errors being thrown in separate microtask
with-heart Aug 2, 2024
eaab3c8
install happy-dom
with-heart Aug 3, 2024
dba23f7
fix @xstate/svelte tests
with-heart Aug 3, 2024
19731a2
fix @xstate/vue tests
with-heart Aug 3, 2024
95d1431
fix @xstate/solid tests
with-heart Aug 4, 2024
bfaac7f
update inline error snapshots
with-heart Aug 4, 2024
b5c436e
fix @xstate/graph test error and update snapshots
with-heart Aug 4, 2024
7bb1aa3
replace jest.Mock with vitest Mock import
with-heart Aug 4, 2024
bd2dee1
replace done.fail with promise reject
with-heart Aug 4, 2024
642220b
use happy-dom for @xstate/inspect tests
with-heart Aug 4, 2024
3abcb53
add vue plugin for @xstate/store tests
with-heart Aug 4, 2024
f70e0f2
use happy-dom for @xstate/store tests
with-heart Aug 4, 2024
a1b5af1
use setTimeout from node:timers/promises as sleep
with-heart Aug 4, 2024
20d5405
fix @xstate/react console.error spy tests
with-heart Aug 6, 2024
2c306ac
fix xstate interpreter console.error test spy
with-heart Aug 6, 2024
0b26c76
remove toMatchMockCallsInlineSnapshot
with-heart Aug 6, 2024
e16b4b8
remove jest config/dependencies/scripts
with-heart Aug 6, 2024
eb26093
add missing @xstate/store devDependencies
with-heart Aug 6, 2024
6257da6
use happy-dom for @xstate/react tests
with-heart Aug 6, 2024
8d18fe1
fix core errors tests
with-heart Aug 6, 2024
f0f6461
use --project flag with vitest for test:core script
with-heart Aug 6, 2024
a6d5c27
fix core scxml tests
with-heart Aug 6, 2024
550c2f5
enable vitest/globals types in @xstate/svelte tests
with-heart Aug 7, 2024
14b253a
disable verbatimModuleSyntax for @xstate/svelte tests
with-heart Aug 7, 2024
9be362a
fix @xstate/svelte test type error
with-heart Aug 7, 2024
cb7b8b5
replace jest with vitest in .vscode/launch.json
with-heart Aug 7, 2024
2807c45
Merge branch 'main' into vitest
with-heart Aug 9, 2024
8cf9741
Merge remote-tracking branch 'upstream/main' into vitest
with-heart Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .knip.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
],
"ignoreBinaries": ["svelte-check", "docs:build"],
"ignoreDependencies": [
"@xstate-repo/jest-utils",
"@xstate-repo/jest-utils/setup",
"synckit",
// package.json#exports aren't added as entry points, because `dist/` is .gitignored
"react",
Expand Down
32 changes: 12 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,24 @@
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${file}", "--config", "jest.config.js", "--no-cache"],
"name": "Vitest Current Test File",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest Current File (no timeout)",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${file}",
"--config",
"jest.config.js",
"--no-cache",
"--testTimeout=2147483647"
],
"name": "Vitest Current Test File (no timeout)",
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["run", "${relativeFile}", "--testTimeout=2147483647"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
"internalConsoleOptions": "neverOpen"
}
]
}
33 changes: 0 additions & 33 deletions jest.config.js

This file was deleted.

20 changes: 4 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"build": "preconstruct build",
"fix": "manypkg fix",
"typecheck": "tsc",
"test": "jest",
"test:core": "jest packages/core",
"test": "vitest",
"test:core": "vitest --project xstate",
"changeset": "changeset",
"release": "changeset publish",
"version": "changeset version && node ./scripts/bump-peer-dep-ranges.js"
Expand All @@ -52,33 +52,21 @@
"@babel/preset-typescript": "^7.23.3",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@jest/types": "^29.6.3",
"@manypkg/cli": "^0.16.1",
"@manypkg/get-packages": "^1.1.3",
"@preconstruct/cli": "^2.8.1",
"@testing-library/vue": "^6.6.1",
"@types/jest": "^29.5.10",
"@types/node": "^20.14.13",
"@vue/compiler-sfc": "^3.0.11",
"@vue/vue3-jest": "^29.2.6",
"babel-jest": "^29.7.0",
"babel-preset-solid": "^1.8.4",
"happy-dom": "^14.12.3",
"husky": "^3.1.0",
"jest": "^29.7.0",
"jest-config": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-resolve": "^29.7.0",
"jest-snapshot": "^29.7.0",
"jest-watch-typeahead": "^2.2.2",
"knip": "^5.27.0",
"lint-staged": "^8.2.1",
"patch-package": "^6.5.1",
"prettier": "^3.1.0",
"prettier-plugin-jsdoc": "^1.3.0",
"svelte-jester": "^2.3.2",
"synckit": "^0.8.5",
"typescript": "^5.5.4",
"vue": "^3.0.11"
"vitest": "^2.0.3"
},
"husky": {
"hooks": {
Expand Down
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
"homepage": "https://github.com/statelyai/xstate/tree/main/packages/core#readme",
"devDependencies": {
"@scion-scxml/test-framework": "^2.0.15",
"@xstate-repo/jest-utils": "*",
"ajv": "^8.12.0",
"pkg-up": "^3.1.0",
"rxjs": "^7.8.0",
Expand Down
Loading