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

Enable manual mocks with nested folders #2475

Closed
MicheleBertoli opened this issue Dec 30, 2016 · 4 comments
Closed

Enable manual mocks with nested folders #2475

MicheleBertoli opened this issue Dec 30, 2016 · 4 comments

Comments

@MicheleBertoli
Copy link
Contributor

I know that previous issues around this topic have been closed but I spent some time investigating (mainly to learn something new).
I found out that tweaking the value returned from getMockName makes the mocks with nested folders work and the tests (except one) are still green.

I'm pretty sure I'm missing something but, if the method, given the following path:
'/fruits/__mocks__/subdir1/blueberry.js'

returns this:
'subdir1/blueberry'

instead of this:
'blueberry'

everything seems to work apart from the "warns on duplicate mock files" test (which is ok because the mocks are not duplicated anymore, being in different subdirs).

If I'm on the wrong path and/or you are not interested in going further please tell me.
Otherwise, I'll be more than happy to submit a PR and show you the changes I made.
Thanks!

@cpojer
Copy link
Member

cpojer commented Dec 30, 2016

I think I'd be supportive of such a change. This would be for dependencies in node_modules specifically, right?

@MicheleBertoli
Copy link
Contributor Author

Thanks @cpojer.
As far as I understand, it applies to all the manual mocks.
I'm going to put a PR in a few minutes.

@cpojer
Copy link
Member

cpojer commented Jan 3, 2017

Closing this in favor of the PR (I'll get to it next week).

@cpojer cpojer closed this as completed Jan 3, 2017
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
@SimenB SimenB removed the Question label Feb 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants