Skip to content
This repository was archived by the owner on Mar 15, 2021. It is now read-only.

Fix: reRequiring files with naming collisions with mock-require#37

Open
treygriffith wants to merge 3 commits intoboblauer:masterfrom
treygriffith:fix/local-collision
Open

Fix: reRequiring files with naming collisions with mock-require#37
treygriffith wants to merge 3 commits intoboblauer:masterfrom
treygriffith:fix/local-collision

Conversation

@treygriffith
Copy link

This change fixes #36 by making require.resolve explicit in where it is resolving from. It therefore prevents collisions with files in mock-require, which are themselves in the NODE_PATH, triggering the isInPath condition to return the mock-require file.

To illustrate the change I moved the module itself to the NODE_PATH for the test.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reRequiring index files returns startMocking

1 participant