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

Ensure test modules can require.resolve absolute paths #11943

Merged
merged 2 commits into from Oct 9, 2021

Commits on Oct 9, 2021

  1. 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 jestjs#11927.
    airhorns committed Oct 9, 2021
    Copy the full SHA
    52bd70f View commit details
    Browse the repository at this point in the history
  2. Update CHANGELOG.md

    SimenB committed Oct 9, 2021
    Copy the full SHA
    7ac3233 View commit details
    Browse the repository at this point in the history