Skip to content

Commit 380a38c

Browse files
committed
feat: vitest
1 parent f08190f commit 380a38c

File tree

17 files changed

+1862
-2087
lines changed

17 files changed

+1862
-2087
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: pnpm lint
4343

4444
- name: Test
45-
run: pnpm test -- --ci --maxWorkers=2
45+
run: pnpm test
4646

4747
- name: Build
4848
run: pnpm build

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pnpm start
1818

1919
## Testing
2020

21-
Run Jest tests
21+
Run Vitest tests
2222

2323
```
2424
pnpm test

docs/tsdx-readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ To run tests, use `npm test` or `pnpm test`.
5252

5353
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
5454

55-
### Jest
55+
### Vitest
5656

57-
Jest tests are set up to run with `npm test` or `pnpm test`.
57+
Vitest tests are set up to run with `npm test` or `pnpm test`.
5858

5959
### Bundle analysis
6060

eslint.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default [
2424
DOMRect: 'readonly',
2525
console: 'readonly',
2626
global: 'readonly',
27-
// Jest globals
27+
// Vitest globals
2828
describe: 'readonly',
2929
it: 'readonly',
3030
test: 'readonly',
@@ -33,7 +33,7 @@ export default [
3333
afterEach: 'readonly',
3434
beforeAll: 'readonly',
3535
afterAll: 'readonly',
36-
jest: 'readonly',
36+
vi: 'readonly',
3737
// React
3838
React: 'readonly',
3939
},
@@ -50,7 +50,7 @@ export default [
5050
'@typescript-eslint/ban-ts-comment': 'warn',
5151
'no-undef': 'off', // TypeScript handles this
5252
'no-empty': 'warn',
53-
'no-redeclare': 'off', // Jest globals conflict with built-ins
53+
'no-redeclare': 'off', // Vitest globals conflict with built-ins
5454
},
5555
},
5656
{

jest-setup.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
"scripts": {
3232
"start": "tsdown --watch",
3333
"build": "tsdown",
34-
"test": "jest --passWithNoTests",
35-
"test:coverage": "jest --passWithNoTests --coverage",
34+
"test": "vitest run",
35+
"test:coverage": "vitest run --coverage",
36+
"test:ui": "vitest --ui",
3637
"prettier": "prettier ./ --write",
3738
"lint": "eslint src --ext .ts,.tsx",
3839
"prepare": "tsdown",
@@ -42,45 +43,6 @@
4243
"build-storybook": "build-storybook",
4344
"release": "np"
4445
},
45-
"jest": {
46-
"modulePaths": [
47-
"<rootDir>/src/"
48-
],
49-
"testMatch": [
50-
"**/?(*.)+(spec|test).[jt]s?(x)"
51-
],
52-
"coverageDirectory": "./coverage/",
53-
"coveragePathIgnorePatterns": [
54-
"/node_modules/",
55-
"package.json",
56-
"/stories/"
57-
],
58-
"testEnvironment": "jsdom",
59-
"testEnvironmentOptions": {
60-
"url": "http://localhost"
61-
},
62-
"setupFiles": [
63-
"<rootDir>/src/setupTests.ts"
64-
],
65-
"setupFilesAfterEnv": [
66-
"<rootDir>/jest-setup.ts"
67-
],
68-
"transform": {
69-
"^.+\\.(ts|tsx)$": "ts-jest",
70-
"^.+\\.(js|jsx)$": "babel-jest"
71-
},
72-
"moduleFileExtensions": [
73-
"ts",
74-
"tsx",
75-
"js",
76-
"jsx",
77-
"json",
78-
"node"
79-
],
80-
"transformIgnorePatterns": [
81-
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
82-
]
83-
},
8446
"peerDependencies": {
8547
"react": "^16.8.0-0 || >=17.0.1 || ^18.0.0",
8648
"react-dom": "^16.8.0-0 || >=17.0.1 || ^18.0.0"
@@ -126,18 +88,17 @@
12688
"@testing-library/jest-dom": "^5.16.1",
12789
"@testing-library/react": "^12.1.2",
12890
"@testing-library/react-hooks": "^8.0.1",
129-
"@types/jest": "^27.0.3",
13091
"@types/react": "^17.0.35",
13192
"@types/react-dom": "^17.0.11",
13293
"@typescript-eslint/eslint-plugin": "^8.44.1",
13394
"@typescript-eslint/parser": "^8.44.1",
134-
"babel-jest": "^27.5.1",
95+
"@vitest/coverage-v8": "^3.2.4",
96+
"@vitest/ui": "^3.2.4",
13597
"babel-loader": "^8.2.4",
13698
"css-loader": "^5.0.0",
13799
"eslint": "^9.36.0",
138100
"husky": "^7.0.4",
139-
"jest": "^30.1.3",
140-
"jest-environment-jsdom": "^29.7.0",
101+
"jsdom": "^27.0.0",
141102
"np": "^7.7.0",
142103
"postcss": "^8",
143104
"react": "^17.0.2",
@@ -150,9 +111,9 @@
150111
"size-limit": "^6.0.4",
151112
"style-loader": "^2.0.0",
152113
"tailwindcss": "^2.2.19",
153-
"ts-jest": "^29.4.4",
154114
"tsdown": "^0.15.4",
155115
"tslib": "^2.3.1",
156-
"typescript": "^5.9.2"
116+
"typescript": "^5.9.2",
117+
"vitest": "^3.2.4"
157118
}
158119
}

0 commit comments

Comments
 (0)