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

Module identity is not preserved for symlinks when using the browser package.json field #9510

Closed
rtsao opened this issue Feb 3, 2020 · 2 comments Β· Fixed by #9511
Closed

Module identity is not preserved for symlinks when using the browser package.json field #9510

rtsao opened this issue Feb 3, 2020 · 2 comments Β· Fixed by #9511

Comments

@rtsao
Copy link
Contributor

rtsao commented Feb 3, 2020

πŸ› Bug Report

Jest fails to preserve module identity for symlinks when using the browser package.json field.

To Reproduce

Suppose we have the following dependency graph and these packages are installed via symlinks:

           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚reproduction-exampleβ”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
         β”‚            β”‚
         β–Ό            β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚has-browser-fieldβ”‚   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
         β”‚            β”‚
         └─────────────
                      β”‚
                      β–Ό
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚needs-preserved-idβ”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Jest erroneously treats reproduction-example/needs-preserved-id and reproduction-example/has-browser-field/needs-preserved-id as distinct modules if has-browser-field specifies a browser field and the browser: true Jest config option is used.

If browser: false, then module identity is preserved as expected (#4761).

Expected behavior

Module identity should be preserved for symlinks when browser: true.

Link to repl or repo (highly encouraged)

Minimal repository: https://github.com/rtsao/jest-bug-repro-preserve-symlinked-module-ids

This reduced example demonstrates module identity being preserved correctly with browser: false but not with browser: true

envinfo

  System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
  Binaries:
    Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
  npmPackages:
    jest: ^25.1.0 => 25.1.0
@rtsao
Copy link
Contributor Author

rtsao commented Feb 3, 2020

Found a duplicate issue: #7840

@github-actions
Copy link

This issue 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 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant