-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test: Convert config-notrycatch fixture to TAP-based
The TAP snapshot is normalized to remove local file path and OS variances, thus allowing a strict validation to take place. While at it, also set a timeout so that this test keeps working the same way once a default timeout is enabled.
- Loading branch information
Showing
6 changed files
with
69 additions
and
39 deletions.
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
28 changes: 28 additions & 0 deletions
28
test/cli/fixtures/config-notrycatch-hook-rejection.tap.txt
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,28 @@ | ||
# command: ["qunit", "config-notrycatch-hook-rejection.js"] | ||
|
||
TAP version 13 | ||
FOUND Unhandled Rejection: bad things happen | ||
not ok 1 example > passing test | ||
--- | ||
message: global failure: bad things happen | ||
severity: failed | ||
actual : undefined | ||
expected: undefined | ||
stack: | | ||
at internal | ||
... | ||
--- | ||
message: Test took longer than 1000ms; test timed out. | ||
severity: failed | ||
actual : null | ||
expected: undefined | ||
stack: | | ||
at internal | ||
... | ||
1..1 | ||
# pass 0 | ||
# skip 0 | ||
# todo 0 | ||
# fail 1 | ||
|
||
# exit code: 1 |
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 |
---|---|---|
@@ -1,20 +1,14 @@ | ||
'use strict'; | ||
|
||
process.on('unhandledRejection', (reason) => { | ||
console.log('Unhandled Rejection:', reason); | ||
console.log('FOUND Unhandled Rejection:', reason); | ||
}); | ||
|
||
QUnit.module('notrycatch', function (hooks) { | ||
hooks.beforeEach(function () { | ||
this.originalNotrycatch = QUnit.config.notrycatch; | ||
QUnit.config.notrycatch = true; | ||
}); | ||
|
||
hooks.afterEach(function () { | ||
QUnit.config.notrycatch = this.originalNotrycatch; | ||
}); | ||
QUnit.config.testTimeout = 1000; | ||
QUnit.config.notrycatch = true; | ||
|
||
QUnit.module('example', function () { | ||
QUnit.test('returns a rejected promise', function () { | ||
return Promise.reject('bad things happen sometimes'); | ||
return Promise.reject('bad things happen'); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
test/cli/fixtures/config-notrycatch-test-rejection.tap.txt
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,28 @@ | ||
# command: ["qunit", "config-notrycatch-test-rejection.js"] | ||
|
||
TAP version 13 | ||
FOUND Unhandled Rejection: bad things happen | ||
not ok 1 example > returns a rejected promise | ||
--- | ||
message: global failure: bad things happen | ||
severity: failed | ||
actual : undefined | ||
expected: undefined | ||
stack: | | ||
at internal | ||
... | ||
--- | ||
message: Test took longer than 1000ms; test timed out. | ||
severity: failed | ||
actual : null | ||
expected: undefined | ||
stack: | | ||
at internal | ||
... | ||
1..1 | ||
# pass 0 | ||
# skip 0 | ||
# todo 0 | ||
# fail 1 | ||
|
||
# exit code: 1 |
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