Skip to content

Commit 3b023e9

Browse files
committed
ci(release): pass vitest batch options before roots
1 parent a3cd90f commit 3b023e9

2 files changed

Lines changed: 25 additions & 9 deletions

File tree

scripts/lib/vitest-batch-runner.mjs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ export async function runVitestBatch(params) {
1616
cwd: repoRoot,
1717
detached: shouldUseDetachedVitestProcessGroup(),
1818
env: params.env,
19-
pnpmArgs: [
20-
"exec",
21-
"vitest",
22-
"run",
23-
"--config",
24-
params.config,
25-
...params.targets,
26-
...params.args,
27-
],
19+
pnpmArgs: buildVitestBatchPnpmArgs(params),
2820
stdio: "inherit",
2921
});
3022
const teardownChildCleanup = installVitestProcessGroupCleanup({ child });
@@ -44,6 +36,10 @@ export async function runVitestBatch(params) {
4436
});
4537
}
4638

39+
export function buildVitestBatchPnpmArgs(params) {
40+
return ["exec", "vitest", "run", "--config", params.config, ...params.args, ...params.targets];
41+
}
42+
4743
export function isDirectScriptRun(metaUrl) {
4844
const entryHref = process.argv[1] ? pathToFileURL(path.resolve(process.argv[1])).href : "";
4945
return metaUrl === entryHref;

test/scripts/test-extension.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
resolveExtensionBatchPlan,
1414
resolveExtensionTestPlan,
1515
} from "../../scripts/lib/extension-test-plan.mjs";
16+
import { buildVitestBatchPnpmArgs } from "../../scripts/lib/vitest-batch-runner.mjs";
1617
import {
1718
parseExtensionIds,
1819
resolveExtensionBatchParallelism,
@@ -606,6 +607,25 @@ describe("scripts/test-extension.mjs", () => {
606607
});
607608
});
608609

610+
it("places Vitest passthrough options before batch target roots", () => {
611+
expect(
612+
buildVitestBatchPnpmArgs({
613+
args: ["--exclude", "extensions/codex/src/app-server/run-attempt.test.ts"],
614+
config: "test/vitest/vitest.extensions.config.ts",
615+
targets: ["extensions/codex"],
616+
}),
617+
).toEqual([
618+
"exec",
619+
"vitest",
620+
"run",
621+
"--config",
622+
"test/vitest/vitest.extensions.config.ts",
623+
"--exclude",
624+
"extensions/codex/src/app-server/run-attempt.test.ts",
625+
"extensions/codex",
626+
]);
627+
});
628+
609629
it("treats extensions without tests as a no-op by default", () => {
610630
const extensionId = findExtensionWithoutTests();
611631
const stdout = runScript([extensionId]);

0 commit comments

Comments
 (0)