Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stack traces on async failures #6008

Merged
merged 7 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

### Features

* `[expect]` Add stack trace for async errors
([#6008](https://github.com/facebook/jest/pull/6008))
* `[jest-jasmine2]` Add stack trace for timeouts
([#6008](https://github.com/facebook/jest/pull/6008))
* `[jest-jasmine2]` Add stack trace for thrown non-`Error`s
([#6008](https://github.com/facebook/jest/pull/6008))
* `[jest-runtime]` Prevent modules from marking themselves as their own parent
([#5235](https://github.com/facebook/jest/issues/5235))
* `[jest-mock]` Add support for auto-mocking generator functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`shows the correct errors in stderr when failing tests 1`] = `
Object {
"rest": "FAIL __tests__/failure.test.js
"FAIL __tests__/failure.test.js
✕ fail with expected non promise values
✕ fail with expected non promise values and not
✕ fail with expected promise values
Expand Down Expand Up @@ -30,30 +29,47 @@ Object {

● fail with expected promise values

Error
Error: Expected value to have length:
2
Received:
1
received.length:
1
Expected value to have length:
2
Received:
1
received.length:
1

22 |
23 | it('fail with expected promise values', async () => {
> 24 | await (expect(Promise.resolve([1])): any).resolves.toHaveLengthAsync(
| ^
25 | Promise.resolve(2)
26 | );
27 | });

at __tests__/failure.test.js:24:54
at __tests__/failure.test.js:11:191
at __tests__/failure.test.js:11:437
at __tests__/failure.test.js:11:99

● fail with expected promise values and not

Error
Error: Expected value to not have length:
2
Received:
1,2
received.length:
2
Expected value to not have length:
2
Received:
1,2
received.length:
2

28 |
29 | it('fail with expected promise values and not', async () => {
> 30 | await (expect(Promise.resolve([1, 2])).resolves.not: any).toHaveLengthAsync(
| ^
31 | Promise.resolve(2)
32 | );
33 | });

at __tests__/failure.test.js:30:61
at __tests__/failure.test.js:11:191
at __tests__/failure.test.js:11:437
at __tests__/failure.test.js:11:99

",
"summary": "Test Suites: 1 failed, 1 total
Tests: 4 failed, 4 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching /failure.test.js/i.
",
}
"
`;
Loading