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 · 3 comments
Closed

Manual Mocks for scoped packages #1774

TLadd opened this issue Sep 22, 2016 · 3 comments

Comments

@TLadd
Copy link

@TLadd TLadd 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
Copy link

@narkeeso narkeeso 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.

Loading

@cpojer
Copy link
Collaborator

@cpojer cpojer commented Sep 23, 2016

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

Loading

@github-actions
Copy link

@github-actions github-actions bot commented May 14, 2021

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.

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants