@@ -57,12 +57,13 @@ describe("createChannelRunQueue", () => {
|
57 | 57 | }); |
58 | 58 | |
59 | 59 | it("updates run status and routes async errors", async () => { |
| 60 | +const taskError = new Error("boom"); |
60 | 61 | const setStatus = vi.fn(); |
61 | 62 | const onError = vi.fn(); |
62 | 63 | const queue = createChannelRunQueue({ setStatus, onError }); |
63 | 64 | |
64 | 65 | queue.enqueue("key", async () => { |
65 | | -throw new Error("boom"); |
| 66 | +throw taskError; |
66 | 67 | }); |
67 | 68 | |
68 | 69 | await flushAsyncWork(); |
@@ -72,10 +73,11 @@ describe("createChannelRunQueue", () => {
|
72 | 73 | expect(setStatus).toHaveBeenLastCalledWith( |
73 | 74 | expect.objectContaining({ activeRuns: 0, busy: false }), |
74 | 75 | ); |
75 | | -expect(onError).toHaveBeenCalledWith(expect.any(Error)); |
| 76 | +expect(onError).toHaveBeenCalledWith(taskError); |
76 | 77 | }); |
77 | 78 | |
78 | 79 | it("contains reporting hook errors", async () => { |
| 80 | +const taskError = new Error("boom"); |
79 | 81 | const onError = vi.fn(() => { |
80 | 82 | throw new Error("report failed"); |
81 | 83 | }); |
@@ -84,11 +86,11 @@ describe("createChannelRunQueue", () => {
|
84 | 86 | }); |
85 | 87 | |
86 | 88 | queue.enqueue("key", async () => { |
87 | | -throw new Error("boom"); |
| 89 | +throw taskError; |
88 | 90 | }); |
89 | 91 | |
90 | 92 | await flushAsyncWork(); |
91 | | -expect(onError).toHaveBeenCalledWith(expect.any(Error)); |
| 93 | +expect(onError).toHaveBeenCalledWith(taskError); |
92 | 94 | }); |
93 | 95 | |
94 | 96 | it("skips queued work after deactivation", async () => { |
|