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

Use realpath to match transformers #5000

Merged
merged 6 commits into from
Dec 4, 2017
Merged

Use realpath to match transformers #5000

merged 6 commits into from
Dec 4, 2017

Conversation

k15a
Copy link
Contributor

@k15a k15a commented Dec 1, 2017

Summary

This will use the realpath to match the transformers in case the path
is a symlink. This will solve an issue where files which are linked by
lerna or npm link are not transformed.

Currently a solution for this problem would be a configuration like:

{
  "transformIgnorePatterns": [
    "<rootDir>/node_modules/"
  ]
}

This will use the realpath to match the transformers in case the path
is a symlink. This will solve an issue where files which are linked by
lerna or npm link are not transformed.

Currently a solution for this problem would be a configuration like:
```json
{
  "transformIgnorePatterns": [
    "<rootDir>/node_modules/"
  ]
}
```
@cpojer
Copy link
Member

cpojer commented Dec 2, 2017

This is not passing unit tests.

@SimenB
Copy link
Member

SimenB commented Dec 2, 2017

Woo, 5000! 🎉

Should this use native realpath, similar to #4730?

In addition to fixing the failing test, I'd love to see a new test for it 🙂

@codecov-io
Copy link

Codecov Report

Merging #5000 into master will decrease coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5000      +/-   ##
==========================================
- Coverage   60.31%   60.28%   -0.04%     
==========================================
  Files         198      198              
  Lines        6662     6667       +5     
  Branches        4        4              
==========================================
+ Hits         4018     4019       +1     
- Misses       2644     2648       +4
Impacted Files Coverage Δ
packages/jest-runtime/src/script_transformer.js 84.52% <100%> (-1.98%) ⬇️

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 ea3fabc...85b3ef9. Read the comment docs.

@k15a
Copy link
Contributor Author

k15a commented Dec 4, 2017

@SimenB This is now using the native realpath implementation similar to #4730. I've seen that there is fs.realpathSync.native which seems more stable than process.binding('fs').realpath() but unfortunately this is not available in graceful-fs and because fs is replaced by graceful-fs I can't use it. This change also fixed all the unit tests.

Not sure how I could test this because I would have to mock process.binding('fs') as well.

@SimenB
Copy link
Member

SimenB commented Dec 4, 2017

fs.realpathSync.native is only in node 8, so we shouldn't use it yet anyways.

Not sure how I could test this because I would have to mock process.binding('fs') as well.

I don't want you to mock it, I want an integration which uses a symlinked module which shows that the issue you had previously is solved 🙂 (It might not be possible, I don't know for sure)

@k15a
Copy link
Contributor Author

k15a commented Dec 4, 2017

@SimenB I've added an integration test. Please let me know if I can do anything else.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

Thanks!

@cpojer cpojer merged commit b0b9387 into jestjs:master Dec 4, 2017
@k15a k15a deleted the realpath-to-match-transformers branch December 4, 2017 11:58
@SimenB
Copy link
Member

SimenB commented Dec 4, 2017

@k15a The test is failing on Windows.

can you send a PR skipping it on windows?

@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 13, 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.

5 participants