chore: configure vitest with project-based setup and coverage
This commit is contained in:
parent
ce42eb1811
commit
04acd4b580
13 changed files with 1193 additions and 12 deletions
|
|
@ -2,8 +2,12 @@
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../../packages/shared" },
|
{ "path": "../../packages/shared" },
|
||||||
{ "path": "../../packages/db" }
|
{ "path": "../../packages/db" },
|
||||||
],
|
],
|
||||||
"compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext" },
|
"compilerOptions": {
|
||||||
"include": ["src"]
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"types": ["vitest/globals"],
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
apps/api/vitest.config.ts
Normal file
3
apps/api/vitest.config.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
export default defineConfig({ test: { environment: "node", globals: true } });
|
||||||
|
|
@ -5,5 +5,8 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@glossa/shared": "workspace:*"
|
"@glossa/shared": "workspace:*"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jsdom": "^29.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"references": [{ "path": "../../packages/shared" }]
|
"references": [{ "path": "../../packages/shared" }],
|
||||||
|
"compilerOptions": { "module": "ESNext", "moduleResolution": "bundler" },
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
apps/web/vitest.config.ts
Normal file
3
apps/web/vitest.config.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
export default defineConfig({ test: { environment: "jsdom", globals: true } });
|
||||||
|
|
@ -11,8 +11,8 @@ Each phase produces a working, deployable increment. Nothing is built speculativ
|
||||||
|
|
||||||
- [x] Initialise pnpm workspace monorepo: `apps/web`, `apps/api`, `packages/shared`, `packages/db`
|
- [x] Initialise pnpm workspace monorepo: `apps/web`, `apps/api`, `packages/shared`, `packages/db`
|
||||||
- [x] Configure TypeScript project references across packages
|
- [x] Configure TypeScript project references across packages
|
||||||
- [ ] Set up ESLint + Prettier with shared configs in root
|
- [x] Set up ESLint + Prettier with shared configs in root
|
||||||
- [ ] Set up Vitest in `api` and `web`
|
- [x] Set up Vitest in `api` and `web` and both packages
|
||||||
- [ ] Scaffold Express app with `GET /api/health`
|
- [ ] Scaffold Express app with `GET /api/health`
|
||||||
- [ ] Scaffold Vite + React app with TanStack Router (single root route)
|
- [ ] Scaffold Vite + React app with TanStack Router (single root route)
|
||||||
- [ ] Configure Drizzle ORM + connection to local PostgreSQL
|
- [ ] Configure Drizzle ORM + connection to local PostgreSQL
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "concurrently \"pnpm --filter @glossa/web run dev\" \"pnpm --filter @glossa/api run dev\"",
|
"dev": "concurrently \"pnpm --filter @glossa/web run dev\" \"pnpm --filter @glossa/api run dev\"",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "vitest",
|
||||||
|
"test:run": "vitest run",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"format:check": "prettier --check ."
|
"format:check": "prettier --check ."
|
||||||
|
|
@ -13,11 +14,13 @@
|
||||||
"packageManager": "pnpm@10.32.1",
|
"packageManager": "pnpm@10.32.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
|
"@vitest/coverage-v8": "^4.1.0",
|
||||||
"concurrently": "^9.2.1",
|
"concurrently": "^9.2.1",
|
||||||
"eslint": "^10.0.3",
|
"eslint": "^10.0.3",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.1",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"typescript-eslint": "^8.57.1"
|
"typescript-eslint": "^8.57.1",
|
||||||
|
"vitest": "^4.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"outDir": "./dist"
|
"outDir": "./dist",
|
||||||
|
"types": ["vitest/globals"],
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
packages/db/vitest.config.ts
Normal file
3
packages/db/vitest.config.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
export default defineConfig({ test: { environment: "node", globals: true } });
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"outDir": "./dist"
|
"outDir": "./dist",
|
||||||
|
"types": ["vitest/globals"],
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
packages/shared/vitest.config.ts
Normal file
3
packages/shared/vitest.config.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
export default defineConfig({ test: { environment: "node", globals: true } });
|
||||||
1143
pnpm-lock.yaml
generated
1143
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
13
vitest.config.ts
Normal file
13
vitest.config.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
projects: ["packages/*", "apps/*"],
|
||||||
|
coverage: {
|
||||||
|
provider: "v8",
|
||||||
|
reporter: ["text", "json", "html"],
|
||||||
|
exclude: ["node_modules/", "dist/"],
|
||||||
|
},
|
||||||
|
passWithNoTests: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue