-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Karma + Karma-bro + proxyquireify don't get along #15
Comments
It looks ok to me except I don't see where you register it as a plugin with browserify, i.e. like here |
here, in the Karma conf |
Ok, so as long as this plugin gets added to browserify and karma doesn't mess with the prelude and/or the You could trouble shoot this by debugging the tests and/or reading the relevant parts of your bundle. |
https://github.com/thlorenz/proxyquireify/blob/master/index.js#L70-L72 sets the https://github.com/thlorenz/proxyquireify/blob/master/index.js#L71 uses the original require. Shouldn't it call I'll test it and PR if relevant. |
For greater details, here's my complete bundle (proxyquireify with the aforementioned changes): https://gist.github.com/xcambar/906c17cdf6fb8a8bdbdc There's obviously something missing, but for the moment, I can't figure out what. |
I don't have time to look at this right now. Hopefully someone else can help you figure this out in the meantime, maybe @jhiesey? |
I think the problem is caused by the reset method being called on the browserify instance, which creates a new pipeline that doesn't have the proxyquireify replacement prelude spliced in. This changes made in this commit seem to pass your test: ellbee@fdbb2da |
I am also getting the same issue when trying to rebundle with |
Your test repo works for me with the changes from my commit if I move the plugin registration out from the bundle function, so it only registers it once. If I leave the plugin registration inside the plugin function I get a gulp error on rebundle. |
Thanks @ellbee! That worked, much appreciated. |
@ellbee is there any patch we can pull in here? Do you mind providing a PR? I'm happy to pull this in as long as it doesn't break current behavior. |
Awesome ! |
is there any way to use these changes in order to swap between a proxyquire wrapper and proxyquireify when karma-bro browserifies tests? i'm in a situation where this:
works in node and this
works in the browser but i can't seem to make karma-bro swap the wrapper for proxyquireify for me. thanks! |
I use karma-bro with proxyquireify through https://github.com/bendrucker/proxyquire-universal. You can use it with karma-bro by simply adding this to your karma configuration. browserify: { debug: true, plugin: ['proxyquire-universal'] } |
Very cool @beckyconning. Thanks a lot! |
I've got exactly the same issue with the current versions of proxyquire: I checked the @xcambar git repo and applying patch or updating the proxyquirefy to current isn't solving the issue. Ps. sorry for digging up the thread ;) |
Because this issue is pretty ancient, I have to ask that you open a new one if you think you've found a legitimate bug. This is in large part in fairness to the original contributors to the discussion who shouldn't be forced to unsubscribe from notifications on a 3 year old thread. It's possible a major version of browserify or karma* broke something. To start we'll need a project (public repo) that we can clone, run |
Hi,
I've been struggling for a day with trying to have proxyquireify in Karma with Karma-bro.
In a few words: Proxyquireify adds the authentic
require
calls so Browserify bundles them, but it seems that the prelude is not changed so the mocked modules are not loaded.Here's a example repo: https://github.com/xcambar/karma-bro-proxyquireify
Did I do something wrong? What do you think?
/cc @nikku because I feel like Karma-bro might be involved in this situation.
The text was updated successfully, but these errors were encountered: