Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jest-resolve] Prevent default resolver failure when potential resolu…
…tion directory does not exist Summary: A recent change to take precedence of NODE_PATH for module resolution (jestjs#4453) made this issue more likely to occur since NODE_PATH could contain non-existent directories. While this could have occurred prior to the change, it was less likely since it is more common that modules are in local `node_modules`. Either way, non-existent directories should be treated the same way as non-existent files during module resolution. The equivalent case for `statSync` returning `ENOENT` for files is `ENOTDIR` for directories. We may want to add `ENOTDIR` to `isFile` as well. Test Plan: 1. `yarn test` 2. Link cli into another project, set NODE_PATH to non-existent directories, no longer see cryptic `Cannot find module` error. Instead, it now resolves to a potential path further down the path list.
- Loading branch information