-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure test modules can
require.resolve
absolute paths.
Before this change, the runtime's `require.resolve` function would always try to resolve paths relative to the passed `paths` option. This prevents requiring paths which are absolute! Normal node `require.resolve` is fine requiring absolute paths, including when passed `{ paths: [] }`, so this updates the jest require algorithm to detect absolute paths and handle them without trying to make the path relative to the passed `paths` option. This is similar to how node's own require.resolve works, see https://github.com/nodejs/node/blob/05002373176e8758c8c604f06659e171de4ca902/lib/internal/modules/cjs/loader.js#L240-L241 Fixes #11927.
- Loading branch information
Showing
3 changed files
with
79 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters