refactor: trim vitest wrapper layers

This commit is contained in:
Peter Steinberger
2026-04-03 12:50:45 +01:00
parent bd1e78ea34
commit a2077b28ef
7 changed files with 9 additions and 7 deletions

View File

@@ -56,8 +56,8 @@ Think of the suites as “increasing realism” (and increasing flakiness/cost):
- No real keys required
- Should be fast and stable
- Projects note:
- `pnpm test`, `pnpm test:projects`, and `pnpm test:watch` all use the same native Vitest `projects` config now.
- The wrapper CLI shape is preserved, so `pnpm test -- src/foo.test.ts -t bar` still works.
- `pnpm test`, `pnpm test:projects`, and `pnpm test:watch` all invoke the same native Vitest `projects` config now.
- The tiny script wrapper only strips pnpm's passthrough separator; scheduling stays native Vitest.
- Embedded runner note:
- When you change message-tool discovery inputs or compaction runtime context,
keep both levels of coverage.

View File

@@ -13,7 +13,7 @@ title: "Tests"
- `pnpm test:coverage`: Runs the unit suite with V8 coverage (via `vitest.unit.config.ts`). Global thresholds are 70% lines/branches/functions/statements. Coverage excludes integration-heavy entrypoints (CLI wiring, gateway/telegram bridges, webchat static server) to keep the target focused on unit-testable logic.
- `pnpm test:coverage:changed`: Runs unit coverage only for files changed since `origin/main`.
- `pnpm test:changed`: runs the native Vitest projects config with `--changed origin/main`. The base config treats the projects/config files as `forceRerunTriggers` so wiring changes still rerun broadly when needed.
- `pnpm test`: runs the native Vitest projects config (`unit` + `boundary`) through the lightweight wrapper in `scripts/test-projects.mjs`.
- `pnpm test`: runs the native Vitest projects config (`unit` + `boundary`) via a tiny passthrough wrapper so `pnpm test -- <filter>` keeps working.
- Unit, channel, and extension configs default to `pool: "forks"`.
- `pnpm test:channels` runs `vitest.channels.config.ts`.
- `pnpm test:extensions` runs `vitest.extensions.config.ts`.

View File

@@ -1048,7 +1048,7 @@
"test:auth:compat": "vitest run --config vitest.gateway.config.ts src/gateway/server.auth.compat-baseline.test.ts src/gateway/client.test.ts src/gateway/reconnect-gating.test.ts src/gateway/protocol/connect-error-details.test.ts",
"test:build:singleton": "node scripts/test-built-plugin-singleton.mjs",
"test:bundled": "vitest run --config vitest.bundled.config.ts",
"test:changed": "pnpm test -- --changed origin/main",
"test:changed": "node scripts/test-projects.mjs --changed origin/main",
"test:changed:max": "OPENCLAW_VITEST_MAX_WORKERS=8 node scripts/test-projects.mjs --changed origin/main",
"test:channels": "vitest run --config vitest.channels.config.ts",
"test:contracts": "pnpm test:contracts:channels && pnpm test:contracts:plugins",

View File

@@ -1,5 +1,5 @@
import { spawn } from "node:child_process";
import { buildVitestArgs } from "./test-projects-lib.mjs";
import { buildVitestArgs } from "./test-projects.test-support.mjs";
const command = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
const vitestArgs = buildVitestArgs(process.argv.slice(2));

View File

@@ -1,5 +1,8 @@
import { describe, expect, it } from "vitest";
import { buildVitestArgs, parseTestProjectsArgs } from "../../scripts/test-projects-lib.mjs";
import {
buildVitestArgs,
parseTestProjectsArgs,
} from "../../scripts/test-projects.test-support.mjs";
describe("test-projects args", () => {
it("drops a pnpm passthrough separator while preserving targeted filters", () => {

View File

@@ -79,7 +79,6 @@ export default defineConfig({
"test/setup.shared.ts",
"test/setup.extensions.ts",
"scripts/test-projects.mjs",
"scripts/test-projects-lib.mjs",
"scripts/ci-write-manifest-outputs.mjs",
"vitest.channel-paths.mjs",
"vitest.channels.config.ts",