Skip to content

Commit bdf695d

Browse files
committed
feat(tests): add watch mode for Vitest and enhance test configurations
This update introduces a new `test:watch` command in the root and individual package configurations, allowing for easier test development. Additionally, the Vitest configuration file is added to support running tests across multiple projects in the monorepo. The test commands in the `todo-app`, `ui`, and `utils` packages are updated to use `vitest run` with options for handling empty test suites.
1 parent eb25867 commit bdf695d

File tree

6 files changed

+28
-5
lines changed

6 files changed

+28
-5
lines changed

apps/todo-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"typecheck": "tsc --noEmit",
1818
"lint": "biome lint .",
1919
"format": "biome format --write .",
20-
"test": "vitest",
20+
"test": "vitest run",
21+
"test:watch": "vitest",
2122
"test:ui": "vitest --ui",
2223
"test:run": "vitest run",
2324
"test:ci": "vitest run"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"typecheck": "bun run turbo run typecheck",
1313
"biome-fix": "bun run biome check --fix",
1414
"test": "bun run turbo run test",
15+
"test:watch": "bun run turbo run test:watch",
1516
"test:ci": "bun run turbo run test:ci"
1617
},
1718
"dependencies": {

packages/ui/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"lint": "biome lint .",
1717
"format": "biome format --write .",
1818
"typecheck": "tsc --noEmit",
19-
"test": "vitest",
19+
"test": "vitest run --passWithNoTests",
20+
"test:watch": "vitest",
2021
"test:ci": "vitest run --passWithNoTests"
2122
},
2223
"devDependencies": {

packages/utils/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"lint": "biome lint .",
1717
"format": "biome format --write .",
1818
"typecheck": "tsc --noEmit",
19-
"test": "vitest",
19+
"test": "vitest run --passWithNoTests",
20+
"test:watch": "vitest",
2021
"test:ci": "vitest run --passWithNoTests"
2122
},
2223
"devDependencies": {

turbo.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@
2929
},
3030
"test": {
3131
"dependsOn": ["^build"],
32-
"inputs": ["$TURBO_DEFAULT$", ".env*"],
32+
"inputs": ["$TURBO_DEFAULT$", ".env*", "vitest.config.*"],
3333
"outputs": []
3434
},
35+
"test:watch": {
36+
"dependsOn": ["^build"],
37+
"inputs": ["$TURBO_DEFAULT$", ".env*", "vitest.config.*"],
38+
"outputs": [],
39+
"cache": false,
40+
"persistent": true
41+
},
3542
"test:ci": {
36-
"inputs": ["$TURBO_DEFAULT$", ".env*"],
43+
"inputs": ["$TURBO_DEFAULT$", ".env*", "vitest.config.*"],
3744
"outputs": []
3845
}
3946
}

vitest.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
// Root Vitest configuration for monorepo
4+
// This enables running tests from the root with proper workspace support
5+
export default defineConfig({
6+
test: {
7+
projects: [
8+
'apps/*/vitest.config.{ts,js}',
9+
'packages/*/vitest.config.{ts,js}',
10+
],
11+
},
12+
});

0 commit comments

Comments
 (0)