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

fix: do not run global hooks if there are no tests #7745

Merged
merged 3 commits into from Jan 29, 2019

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jan 29, 2019

Summary

Fixes #7740.

Also adds a stack trace to that error:

image

Test plan

Needs to add a test, but I've confirmed it fixes the problem. Test added

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Test plan: it works, trust me™

Changelog missing

@SimenB
Copy link
Member Author

SimenB commented Jan 29, 2019

I had the time to push a test before your comment! 😀

image

'../global-setup/projects.jest.config.js',
);

const result = runWithJson('global-setup', [
Copy link
Member Author

Choose a reason for hiding this comment

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

runWithJson actually fails without the fix, but I added the assertions either way to assert they don't run, even if we don't crash anymore

image

@SimenB SimenB merged commit 8e69441 into jestjs:master Jan 29, 2019
@SimenB SimenB deleted the handle-no-tests-global-hooks branch January 29, 2019 14:00
captain-yossarian pushed a commit to captain-yossarian/jest that referenced this pull request Jul 18, 2019
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read property 'context' of undefined
3 participants