Skip to content

Commit b29c946

Browse files
committedMar 5, 2025
Use the shareable Vitest config
1 parent 202114c commit b29c946

19 files changed

+835
-1406
lines changed
 

‎examples/query/react/infinite-queries/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"start": "vite",
99
"build": "tsc && vite build",
1010
"preview": "vite preview",
11-
"test": "vitest run",
11+
"test": "vitest --config=$INIT_CWD/vitest.config.mts",
1212
"format-check": "yarn run -T format-check",
1313
"format": "yarn run -T format",
1414
"lint-fix": "yarn run -T lint-fix",
1515
"lint": "yarn run -T lint",
1616
"type-check": "tsc --noEmit"
1717
},
1818
"dependencies": {
19-
"@reduxjs/toolkit": "https://pkg.csb.dev/reduxjs/redux-toolkit/commit/2aca4f24/@reduxjs/toolkit/_pkg.tgz",
19+
"@reduxjs/toolkit": "workspace:^",
2020
"react": "^18.2.0",
2121
"react-dom": "^18.2.0",
2222
"react-intersection-observer": "^9.13.1",
@@ -28,6 +28,7 @@
2828
"@reduxjs/eslint-config": "workspace:^",
2929
"@reduxjs/prettier-config": "workspace:^",
3030
"@reduxjs/tsconfig": "workspace:^",
31+
"@reduxjs/vitest-config": "workspace:^",
3132
"@testing-library/dom": "^9.3.4",
3233
"@testing-library/jest-dom": "^6.2.0",
3334
"@testing-library/react": "^14.1.2",
@@ -42,8 +43,8 @@
4243
"msw": "^2.6.6",
4344
"prettier": "^3.5.3",
4445
"typescript": "^5.3.3",
45-
"vite": "^5.0.0",
46-
"vitest": "^1.2.0"
46+
"vite": "^6.2.0",
47+
"vitest": "^3.0.7"
4748
},
4849
"msw": {
4950
"workerDirectory": [

‎examples/query/react/infinite-queries/tsconfig.node.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"compilerOptions": {
44
"composite": true
55
},
6-
"include": ["vite.config.ts"]
6+
"include": ["vitest.config.mts"]
77
}

‎examples/query/react/infinite-queries/vite.config.ts

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { createVitestConfig } from '@reduxjs/vitest-config'
2+
import react from '@vitejs/plugin-react'
3+
4+
// https://vitejs.dev/config/
5+
const vitestConfig = createVitestConfig({
6+
plugins: [react()] as ReturnType<typeof createVitestConfig>['plugins'],
7+
server: {
8+
open: true,
9+
},
10+
test: {
11+
environment: 'jsdom',
12+
setupFiles: ['./src/setupTests.ts'],
13+
clearMocks: true,
14+
},
15+
})
16+
17+
export default vitestConfig

‎package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@
4747
"serve": "^14.2.0",
4848
"ts-node": "^10.9.2",
4949
"typescript": "^5.5.4",
50-
"typescript-eslint": "^8.26.0"
50+
"typescript-eslint": "^8.26.0",
51+
"vitest": "^3.0.7"
5152
},
5253
"scripts": {
5354
"build": "yarn build:packages",
54-
"test": "yarn test:packages",
55+
"test": "vitest --config=$INIT_CWD/vitest.config.mts",
5556
"format-check": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/prettier.config.mjs --check $INIT_CWD",
5657
"format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/prettier.config.mjs --write $INIT_CWD",
5758
"lint-fix": "eslint --config=$PROJECT_CWD/eslint.config.mts --no-error-on-unmatched-pattern --fix $INIT_CWD",

‎packages/rtk-codemods/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"format": "yarn run -T format",
77
"lint-fix": "yarn run -T lint-fix",
88
"lint": "yarn run -T lint",
9-
"test": "vitest --run",
10-
"test:watch": "vitest --watch",
11-
"test:coverage": "vitest --coverage"
9+
"test": "yarn run -T test",
10+
"test:watch": "yarn run -T test --watch",
11+
"test:coverage": "yarn run -T test --coverage"
1212
},
1313
"bin": "./bin/cli.mjs",
1414
"files": [
@@ -36,11 +36,12 @@
3636
"@reduxjs/prettier-config": "workspace:^",
3737
"@reduxjs/toolkit": "workspace:^",
3838
"@reduxjs/tsconfig": "workspace:^",
39+
"@reduxjs/vitest-config": "workspace:^",
3940
"@types/jscodeshift": "^0.11.11",
4041
"eslint": "^9.21.0",
4142
"jiti": "^2.4.2",
4243
"prettier": "^3.5.3",
43-
"vitest": "^1.6.0"
44+
"vitest": "^3.0.7"
4445
},
4546
"engines": {
4647
"node": ">= 16"
+8-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import { defineConfig } from 'vitest/config'
1+
import { createVitestConfig } from '@reduxjs/vitest-config'
2+
import * as path from 'node:path'
23

3-
export default defineConfig({
4+
const vitestConfig = createVitestConfig({
45
test: {
5-
globals: true
6-
}
6+
dir: path.join(import.meta.dirname, 'transforms'),
7+
root: import.meta.dirname,
8+
},
79
})
10+
11+
export default vitestConfig

‎packages/rtk-query-codegen-openapi/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"prepack": "yarn build && chmod +x lib/bin/cli.mjs",
3838
"format-check": "yarn run -T format-check",
3939
"format": "yarn run -T format",
40-
"test:update": "vitest --run --update",
40+
"test:update": "yarn run -T test --update",
4141
"test:update:enum": "lib/bin/cli.mjs test/config.example.enum.ts",
42-
"test": "vitest --run --typecheck",
43-
"test:watch": "vitest --watch",
42+
"test": "yarn run -T test",
43+
"test:watch": "yarn run -T test --watch",
4444
"cli": "esr src/bin/cli.ts"
4545
},
4646
"files": [
@@ -55,6 +55,7 @@
5555
"@reduxjs/prettier-config": "workspace:^",
5656
"@reduxjs/toolkit": "^1.6.0",
5757
"@reduxjs/tsconfig": "workspace:^",
58+
"@reduxjs/vitest-config": "workspace:^",
5859
"@types/commander": "^2.12.2",
5960
"@types/glob-to-regexp": "^0.4.0",
6061
"@types/lodash.camelcase": "^4.3.9",
@@ -72,8 +73,7 @@
7273
"rimraf": "^5.0.5",
7374
"ts-node": "^10.9.2",
7475
"tsup": "^8.2.4",
75-
"vite-tsconfig-paths": "^5.0.1",
76-
"vitest": "^2.0.5",
76+
"vitest": "^3.0.7",
7777
"yalc": "^1.0.0-pre.47"
7878
},
7979
"dependencies": {

0 commit comments

Comments
 (0)
Failed to load comments.