Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit 7716e25

Browse files
gsneddersjgraham
authored andcommitted
Set a test to ERROR if it has an unhandled promise rejections (#219)
See <http://www.w3.org/mid/[email protected]>.
1 parent 3e7fb04 commit 7716e25

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

testharness.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ policies and contribution forms [3].
26692669

26702670
var tests = new Tests();
26712671

2672-
addEventListener("error", function(e) {
2672+
var error_handler = function(e) {
26732673
if (tests.file_is_test) {
26742674
var test = tests.tests[0];
26752675
if (test.phase >= test.phases.HAS_RESULT) {
@@ -2684,7 +2684,10 @@ policies and contribution forms [3].
26842684
tests.status.message = e.message;
26852685
tests.status.stack = e.stack;
26862686
}
2687-
});
2687+
};
2688+
2689+
addEventListener("error", error_handler);
2690+
addEventListener("unhandledrejection", function(e){ error_handler(e.reason); });
26882691

26892692
test_environment.on_tests_ready();
26902693

0 commit comments

Comments
 (0)