Skip to content

Commit

Permalink
Set a test to ERROR if it has an unhandled promise rejections (web-pl…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnedders authored and jgraham committed Oct 31, 2016
1 parent 3e7fb04 commit 7716e25
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions testharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -2669,7 +2669,7 @@ policies and contribution forms [3].

var tests = new Tests();

addEventListener("error", function(e) {
var error_handler = function(e) {
if (tests.file_is_test) {
var test = tests.tests[0];
if (test.phase >= test.phases.HAS_RESULT) {
Expand All @@ -2684,7 +2684,10 @@ policies and contribution forms [3].
tests.status.message = e.message;
tests.status.stack = e.stack;
}
});
};

addEventListener("error", error_handler);
addEventListener("unhandledrejection", function(e){ error_handler(e.reason); });

test_environment.on_tests_ready();

Expand Down

0 comments on commit 7716e25

Please sign in to comment.