Skip to content

Commit 054adf4

Browse files
authored
feat: upgrade to Vitest 2 (#690)
* test: upgrade to vitest 2, and add browser testing * test: install playwright on matrix tests * chore: upgrade package.json * fix: use `beforeAll` instead of `beforeEach` to initiate mocks
1 parent e3f8129 commit 054adf4

File tree

11 files changed

+1134
-2091
lines changed

11 files changed

+1134
-2091
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ jobs:
1616
cache: "pnpm"
1717
- name: Install dependencies
1818
run: pnpm install
19+
- name: Install playwright
20+
run: pnpx playwright install chromium
1921
- name: Lint
2022
run: pnpm biome ci .
2123
- name: Test
22-
run: pnpm test
24+
run: pnpm vitest --coverage
2325
env:
2426
CI: true
2527
- name: Build
@@ -57,4 +59,5 @@ jobs:
5759
- name: Validate types
5860
run: |
5961
pnpm tsc
62+
pnpx playwright install chromium
6063
pnpm test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ npm-debug.log*
1616
*.log
1717
storybook-static
1818
test-utils.js
19-
test-utils.d.ts
19+
test-utils.d.ts
20+
__screenshots__

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"lint": "biome check .",
4242
"version": "pnpm build",
4343
"storybook:build": "pnpm build:bundle && pnpm --filter storybook build",
44-
"test": "vitest"
44+
"test": "vitest",
45+
"test:browser": "vitest --workspace=vitest.workspace.ts"
4546
},
4647
"keywords": [
4748
"react",
@@ -107,20 +108,23 @@
107108
"@size-limit/preset-small-lib": "^11.1.4",
108109
"@testing-library/jest-dom": "^6.4.6",
109110
"@testing-library/react": "^16.0.0",
110-
"@types/jest": "^29.5.12",
111111
"@types/react": "^18.3.3",
112112
"@types/react-dom": "^18.3.0",
113+
"@vitejs/plugin-react": "^4.3.1",
114+
"@vitest/browser": "^2.0.1",
115+
"@vitest/coverage-istanbul": "^2.0.1",
113116
"jsdom": "^24.1.0",
114117
"lint-staged": "^15.2.7",
115118
"microbundle": "^0.15.1",
116119
"npm-run-all": "^4.1.5",
120+
"playwright": "^1.45.1",
117121
"react": "^18.3.1",
118122
"react-dom": "^18.3.1",
119123
"simple-git-hooks": "^2.11.1",
120124
"size-limit": "^11.1.4",
121125
"tsup": "^8.1.0",
122126
"typescript": "^5.5.3",
123-
"vitest": "^1.6.0"
127+
"vitest": "^2.0.1"
124128
},
125129
"peerDependenciesMeta": {
126130
"react-dom": {

0 commit comments

Comments
 (0)