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

Do not include from information when its not valid #5972

Merged
merged 3 commits into from
Apr 15, 2018

Conversation

stieg
Copy link
Contributor

@stieg stieg commented Apr 12, 2018

If you include the information then when the _execModule routine loads the
module without a from context then it will incorrectly setup a circular
dependency by declaring the parent is itself. By checking for a module name
and not including that information when passed in, the issue is avoided.

Summary

Fixes #5235

Test plan

Before I go through and finish this up I want someone with more knowledge of this project to review this (arguably trivial) change and ensure it makes sense. I have a headache from trying to figure all this out and AFAICT this is the best solution to solve the issue.

That said... its simple enough to load a mock test and trace up to the parent module and ensure it is null.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@SimenB
Copy link
Member

SimenB commented Apr 12, 2018

Thanks! Mind including the integration test from #5241 as well?

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@SimenB
Copy link
Member

SimenB commented Apr 12, 2018

FWIW, I think this change makes sense 🙂

If you rebase on master, it will fix an issue with CI which will crop up when you fix the flow errors currently reported

@stieg
Copy link
Contributor Author

stieg commented Apr 12, 2018

@SimenB Hey so am confused what you mean by the integration test from #5241. I have rebased onto master and am running things locally before I clobber and update the PR. Can you help me out?

@SimenB
Copy link
Member

SimenB commented Apr 12, 2018

There's an integration test added in #5241. Could you copy it over and include it in this PR?

stieg added 2 commits April 12, 2018 09:29
If you include the information then when the _execModule routine loads the
module without a from context then it will incorrectly setup a circular
dependency by declaring the parent is itself. By checking for a module name
and not including that information when passed in, the issue is avoided.
@stieg stieg force-pushed the jest_parent_loop_fix branch from 1c087a8 to 89d612a Compare April 12, 2018 19:45
@stieg
Copy link
Contributor Author

stieg commented Apr 12, 2018

Right... rebased on master; included those integration tests at your request, fixed linter and babel errors... only a couple of failures locally but they appear unrelated. Over to you @SimenB

@SimenB
Copy link
Member

SimenB commented Apr 12, 2018

Local failures are probably missing mercurial (hg) installation, seeing as CI passed :)

@codecov-io
Copy link

Codecov Report

Merging #5972 into master will increase coverage by 0.01%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5972      +/-   ##
==========================================
+ Coverage   64.34%   64.35%   +0.01%     
==========================================
  Files         217      217              
  Lines        8288     8291       +3     
  Branches        4        3       -1     
==========================================
+ Hits         5333     5336       +3     
  Misses       2954     2954              
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-runtime/src/index.js 74.83% <75%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b80dc79...89d612a. Read the comment docs.

@cpojer cpojer merged commit e393469 into jestjs:master Apr 15, 2018
@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.

module.parent is incorrectly circular in ^22.
5 participants