/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
e2e/nested-event-loop/__tests__/nestedEventLoop.test.js
31 строка
771 B
fisker Cheung
chore: update ESLint to v9 (#15531)
05 мар 2025, 16:49
Не верифицирован
05 мар 2025, 16:49
4e7d916
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @jest-environment jsdom */ /* global document */ 'use strict'; it('can assert on errors across nested event loops', () => { const el = document.createElement('div'); el.addEventListener('fake', () => { throw new Error('This should be caught.'); }); let caught = null; globalThis.addEventListener('error', e => { caught = e.error; }); expect(() => { const evt = document.createEvent('Event'); evt.initEvent('fake', false, false); el.dispatchEvent(evt); if (caught) { throw caught; } }).toThrow('This should be caught.'); });