Skip to content

Commit 62b402f

Browse files
prc5claude
andcommitted
chore: bump vitest to 5.0.0
Vitest, @vitest/ui and @vitest/coverage-v8 move to 5.0.0 in the root and the mobile app. vitest-native already supports 5, so it stays at 0.9. Vitest 5 dropped the bridge from its Assertion type into the global jest.Matchers namespace. Both matcher libraries we use type themselves there, so without the bridge every custom matcher fails typecheck while passing at runtime: - jest-dom: the tsconfig.spec.json `types` entries switch from "@testing-library/jest-dom" (jest globals) to "@testing-library/jest-dom/vitest", which augments vitest directly. - React Native Testing Library ships no vitest entry, so apps/mobile/vitest-env.d.ts re-attaches jest.Matchers to vitest's Assertion. The dead vitest.workspace.ts (dropped by vitest 4) becomes a root vitest.config.ts with a projects list, excluding the backend vite configs that would otherwise duplicate the vitest ones. .vitest/ is ignored. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent c3335ab commit 62b402f

12 files changed

Lines changed: 272 additions & 191 deletions

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ test-output
5757
apps/*/src/db/postgres/generated/
5858

5959
# Workflow run artifacts (generated files)
60-
workflow-runs/
60+
workflow-runs/
61+
# vitest 5 default artifact directory (attachments, blob/json/junit output)
62+
.vitest/

‎apps/admin/tsconfig.spec.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
"compilerOptions": {
44
"outDir": "./out-tsc/vitest",
55
"rootDir": "../..",
6-
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest", "@testing-library/jest-dom"],
6+
"types": [
7+
"vitest/globals",
8+
"vitest/importMeta",
9+
"vite/client",
10+
"node",
11+
"vitest",
12+
"@testing-library/jest-dom/vitest"
13+
],
714
"jsx": "react-jsx",
815
"strict": true,
916
"composite": false,

‎apps/extension/tsconfig.spec.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
"compilerOptions": {
44
"outDir": "./out-tsc/vitest",
55
"rootDir": "../..",
6-
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest", "@testing-library/jest-dom"],
6+
"types": [
7+
"vitest/globals",
8+
"vitest/importMeta",
9+
"vite/client",
10+
"node",
11+
"vitest",
12+
"@testing-library/jest-dom/vitest"
13+
],
714
"jsx": "react-jsx",
815
"strict": true,
916
"composite": false,

‎apps/frontend/tsconfig.spec.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
"compilerOptions": {
44
"outDir": "./out-tsc/vitest",
55
"rootDir": "../..",
6-
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest", "@testing-library/jest-dom"],
6+
"types": [
7+
"vitest/globals",
8+
"vitest/importMeta",
9+
"vite/client",
10+
"node",
11+
"vitest",
12+
"@testing-library/jest-dom/vitest"
13+
],
714
"jsx": "react-jsx",
815
"strict": true,
916
"composite": false,

‎apps/mobile/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"@types/react": "19.2.14",
8585
"react-test-renderer": "19.2.3",
8686
"vite": "8.0.10",
87-
"vitest": "^4.1.5",
87+
"vitest": "^5.0.0",
8888
"vitest-native": "^0.9.0"
8989
},
9090
"nx": {

‎apps/mobile/tsconfig.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"@prisma/client": ["../backend/src/db/postgres/generated/client"]
1717
}
1818
},
19-
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts", "nativewind-env.d.ts"],
19+
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts", "nativewind-env.d.ts", "vitest-env.d.ts"],
2020
"exclude": ["node_modules", ".expo", "dist"]
2121
}

‎apps/mobile/vitest-env.d.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* React Native Testing Library types its matchers (toHaveTextContent, toBeOnTheScreen, ...) onto
3+
* the global `jest.Matchers` namespace. Vitest 4 extended its own `Assertion` from that namespace,
4+
* so the matchers were typed for free. Vitest 5 dropped that bridge, and without it every
5+
* `expect(el).toHaveTextContent(...)` fails typecheck even though it passes at runtime.
6+
*
7+
* The import loads RNTL's global declaration; the augmentation re-attaches it to vitest.
8+
*/
9+
// oxlint-disable-next-line no-unassigned-import -- loads RNTL's global jest.Matchers declaration
10+
import "@testing-library/react-native";
11+
12+
declare module "vitest" {
13+
interface Assertion<R, T> extends jest.Matchers<R, T> {}
14+
}

‎package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
"@testing-library/user-event": "^14.6.1",
5252
"@types/node": "^25.6.0",
5353
"@typescript/native": "npm:typescript@^7.0.2",
54-
"@vitest/coverage-v8": "4.1.5",
55-
"@vitest/ui": "4.1.5",
54+
"@vitest/coverage-v8": "5.0.0",
55+
"@vitest/ui": "5.0.0",
5656
"nx": "23.1.2",
5757
"oxfmt": "^0.46.0",
5858
"oxlint": "^1.61.0",
5959
"typescript": "npm:@typescript/typescript6@^6.0.2",
6060
"vite": "8.0.10",
61-
"vitest": "^4.1.5"
61+
"vitest": "^5.0.0"
6262
},
6363
"workspaces": [
6464
"apps/*",

‎pnpm-lock.yaml‎

Lines changed: 204 additions & 181 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,12 @@ allowBuilds:
3939
nx: false
4040
prisma: false
4141
unrs-resolver: false
42+
43+
minimumReleaseAgeExclude:
44+
- "@vitest/coverage-v8@5.0.0"
45+
- "@vitest/mocker@5.0.0"
46+
- "@vitest/pretty-format@5.0.0"
47+
- "@vitest/spy@5.0.0"
48+
- "@vitest/ui@5.0.0"
49+
- "@vitest/utils@5.0.0"
50+
- vitest@5.0.0

0 commit comments

Comments
 (0)