-
Notifications
You must be signed in to change notification settings - Fork 3
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Jest compatibility #5
Comments
Doesn't look like there is anything wrong with this module, it's more of a request-promise-core / jest issue. EDIT: In jest |
Hey @t1bb4r , I am curious nonetheless. Since the code is working in node without Jest I am wondering what difference Jest makes. In your Jest version do you still execute it within node or somewhere else like in the browser? Do you use transpilers like babel? And packagers like webpack or browserify? |
I'm using Jest has a mocking feature where you can mock any import, this feature is probably the reason they keep their own module registry. |
Alright, I see. They are passing their own But thinking outside the box: You want to test your |
Its tough to say exactly what all the libraries I'm including uses internally and when they will conflict, but you are right, if we can manage to only use the core module once everything is ok. The first time I started to run into this issue was when I installed a module which depends on "request-promise", while I'm using "request-promise-native". These imports, no matter how deep in your dependency tree, will break jest. Either way, thanks a lot for the help and feedback. I'll manage to workaround the issue. |
You are welcome buddy. One last tip: You can check with |
Jest is a great test runner and I'm trying to use it with request-promise in my current project. The problem is this module isn't working with jest.
Here is a minimal example:
reusable.js
:users.js
:__tests__/users.js
:This actually works in node, when I require the users module I get two unique ids. Just not working with jest, so I can understand if you don't consider this a bug.
Side-note: I don't understand how I can be the only one using jest and request, each have over 10 000 stars on github.
The text was updated successfully, but these errors were encountered: