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

jest-message-util: don't exclude trace lines with vendor anymore #6117

Merged
merged 2 commits into from
May 3, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Features

* `[jest-message-util]` Don't ignore messages with `vendor` anymore
([#6117](https://github.com/facebook/jest/pull/6117))
* `[jest-validate]` Get rid of `jest-config` dependency
([#6067](https://github.com/facebook/jest/pull/6067))
* `[jest-validate]` Adds option to inject `deprecationEntries`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,21 @@ exports[`should exclude jasmine from stack trace for Unix paths. 1`] = `
<dim> <dim>at Object.it (<dim>build/__tests__/messages-test.js<dim>:45:41)<dim></>
"
`;

exports[`should not exclude vendor from stack trace 1`] = `
"<bold><red> <bold>● <bold>Vendor test</></>


Expected value to be of type:
\\"number\\"
Received:
\\"\\"
type:
\\"string\\"
<dim> </>
<dim> </>
<dim> <dim>at Object.it (<dim>__tests__/vendor/cool_test.js<dim>:6:666)<dim></>
<dim> <dim>at Object.asyncFn (<dim>__tests__/vendor/sulu/node_modules/sulu-content-bundle/best_component.js<dim>:1:5)<dim></>
<dim> </>
"
`;
34 changes: 34 additions & 0 deletions packages/jest-message-util/src/__tests__/messages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ const assertionStack =
at internal/process/next_tick.js:188:7
`;

const vendorStack =
' ' +
`
Expected value to be of type:
"number"
Received:
""
type:
"string"

at Object.it (__tests__/vendor/cool_test.js:6:666)
at Object.asyncFn (__tests__/vendor/sulu/node_modules/sulu-content-bundle/best_component.js:1:5)
`;

it('should exclude jasmine from stack trace for Unix paths.', () => {
const messages = formatResultsErrors(
[
Expand Down Expand Up @@ -103,3 +117,23 @@ it('formatStackTrace should strip node internals', () => {

expect(messages).toMatchSnapshot();
});

it('should not exclude vendor from stack trace', () => {
const messages = formatResultsErrors(
[
{
ancestorTitles: [],
failureMessages: [vendorStack],
title: 'Vendor test',
},
],
{
rootDir: '',
},
{
noStackTrace: false,
},
);

expect(messages).toMatchSnapshot();
});
2 changes: 1 addition & 1 deletion packages/jest-message-util/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const PATH_NODE_MODULES = `${path.sep}node_modules${path.sep}`;
const PATH_JEST_PACKAGES = `${path.sep}jest${path.sep}packages${path.sep}`;

// filter for noisy stack trace lines
const JASMINE_IGNORE = /^\s+at(?:(?:.*?vendor\/|jasmine\-)|\s+jasmine\.buildExpectationResult)/;
const JASMINE_IGNORE = /^\s+at(?:(?:.jasmine\-)|\s+jasmine\.buildExpectationResult)/;
const JEST_INTERNALS_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/;
const ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/;
const ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/;
Expand Down