21 lines
521 B
JavaScript
21 lines
521 B
JavaScript
importScripts('../../resources/js-test-pre.js');
|
|
|
|
description('Test unhandled promise rejection event.');
|
|
|
|
var global = this;
|
|
global.jsTestIsAsync = true;
|
|
|
|
global.error = null;
|
|
global.promise = null;
|
|
global.onunhandledrejection = function (e) {
|
|
error = e;
|
|
shouldBe(`error.type`, `"unhandledrejection"`);
|
|
shouldBe(`error.cancelable`, `true`);
|
|
shouldBe(`error.promise`, `promise`);
|
|
shouldBe(`error.reason`, `"ERROR"`);
|
|
finishJSTest();
|
|
return false;
|
|
};
|
|
|
|
global.promise = Promise.reject("ERROR");
|