We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I need to test such function:
const testMe = () => setTimeout( () => { throw new EvalError('foo'); }, 0, );
it('throws error', (done) => { expect(testMe).to.eventually.throw.global(EvalError).then((thrown) => { expect(thrown.message).to.equal('foo'); done(); }); });
const catchGlobal = (errHandler) => { const originalOnError = window.onerror; window.onerror = () => {}; window.addEventListener('error', (errEvent) => { window.onerror = originalOnError; setTimeout(() => errHandler(errEvent.error), 0); }, { capture: true, once: true, }); }; it('throws error', (done) => { catchGlobal((thrown) => { expect(thrown.message).to.be.equal('foo'); done(); }); });
setTimeout
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Setup
I need to test such function:
Proposed Solution
Current Solution
Gory Details
setTimeout
.setTimeout
and set global error catchers. I wrote a few functions to automate this process, which I need to be tested.The text was updated successfully, but these errors were encountered: