Narrow browser listeners before invocation

This commit is contained in:
ms2k 2026-08-26 11:46:10 +09:00
commit 3ad5dcf496

View file

@ -16,8 +16,12 @@ test('reports and cleans up', () => {
expect(error).toEqual(expect.any(Function))
expect(rejection).toEqual(expect.any(Function))
;(error as EventListener)(new Event('error'))
;(rejection as EventListener)(new Event('unhandledrejection'))
if (typeof error !== 'function' || typeof rejection !== 'function') {
throw new TypeError('event listeners were not registered')
}
error(new Event('error'))
rejection(new Event('unhandledrejection'))
expect(beacon.mock.calls).toEqual([
[