-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Add memory to the
error
event to allow late event listeners
Cherry-picked from 15acb36 (3.0.0-dev). > HTML Reporter: Add support for displaying early errors > Ref #1786.
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
QUnit.on('error', function (error) { | ||
console.log(`# early error ${error}`); | ||
|
||
Promise.resolve().then(function () { | ||
QUnit.on('error', function (error) { | ||
console.log(`# late error ${error}`); | ||
}); | ||
}); | ||
}); | ||
|
||
setTimeout(function () { | ||
boom(); // eslint-disable-line | ||
}); | ||
|
||
QUnit.module('First', function () { | ||
QUnit.test('A', function (assert) { | ||
assert.true(true); | ||
}); | ||
QUnit.test('B', function (assert) { | ||
const done = assert.async(); | ||
setTimeout(function () { | ||
assert.true(true); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# command: ["qunit", "event-error-memory.js"] | ||
|
||
TAP version 13 | ||
not ok 1 global failure | ||
--- | ||
message: ReferenceError: boom is not defined | ||
severity: failed | ||
stack: | | ||
ReferenceError: boom is not defined | ||
at /qunit/test/cli/fixtures/event-error-memory.js:12:3 | ||
at internal | ||
... | ||
Bail out! ReferenceError: boom is not defined | ||
# early error ReferenceError: boom is not defined | ||
# late error ReferenceError: boom is not defined | ||
ok 2 First > A | ||
ok 3 First > B | ||
1..3 | ||
# pass 2 | ||
# skip 0 | ||
# todo 0 | ||
# fail 1 | ||
|
||
# exit code: 1 |