diff --git a/docs/help/testing.md b/docs/help/testing.md index f1d926fe37c3..4c41691e5868 100644 --- a/docs/help/testing.md +++ b/docs/help/testing.md @@ -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. diff --git a/docs/reference/test.md b/docs/reference/test.md index deb64fdcfc09..80760215a500 100644 --- a/docs/reference/test.md +++ b/docs/reference/test.md @@ -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 -- ` 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`. diff --git a/package.json b/package.json index e05793295189..b3e895400b3b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/test-projects.mjs b/scripts/test-projects.mjs index f8112316d8de..2b5bb949b69a 100644 --- a/scripts/test-projects.mjs +++ b/scripts/test-projects.mjs @@ -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)); diff --git a/scripts/test-projects-lib.mjs b/scripts/test-projects.test-support.mjs similarity index 100% rename from scripts/test-projects-lib.mjs rename to scripts/test-projects.test-support.mjs diff --git a/test/scripts/test-projects-lib.test.ts b/test/scripts/test-projects.test.ts similarity index 89% rename from test/scripts/test-projects-lib.test.ts rename to test/scripts/test-projects.test.ts index 8baf65acfd68..cf7af0ba61e9 100644 --- a/test/scripts/test-projects-lib.test.ts +++ b/test/scripts/test-projects.test.ts @@ -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", () => { diff --git a/vitest.config.ts b/vitest.config.ts index 33283b243b17..2d3af3a2796f 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -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",