fix(plugins): abort sibling boundary prep steps

This commit is contained in:
Vincent Koc
2026-04-07 11:42:38 +01:00
parent aa61b508d1
commit f54188f600
2 changed files with 63 additions and 13 deletions

View File

@@ -1,5 +1,8 @@
import { describe, expect, it } from "vitest";
import { createPrefixedOutputWriter } from "../../scripts/prepare-extension-package-boundary-artifacts.mjs";
import {
createPrefixedOutputWriter,
runNodeStepsInParallel,
} from "../../scripts/prepare-extension-package-boundary-artifacts.mjs";
describe("prepare-extension-package-boundary-artifacts", () => {
it("prefixes each completed line and flushes the trailing partial line", () => {
@@ -16,4 +19,25 @@ describe("prepare-extension-package-boundary-artifacts", () => {
expect(output).toBe("[boundary] first line\n[boundary] second line\n[boundary] third");
});
it("aborts sibling steps after the first failure", async () => {
const startedAt = Date.now();
await expect(
runNodeStepsInParallel([
{
label: "fail-fast",
args: ["--eval", "setTimeout(() => process.exit(2), 10)"],
timeoutMs: 5_000,
},
{
label: "slow-step",
args: ["--eval", "setTimeout(() => {}, 10_000)"],
timeoutMs: 5_000,
},
]),
).rejects.toThrow("fail-fast failed with exit code 2");
expect(Date.now() - startedAt).toBeLessThan(2_000);
});
});