You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix NODE_PATH resolving for relative paths (jestjs#3616)
* Add failing integration test for relative NODE_PATH
It is failing because babel-jest traverses directories up searching for package.json, but the path is relative.
It is exposing the underlying issue that NODE_PATH can be relative, but the code assumes all paths are absolute by that point.
* Resolve NODE_PATH to absolute paths
This fixes the issue because the rest of the code assumes the path is already absolute.
We also resolve symlink if necessary.
* Fix unrelated test to match the code
This test started failing, but it was not testing NODE_PATH in the first place.
It just happened to include its output, and it's not empty on Travis.
The test used to have some copy pasta from how we calculate nodePaths, so I just synced that copy pasta.
* Nitty nit
* Exclude empty items from the array
They are empty if NODE_PATH is empty, and split() returns [''].
* fs.realpathSync() can return undefined
* Fix test to match last change
0 commit comments