summaryrefslogtreecommitdiffstats
path: root/testing/mochitest/tests/browser/browser_uncaught_rejection_expected.js
blob: 2ee9f23d79f1f4fa42dac7a3cd979288b69407bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
const { PromiseTestUtils } = ChromeUtils.importESModule(
  "resource://testing-common/PromiseTestUtils.sys.mjs"
);
PromiseTestUtils.allowMatchingRejectionsGlobally(/Allowed rejection./);
PromiseTestUtils.expectUncaughtRejection(/Promise rejection./);
PromiseTestUtils.expectUncaughtRejection(/Promise rejection./);

function test() {
  Promise.reject(new Error("Promise rejection."));
  Promise.reject(new Error("Promise rejection."));
  Promise.reject(new Error("Allowed rejection."));
}