test(web): standardize frontend tests on Vitest (#6569)
* test(web): standardize frontend tests on Vitest - configure Vitest, jsdom, and React Testing Library with shared test scripts. - migrate existing node:test suites to the Vitest runner. - rewrite JsonCodeEditor component tests with RTL and remove the direct happy-dom dependency. * fix(ci): run frontend tests with Vitest - invoke the configured Vitest script so browser test setup loads in CI. - migrate remaining node:test suites to Vitest lifecycle APIs. * test(web): use shared jsdom environment for component tests - migrate usage cost and tool price tests to React Testing Library. - remove duplicate happy-dom globals and rely on the configured Vitest setup. * test(web): verify behavior with shared vitest setup - replace Node test assertions with Vitest expect across frontend suites. - migrate Keys component tests to React Testing Library interactions. - centralize jsdom browser mocks for consistent component execution. * fix(web): unblock frozen installs and Vitest CI - sync dompurify 3.4.13 metadata into the Bun lockfile. - replace the bun:test and happy-dom redemption harness with Vitest and RTL. - preserve quota conversion, error feedback, and stale-response coverage in jsdom.
Showing
| ... | @@ -11,6 +11,8 @@ | ... | @@ -11,6 +11,8 @@ |
| "lint": "oxlint -c .oxlintrc.json .", | "lint": "oxlint -c .oxlintrc.json .", | ||
| "lint:fix": "oxlint -c .oxlintrc.json . --fix", | "lint:fix": "oxlint -c .oxlintrc.json . --fix", | ||
| "preview": "rsbuild preview", | "preview": "rsbuild preview", | ||
| "test": "vitest run", | |||
| "test:watch": "vitest", | |||
| "format:check": "node scripts/format-with-protected-headers.mjs --check", | "format:check": "node scripts/format-with-protected-headers.mjs --check", | ||
| "format": "node scripts/format-with-protected-headers.mjs --write", | "format": "node scripts/format-with-protected-headers.mjs --write", | ||
| "copyright:check": "node scripts/add-copyright.mjs --check", | "copyright:check": "node scripts/add-copyright.mjs --check", | ||
| ... | @@ -85,17 +87,21 @@ | ... | @@ -85,17 +87,21 @@ |
| "@tanstack/react-query-devtools": "^5.101.2", | "@tanstack/react-query-devtools": "^5.101.2", | ||
| "@tanstack/react-router-devtools": "^1.167.0", | "@tanstack/react-router-devtools": "^1.167.0", | ||
| "@tanstack/router-plugin": "^1.168.19", | "@tanstack/router-plugin": "^1.168.19", | ||
| "@testing-library/jest-dom": "^7.0.0", | |||
| "@testing-library/react": "^16.3.2", | |||
| "@testing-library/user-event": "^14.6.1", | |||
| "@types/node": "^26.1.0", | "@types/node": "^26.1.0", | ||
| "@types/react": "^19.2.17", | "@types/react": "^19.2.17", | ||
| "@types/react-dom": "^19.2.3", | "@types/react-dom": "^19.2.3", | ||
| "@typescript/native-preview": "^7.0.0-dev.20260702.3", | "@typescript/native-preview": "^7.0.0-dev.20260702.3", | ||
| "@xyflow/react": "^12.11.1", | "@xyflow/react": "^12.11.1", | ||
| "embla-carousel-react": "^8.6.0", | "embla-carousel-react": "^8.6.0", | ||
| "happy-dom": "^20.11.1", | "jsdom": "^29.1.1", | ||
| "knip": "^6.24.0", | "knip": "^6.24.0", | ||
| "oxfmt": "^0.57.0", | "oxfmt": "^0.57.0", | ||
| "oxlint": "^1.72.0", | "oxlint": "^1.72.0", | ||
| "shadcn": "^4.12.0" | "shadcn": "^4.12.0", | ||
| "vitest": "^4.1.10" | |||
| }, | }, | ||
| "overrides": { | "overrides": { | ||
| "brace-expansion": "2.1.1", | "brace-expansion": "2.1.1", | ||
| ... | ... |
web/src/test-setup.ts
0 → 100644
web/vitest.config.ts
0 → 100644
Please
register
or
sign in
to comment