mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Fix test using afterAll inside of a test
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { spawn } from "bun";
|
||||
import { afterAll, describe, expect, mock, test } from "bun:test";
|
||||
import { describe, expect, mock, test } from "bun:test";
|
||||
import { bunEnv, bunExe } from "harness";
|
||||
|
||||
describe("Streaming body via", () => {
|
||||
@@ -28,24 +28,18 @@ describe("Streaming body via", () => {
|
||||
});
|
||||
|
||||
test("async generator function throws an error but continues to send the headers", async () => {
|
||||
let subprocess;
|
||||
|
||||
afterAll(() => {
|
||||
subprocess?.kill();
|
||||
});
|
||||
|
||||
const onMessage = mock(async url => {
|
||||
const response = await fetch(url);
|
||||
expect(response.headers.get("X-Hey")).toBe("123");
|
||||
subprocess?.kill();
|
||||
});
|
||||
|
||||
subprocess = spawn({
|
||||
await using subprocess = spawn({
|
||||
cwd: import.meta.dirname,
|
||||
cmd: [bunExe(), "async-iterator-throws.fixture.js"],
|
||||
env: bunEnv,
|
||||
ipc: onMessage,
|
||||
stdout: "ignore",
|
||||
stdout: "inherit",
|
||||
stderr: "pipe",
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user