Files
zeekay 2e333bdcbe fix(webui): pin vitest to 3.x to match vite 5; set window.APIUrl in tests
Two compounding issues blocked the upstream image build:

1. An incomplete dep bump moved `vitest: ^3.2.4` → `^4.0.3` and added
   `@vitest/web-worker: ^4.0.2`, but left `vite: ^5.4.19` and
   `@vitest/coverage-v8: ^3.2.4`. Vitest 4 needs Vite 6+, so vitest's
   internal `vite/module-runner` import threw ERR_PACKAGE_PATH_NOT_EXPORTED
   on every test run. Pin vitest + @vitest/web-worker back to ^3.2.4 to
   match the rest of the trio. (Forward-port to vitest 4 is an explicit
   step that should also bump vite to ^6 and coverage-v8 to ^4.)

2. The webui test suite has rebrand-era request mocks at /v1/ingress/*
   but `BASE_PATH` (src/libs/utils.ts) reads `window.APIUrl` at
   module-load and falls back to ''. With BASE_PATH='', SWR fetched
   /http/routers/<x> and missed every msw handler — 4 tests timed out
   on `waitFor(...not.toBeUndefined)`. Set `window.APIUrl=/v1/ingress`
   at the top of test/setup.ts (before the mock server import) to
   match production.

Result: 28 test files, 125/125 pass. The Build experimental image
workflow can now produce ghcr.io/hanzoai/ingress:<branch>; the v1.7.x
branch and v1.7.37 tag both unblock.
2026-05-06 15:50:45 -07:00

108 lines
2.9 KiB
JSON

{
"name": "hanzo-ingress-dashboard",
"version": "0.1.0",
"private": true,
"homepage": ".",
"scripts": {
"build": "vite build",
"build:prod": "pnpm test && pnpm tsc && pnpm lint && pnpm build",
"dev": "vite",
"format": "prettier './src/**/*.{ts,tsx}' --config .prettierrc.json --write",
"lint": "eslint './src/**/*.{ts,tsx}'",
"lint:fix": "eslint --fix './src/**/*.{ts,tsx}'",
"preview": "vite preview",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"test:unit:ci": "vitest run"
},
"lint-staged": {
"**/*.{ts,tsx}": [
"pnpm format",
"eslint --fix",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"type": "module",
"dependencies": {
"@emotion/is-prop-valid": "^1.4.0",
"@eslint/js": "^9.32.0",
"@noble/ed25519": "^3.0.0",
"@noble/hashes": "^2.0.1",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@traefiklabs/faency": "12.0.4",
"@types/lodash": "^4.17.16",
"@types/node": "^22.15.18",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.19",
"@types/react-router-dom": "^5.1.3",
"@typescript-eslint/parser": "^8.38.0",
"@vitejs/plugin-react": "^4.7.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/web-worker": "^3.2.4",
"chart.js": "^4.4.1",
"eslint": "^9.32.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"framer-motion": "^11.18.2",
"globals": "^16.0.0",
"jest-extended": "^4.0.2",
"jsdom": "^24.0.0",
"lodash": "^4.17.21",
"msw": "^2.1.7",
"query-string": "^6.9.0",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"react-helmet-async": "^2.0.4",
"react-icons": "^5.0.1",
"react-infinite-scroll-hook": "^4.1.1",
"react-router": "6.22.1",
"react-router-dom": "6.22.1",
"swr": "^2.2.4",
"typescript": "^5.2.2",
"typescript-eslint": "^8.38.0",
"usehooks-ts": "^2.14.0",
"vite": "^5.4.19",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4",
"vitest-canvas-mock": "^0.3.3"
},
"devDependencies": {
"husky": "^3.1.0",
"lint-staged": "^9.5.0",
"prettier": "^3.5.3"
},
"msw": {
"workerDirectory": [
"public"
]
},
"packageManager": "[email protected]"
}