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

Can't mock require.resolve() using mocks.loadFile() #19

Open
nickserv opened this issue Dec 14, 2016 · 0 comments
Open

Can't mock require.resolve() using mocks.loadFile() #19

nickserv opened this issue Dec 14, 2016 · 0 comments

Comments

@nickserv
Copy link

The code I was testing relies on Node's built in require.resolve() function, running it before the module is imported. Unfortunately, since this library replaces require() and calls the module immediately before replacing custom mocks, I was unable to stub require.resolve() using loadFile()'s mocks or globals arguments.

For anyone also having this problem, I'm using proxyquire (which is similar to mocks.loadFile()) as a workaround.

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

No branches or pull requests

1 participant