mirror of
https://github.com/openclaw/openclaw.git
synced 2026-09-28 14:12:28 +08:00
Keep tooling fixtures limited to their required imports and source files, and settle child commands through existing cancellation and cleanup owners. Bind audio mock results to WAV input to remove the completion-order race. Preserve assertions, timeout and retry policy, and the relocated pnpm lifecycle case. Validation: fresh merged-context CI run 35531487613 passed; independent P2 review was clean. Local repeat-campaign gaps remain documented in the PR.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { availableParallelism } from "node:os";
|
|
import { it, vi } from "vitest";
|
|
import { createCommandFixture, type CommandFixture } from "../helpers/command-fixture.js";
|
|
|
|
export type MacScriptFixture = CommandFixture;
|
|
|
|
export function createMacScriptTest() {
|
|
const test = it.extend<{ mac: MacScriptFixture }>({
|
|
mac: async ({ signal, onTestFinished }, use) => {
|
|
// Keep the Mac script suite's strict leader-exit verification.
|
|
await use(createCommandFixture({ signal, onTestFinished }, "tree"));
|
|
},
|
|
});
|
|
// Resolve ownership before runTest: onTestFinished aborts outstanding commands
|
|
// before whole-body cleanup waits for their finally blocks and removes inputs.
|
|
test.aroundEach(async (runTest, { mac }) => {
|
|
try {
|
|
await runTest();
|
|
} finally {
|
|
await mac.lifetime.cleanup();
|
|
}
|
|
});
|
|
// Keep outer suites sequential: this per-group cap is applied after Vitest's
|
|
// file-wide limiter is created, so concurrent suites could each admit the full cap.
|
|
test.beforeAll(() => {
|
|
vi.setConfig({ maxConcurrency: Math.min(3, availableParallelism()) });
|
|
return () => vi.resetConfig();
|
|
});
|
|
return test;
|
|
}
|