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 requireActual of node module #7404

Merged
merged 3 commits into from
Dec 24, 2018
Merged

Fix requireActual of node module #7404

merged 3 commits into from
Dec 24, 2018

Conversation

phapp88
Copy link
Contributor

@phapp88 phapp88 commented Nov 23, 2018

Summary

This pull request fixes #7002 by adding a requireActual method to the Runtime class that calls requireModule, which now has an additional parameter, isRequireActual. !isRequireActual can be used as an additional check before setting the modulePath to be the manualMock path. Therefore, when requireModule is called via requireActual, the modulePath will resolve to be the node module path as expected.

Test plan

The requireActual method is tested with a unit test.

@codecov-io
Copy link

Codecov Report

Merging #7404 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7404      +/-   ##
==========================================
+ Coverage   66.79%   66.79%   +<.01%     
==========================================
  Files         242      242              
  Lines        9371     9372       +1     
  Branches        6        6              
==========================================
+ Hits         6259     6260       +1     
  Misses       3110     3110              
  Partials        2        2
Impacted Files Coverage Δ
packages/jest-runtime/src/index.js 77.07% <100%> (+0.07%) ⬆️

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 c01b4c7...747ad29. Read the comment docs.

@SimenB SimenB merged commit bfdd4e1 into jestjs:master Dec 24, 2018
@phapp88 phapp88 deleted the fix-requireActual-of-node-module branch December 24, 2018 18:58
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.

require.requireActual does not work on node_modules with mock present
4 participants