mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 23:56:07 +00:00
perf: route test commands through scoped lanes
This commit is contained in:
@@ -1091,7 +1091,7 @@
|
||||
"runtime-sidecars:gen": "node --import tsx scripts/generate-runtime-sidecar-paths-baseline.ts --write",
|
||||
"stage:bundled-plugin-runtime-deps": "node scripts/stage-bundled-plugin-runtime-deps.mjs",
|
||||
"start": "node scripts/run-node.mjs",
|
||||
"test": "vitest run --config vitest.config.ts",
|
||||
"test": "node scripts/test-projects.mjs",
|
||||
"test:all": "pnpm lint && pnpm build && pnpm test && pnpm test:e2e && pnpm test:live && pnpm test:docker:all",
|
||||
"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",
|
||||
@@ -1135,7 +1135,7 @@
|
||||
"test:live": "node scripts/test-live.mjs",
|
||||
"test:live:gateway-profiles": "node scripts/test-live.mjs -- src/gateway/gateway-models.profiles.live.test.ts",
|
||||
"test:live:models-profiles": "node scripts/test-live.mjs -- src/agents/models.profiles.live.test.ts",
|
||||
"test:max": "OPENCLAW_VITEST_MAX_WORKERS=8 vitest run --config vitest.config.ts",
|
||||
"test:max": "OPENCLAW_VITEST_MAX_WORKERS=8 node scripts/test-projects.mjs",
|
||||
"test:parallels:linux": "bash scripts/e2e/parallels-linux-smoke.sh",
|
||||
"test:parallels:macos": "bash scripts/e2e/parallels-macos-smoke.sh",
|
||||
"test:parallels:npm-update": "bash scripts/e2e/parallels-npm-update-smoke.sh",
|
||||
@@ -1147,7 +1147,7 @@
|
||||
"test:perf:profile:main": "node scripts/run-vitest-profile.mjs main",
|
||||
"test:perf:profile:runner": "node scripts/run-vitest-profile.mjs runner",
|
||||
"test:sectriage": "pnpm exec vitest run --config vitest.gateway.config.ts && vitest run --config vitest.unit.config.ts --exclude src/daemon/launchd.integration.test.ts --exclude src/process/exec.test.ts",
|
||||
"test:serial": "OPENCLAW_VITEST_MAX_WORKERS=1 vitest run --config vitest.config.ts",
|
||||
"test:serial": "OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/test-projects.mjs",
|
||||
"test:startup:bench": "node --import tsx scripts/bench-cli-startup.ts",
|
||||
"test:startup:bench:check": "node scripts/test-cli-startup-bench-budget.mjs",
|
||||
"test:startup:bench:save": "node --import tsx scripts/bench-cli-startup.ts --preset all --runs 5 --warmup 1 --output .artifacts/cli-startup-bench-all.json",
|
||||
@@ -1156,7 +1156,7 @@
|
||||
"test:startup:memory": "node scripts/check-cli-startup-memory.mjs",
|
||||
"test:ui": "pnpm lint:ui:no-raw-window-open && pnpm --dir ui test",
|
||||
"test:voicecall:closedloop": "node scripts/test-voicecall-closedloop.mjs",
|
||||
"test:watch": "vitest --config vitest.config.ts",
|
||||
"test:watch": "node scripts/test-projects.mjs --watch",
|
||||
"ts-topology": "node --import tsx scripts/ts-topology.ts",
|
||||
"tsgo": "node scripts/run-tsgo.mjs",
|
||||
"tui": "node scripts/run-node.mjs tui",
|
||||
|
||||
@@ -89,7 +89,9 @@ export function resolveExtensionTestPlan(params = {}) {
|
||||
}
|
||||
|
||||
const usesChannelConfig = roots.some((root) => channelTestRoots.includes(root));
|
||||
const config = usesChannelConfig ? "vitest.channels.config.ts" : "vitest.extensions.config.ts";
|
||||
const config = usesChannelConfig
|
||||
? "vitest.extension-channels.config.ts"
|
||||
: "vitest.extensions.config.ts";
|
||||
const testFileCount = roots.reduce(
|
||||
(sum, root) => sum + countTestFiles(path.join(repoRoot, root)),
|
||||
0,
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import fs from "node:fs";
|
||||
import { acquireLocalHeavyCheckLockSync } from "./lib/local-heavy-check-runtime.mjs";
|
||||
import { spawnPnpmRunner } from "./pnpm-runner.mjs";
|
||||
import { createVitestRunSpecs, writeVitestIncludeFile } from "./test-projects.test-support.mjs";
|
||||
import {
|
||||
createVitestRunSpecs,
|
||||
parseTestProjectsArgs,
|
||||
writeVitestIncludeFile,
|
||||
} from "./test-projects.test-support.mjs";
|
||||
|
||||
// Keep this shim so `pnpm test -- src/foo.test.ts` still forwards filters
|
||||
// cleanly instead of leaking pnpm's passthrough sentinel to Vitest.
|
||||
@@ -53,11 +57,35 @@ function runVitestSpec(spec) {
|
||||
});
|
||||
}
|
||||
|
||||
function createRootVitestRunSpec(args) {
|
||||
const { forwardedArgs, watchMode } = parseTestProjectsArgs(args, process.cwd());
|
||||
return {
|
||||
config: "vitest.config.ts",
|
||||
env: process.env,
|
||||
includeFilePath: null,
|
||||
includePatterns: null,
|
||||
pnpmArgs: [
|
||||
"exec",
|
||||
"vitest",
|
||||
...(watchMode ? [] : ["run"]),
|
||||
"--config",
|
||||
"vitest.config.ts",
|
||||
...forwardedArgs,
|
||||
],
|
||||
watchMode,
|
||||
};
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const runSpecs = createVitestRunSpecs(process.argv.slice(2), {
|
||||
baseEnv: process.env,
|
||||
cwd: process.cwd(),
|
||||
});
|
||||
const args = process.argv.slice(2);
|
||||
const { targetArgs } = parseTestProjectsArgs(args, process.cwd());
|
||||
const runSpecs =
|
||||
targetArgs.length === 0
|
||||
? [createRootVitestRunSpec(args)]
|
||||
: createVitestRunSpecs(args, {
|
||||
baseEnv: process.env,
|
||||
cwd: process.cwd(),
|
||||
});
|
||||
|
||||
for (const spec of runSpecs) {
|
||||
const result = await runVitestSpec(spec);
|
||||
|
||||
@@ -298,7 +298,7 @@ describe("test-projects args", () => {
|
||||
watchMode: false,
|
||||
},
|
||||
{
|
||||
config: "vitest.channels.config.ts",
|
||||
config: "vitest.extension-channels.config.ts",
|
||||
forwardedArgs: ["-t", "mention"],
|
||||
includePatterns: ["extensions/discord/src/monitor/message-handler.preflight.test.ts"],
|
||||
watchMode: false,
|
||||
@@ -316,7 +316,7 @@ describe("test-projects args", () => {
|
||||
"vitest",
|
||||
"run",
|
||||
"--config",
|
||||
"vitest.channels.config.ts",
|
||||
"vitest.extension-channels.config.ts",
|
||||
]);
|
||||
expect(spec?.includePatterns).toEqual([
|
||||
"extensions/discord/src/monitor/message-handler.preflight.test.ts",
|
||||
|
||||
@@ -33,12 +33,12 @@ function findExtensionWithoutTests() {
|
||||
}
|
||||
|
||||
describe("scripts/test-extension.mjs", () => {
|
||||
it("resolves channel-root extensions onto the channel vitest config", () => {
|
||||
it("resolves channel-root extensions onto the extension-channel vitest config", () => {
|
||||
const plan = resolveExtensionTestPlan({ targetArg: "slack", cwd: process.cwd() });
|
||||
|
||||
expect(plan.extensionId).toBe("slack");
|
||||
expect(plan.extensionDir).toBe(bundledPluginRoot("slack"));
|
||||
expect(plan.config).toBe("vitest.channels.config.ts");
|
||||
expect(plan.config).toBe("vitest.extension-channels.config.ts");
|
||||
expect(plan.roots).toContain(bundledPluginRoot("slack"));
|
||||
expect(plan.hasTests).toBe(true);
|
||||
});
|
||||
@@ -57,7 +57,7 @@ describe("scripts/test-extension.mjs", () => {
|
||||
|
||||
expect(plan.roots).toContain(bundledPluginRoot("line"));
|
||||
expect(plan.roots).not.toContain("src/line");
|
||||
expect(plan.config).toBe("vitest.extensions.config.ts");
|
||||
expect(plan.config).toBe("vitest.extension-channels.config.ts");
|
||||
expect(plan.hasTests).toBe(true);
|
||||
});
|
||||
|
||||
@@ -117,15 +117,15 @@ describe("scripts/test-extension.mjs", () => {
|
||||
expect(batch.extensionIds).toEqual(["firecrawl", "line", "slack"]);
|
||||
expect(batch.planGroups).toEqual([
|
||||
{
|
||||
config: "vitest.channels.config.ts",
|
||||
extensionIds: ["slack"],
|
||||
roots: [bundledPluginRoot("slack")],
|
||||
config: "vitest.extension-channels.config.ts",
|
||||
extensionIds: ["line", "slack"],
|
||||
roots: [bundledPluginRoot("slack"), bundledPluginRoot("line")],
|
||||
testFileCount: expect.any(Number),
|
||||
},
|
||||
{
|
||||
config: "vitest.extensions.config.ts",
|
||||
extensionIds: ["firecrawl", "line"],
|
||||
roots: [bundledPluginRoot("firecrawl"), bundledPluginRoot("line")],
|
||||
extensionIds: ["firecrawl"],
|
||||
roots: [bundledPluginRoot("firecrawl")],
|
||||
testFileCount: expect.any(Number),
|
||||
},
|
||||
]);
|
||||
@@ -146,7 +146,7 @@ describe("scripts/test-extension.mjs", () => {
|
||||
resolveExtensionTestPlan({ cwd: process.cwd(), targetArg: extensionId }).hasTests,
|
||||
);
|
||||
|
||||
expect(uniqueAssigned).toEqual(expected);
|
||||
expect(uniqueAssigned.toSorted((left, right) => left.localeCompare(right))).toEqual(expected);
|
||||
expect(assigned).toHaveLength(expected.length);
|
||||
|
||||
const totals = shards.map((shard) => shard.testFileCount);
|
||||
|
||||
Reference in New Issue
Block a user