-
Notifications
You must be signed in to change notification settings - Fork 31
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
Documentation Needed: jest.mock Equivalent #126
Comments
First of all - I could just agree that documentation is crap. It is. No surprise. Secondly - from Keep in mind - It will not work with Speaking of 👉 speaking about of |
As a fellow open source maintainer, thank you for spending your time on this project.
That said, I'm really struggling with the format and verbiage in the documentation. It's very hard to parse, and the punctuation and structure is hard to read. I'd highly recommend breaking it up into multiple, short, focused documents that are linked with a table of contents on a main README.
With regard to Jest, the README states:
jest.mocks - jest is awesome. As well as rewiremock.
and earlier versions of it statedjest.mocks - Jest is awesome. But rewiremock can do the same.
Both are super confusing and vague. Does this work the same as all aspects of Jest, is it a 1:1 comparison in terms of functionality, or does rewiremock only support some of the same functionality? I don't think these statements are adding to your README and the developer experience. To the contrary, I think it's adding confusion to your documentation.Going further into the README with the
jest-like
section (https:/theKashey/rewiremock#jest---like) it would appear that there's 1:1 functionality withjest.mock
, which is awesome. Unfortunately, in my testing of this I found that relative dependencies required from other files don't seem to be mocked - this is something thatjest.mock
supports out of the box. Here's my test setup:bar.js
foo.js
rewire.js
- this is executed withnode rewrire.js
This results in printing
42
and not{}
as I would expect. Further, if I moverewire.js
up a directory in the tree, I'll get aMODULE_NOT_FOUND
error (requiring me to change the target of the mock to../foo.js
). All of this behavior is counter to what I would get usingjest.mock
, and thus confusing. The documentation doesn't contain any direct instructions on how to make this very direct jump fromjest.mock
torewiremock
, and it's a darn shame.The text was updated successfully, but these errors were encountered: