Skip to content

Commit b9581a4

Browse files
committed
test(plugin-sdk): clear the completed cancellation deadline
1 parent 1639baa commit b9581a4

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

‎test/scripts/plugin-sdk-api-diff.test.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { execFileSync, spawn } from "node:child_process";
33
import { chmodSync, existsSync, readFileSync, writeFileSync } from "node:fs";
44
import { delimiter, dirname, join, resolve } from "node:path";
55
import { afterEach, describe, expect, it } from "vitest";
6+
import { withTestTimeout } from "../helpers/promise.js";
67
import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js";
78

89
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
@@ -107,12 +108,7 @@ describe("Plugin SDK API diff CLI", () => {
107108
expect(existsSync(temporaryRoot)).toBe(true);
108109
const interruptedAt = Date.now();
109110
child.kill("SIGTERM");
110-
const exitCode = await Promise.race([
111-
close,
112-
new Promise<never>((_, reject) => {
113-
setTimeout(() => reject(new Error("Plugin SDK API diff ignored SIGTERM")), 5_000);
114-
}),
115-
]);
111+
const exitCode = await withTestTimeout(close, 5_000, "Plugin SDK API diff ignored SIGTERM");
116112

117113
expect(exitCode).toBe(143);
118114
expect(Date.now() - interruptedAt).toBeLessThan(5_000);

0 commit comments

Comments
 (0)