Skip to content

Commit

Permalink
Use wrap in e2e test for custom matcher stack trace
Browse files Browse the repository at this point in the history
Uses the new wrap utility in e2e snapshot for custom
matcher stack traces.
  • Loading branch information
Don Schrimsher committed Jan 22, 2019
1 parent 3018bc8 commit d410d53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
16 changes: 2 additions & 14 deletions e2e/__tests__/__snapshots__/customMatcherStackTrace.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`custom async matchers 1`] = `
Object {
"rest": "FAIL __tests__/async.test.js
FAIL __tests__/async.test.js
✕ showing the stack trace for an async matcher
● showing the stack trace for an async matcher
Expand All @@ -18,19 +17,10 @@ Object {
7 | async function toThrowCustomAsyncMatcherError() {
at Object.toThrowCustomAsyncMatcherError (__tests__/async.test.js:4:22)
",
"summary": "Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching /async.test.js/i.
",
}
`;
exports[`works with custom matchers 1`] = `
"FAIL __tests__/async.test.js
FAIL __tests__/async.test.js
showing the stack trace for an async matcher
We expect the stack trace and code fence for this matcher to be shown in the console.
Expand Down Expand Up @@ -64,6 +54,4 @@ FAIL __tests__/sync.test.js
at foo (__tests__/sync.test.js:52:7)
at Object.callback (__tests__/sync.test.js:11:18)
at Object.toCustomMatch (__tests__/sync.test.js:53:8)
"
`;
4 changes: 2 additions & 2 deletions e2e/__tests__/customMatcherStackTrace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test('works with custom matchers', () => {
test('custom async matchers', () => {
const {stderr} = runJest('custom-matcher-stack-trace', ['async.test.js']);

const result = extractSummary(stderr);
const {rest} = extractSummary(stderr);

expect(result).toMatchSnapshot();
expect(wrap(rest)).toMatchSnapshot();
});

0 comments on commit d410d53

Please sign in to comment.