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

fix: support duplicate installations #50

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

noomorph
Copy link
Collaborator

@noomorph noomorph commented Oct 11, 2023

Fixes a rare issue discovered while testing #4212.

outer_project
├── node_modules
│   ├── jest-metadata (1)
├── inner_project
│   ├── node_modules
│   │   ├── jest-metadata (2)

Sometimes, there might be duplicate jest-metadata installations, even if the version is the same.

This already creates a weird indeterministic behaviour, so this pull request improves the situation:

  1. it injects into non-sandboxed globalThis the entire jest-metadata's realm object
  2. it prefers that injected object anytime it can
  3. it issues a warning if the realm object has already been injected into non-sandboxed globalThis.

This doesn't guarantee deterministic behaviour, but at least users will see the warning in the logs, so this type of misconfiguration can be spotted without deep debugging.

@noomorph noomorph changed the title fix: support duplicate installations [WiP] fix: support duplicate installations Oct 11, 2023
@noomorph noomorph force-pushed the fix/support-duplicate-installations branch from 591c42e to c372242 Compare October 12, 2023 05:42
@noomorph noomorph changed the title [WiP] fix: support duplicate installations fix: support duplicate installations Oct 12, 2023
@noomorph noomorph merged commit 1282b3e into master Oct 12, 2023
5 checks passed
@noomorph noomorph deleted the fix/support-duplicate-installations branch October 12, 2023 06:45
@github-actions
Copy link

🎉 This PR is included in version 1.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant