aboutsummaryrefslogtreecommitdiff
path: root/test/js/web/abort/abort.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/web/abort/abort.test.ts')
-rw-r--r--test/js/web/abort/abort.test.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/js/web/abort/abort.test.ts b/test/js/web/abort/abort.test.ts
index 4895e0d13..ef0b07a18 100644
--- a/test/js/web/abort/abort.test.ts
+++ b/test/js/web/abort/abort.test.ts
@@ -18,4 +18,25 @@ describe("AbortSignal", () => {
expect(stderr?.toString()).not.toContain("✗");
});
+
+ test("AbortSignal.timeout(n) should not freeze the process", async () => {
+ const fileName = join(import.meta.dir, "abort.signal.ts");
+
+ const server = Bun.spawn({
+ cmd: [bunExe(), fileName],
+ env: bunEnv,
+ cwd: tmpdir(),
+ });
+
+ const exitCode = await Promise.race([
+ server.exited,
+ (async () => {
+ await Bun.sleep(5000);
+ server.kill();
+ return 2;
+ })(),
+ ]);
+
+ expect(exitCode).toBe(0);
+ });
});