|
6 | 6 | * 1. Worker output diverges from in-process parsing (preview, complete). |
7 | 7 | * 2. A typed parser error loses its class, `code`, or message crossing back. |
8 | 8 | * 3. A missing bundle breaks parsing instead of falling back in-process. |
9 | | - * 4. An unloadable bundle (throws at load) breaks parsing instead of falling back. |
| 9 | + * 4. An unloadable bundle (throws at load, or the Worker constructor itself |
| 10 | + * throws) breaks parsing or strands queued jobs instead of falling back. |
10 | 11 | * 5. A worker crash mid-parse loses the job instead of re-running it in-process. |
11 | 12 | * 6. An abort during a worker parse hangs or leaves the worker occupying its slot. |
12 | 13 | * 7. An abort while queued still dispatches the job. |
@@ -151,6 +152,19 @@ describe('XlsxWorkerPool fallback', () => { |
151 | 152 | await expect(pool.parse(input, {}, inProcess(input))).resolves.toEqual(expected) |
152 | 153 | }) |
153 | 154 |
|
| 155 | + it('parses every queued job in-process when the Worker constructor throws', async () => { |
| 156 | + const input = workbook() |
| 157 | + const expected = await parser.parseBuffer(input) |
| 158 | + const pool = new XlsxWorkerPool({ workerPath: 'not-a-resolvable-worker-path.mjs', size: 1 }) |
| 159 | + |
| 160 | + const results = await Promise.all([ |
| 161 | + pool.parse(input, {}, inProcess(input)), |
| 162 | + pool.parse(input, {}, inProcess(input)), |
| 163 | + ]) |
| 164 | + |
| 165 | + expect(results).toEqual([expected, expected]) |
| 166 | + }) |
| 167 | + |
154 | 168 | it('re-runs a job in-process when the worker dies mid-parse', async () => { |
155 | 169 | const input = workbook() |
156 | 170 | const expected = await parser.parseBuffer(input) |
|
0 commit comments