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

Make cleanupStackTrace work on older and newer Node 8 version #4686

Merged
merged 1 commit into from
Oct 13, 2017
Merged
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: 1 addition & 1 deletion integration_tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const cleanupStackTrace = (output: string) => {
.replace(/\n.*at.*assert\.js.*$/gm, '')
.replace(/\n.*at.*node\.js.*$/gm, '')
.replace(/\n.*at.*next_tick\.js.*$/gm, '')
.replace(/\n.*at (new)? Promise \(<anonymous>\).*$/gm, '')
.replace(/\n.*at (new )?Promise \(<anonymous>\).*$/gm, '')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have unit tests for out test utils? 😀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't be the one writing them 😄

Copy link
Member

@SimenB SimenB Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I think this should be stripped in here:https://github.com/facebook/jest/blob/8a427ebba88c6ab15da7c987716216728f5ea093/packages/jest-message-util/src/index.js#L150-L166

It being in the stack is not helpful at all (along with at <anonymous> and process._tickCallback (the latter should be stripped by removeInternalStackEntries already, shouldn't it?)), so why not just remove it for everyone, not just in the test utils for the integration tests?

image

Only the first line in the stack is useful. (Ignore the "expected" part, it's from another matcher)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a fan of removing at process._tickCallback and at <anonymous> without any further info (like line number) from the stack trace 👍.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do that, I think you can remove the line with a diff in this PR entirely

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to modify this PR or send a followup when we have the discussed behavior merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this should probably be merged in the meantime

.replace(/\n.*at <anonymous>.*$/gm, '')
.replace(/\n.*at Generator.next \(<anonymous>\).*$/gm, '')
.replace(/^.*at.*[\s][\(]?(\S*\:\d*\:\d*).*$/gm, ' at $1');
Expand Down