()
| 290 | } |
| 291 | |
| 292 | async function abortableOnAfter() { |
| 293 | const ee = new EventEmitter(); |
| 294 | const ac = new AbortController(); |
| 295 | |
| 296 | const i = setInterval(() => ee.emit('foo', 'foo'), 10); |
| 297 | |
| 298 | async function foo() { |
| 299 | for await (const f of on(ee, 'foo', { signal: ac.signal })) { |
| 300 | assert.strictEqual(f, 'foo'); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | foo().catch(common.mustCall((error) => { |
| 305 | assert.strictEqual(error.name, 'AbortError'); |
| 306 | })).finally(() => { |
| 307 | clearInterval(i); |
| 308 | }); |
| 309 | |
| 310 | process.nextTick(() => ac.abort()); |
| 311 | } |
| 312 | |
| 313 | async function eventTargetAbortableOnAfter() { |
| 314 | const et = new EventTarget(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…