Back to Qunit

QUnit.onUncaughtException()

docs/api/extension/QUnit.onUncaughtException.md

2.26.0586 B
Original Source

QUnit.onUncaughtException( error )

Handle a global error that should result in a failed test run.

namedescription
error (any)Usually an Error object, but any other thrown or rejected value may be given as well.

Examples

js
const error = new Error('Failed to reverse the polarity of the neutron flow');
QUnit.onUncaughtException(error);
js
process.on('uncaughtException', QUnit.onUncaughtException);
js
window.addEventListener('unhandledrejection', function (event) {
  QUnit.onUncaughtException(event.reason);
});