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

Manual Mocks for scoped packages #1774

Closed
TLadd opened this issue Sep 22, 2016 · 2 comments

Comments

@TLadd
Copy link

commented Sep 22, 2016

Is it possible to create a manual mock for a scoped package? Since the file system doesn't allow for @scoped/package.js as a file name, I tried creating a @Scoped directory with a package.js file that exports a mock

node_modules
--@scoped
----package

__mocks__
--@scoped
----package.js

but I'm just getting the default jest mocking behavior when calling jest.mock('@scoped/package') within a test file.

@narkeeso

This comment has been minimized.

Copy link

commented Sep 22, 2016

I also just discovered that jest cannot discover a manual mock when the package is scoped like this or put into a scoped directory. Using Jest 15

I had to resort to mocking and stubbing out functions to return mock data.

@cpojer

This comment has been minimized.

Copy link
Contributor

commented Sep 23, 2016

Duplicate of #462. Unfortunately there are some bugs here but we are hoping to fix this soonish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.