Closed jamestalmage closed 9 years ago
Given the range of setups where people have seen this I'm wondering whether it's related to any of these transforms at all. I'm inclined to think it might just be a race condition that only comes up for expensive transforms (esp. ones that parse and walk the AST). That would apply to both proxyquireify (which this issue should also exist with when used directly) and b-shim for sure. Digging in to your reproduction now. Thanks for the clear report as always.
I'm actually able to get an error right away if I save any file from ./src
, i.e. something added to the bundle by a require
instead of by karma-browserify. This looks suspiciously like https://github.com/thlorenz/proxyquireify/issues/21.
Yup, thought you fixed that ;)
See latest commits. Also broken in proxyquireify.
That would make sense. proxyquireify-universal is swapping in proxyquireify before any of this stuff should be happening. We can just keep this issue open.
I've tracked it down. It's closely related to thlorenz/proxyquireify#21. Fix is coming.
Because proxyquire-universal uses peerDeps, you should always be running npm i -D proxyquire-universal proxyquireify proxyquire
. So just switch up proxyquireify to thlorenz/proxyquireify#5762d478a22bb76807e3b92a3b881c42686b3b69
temporarily and you should be good.
awesome. I'm still seeing an occasional weird double run - but no test failures.
you should always be running
npm i -D proxyquire-universal proxyquireify proxyquire
yup, repo was built in haste
Added a comment to the readme about installing. Right now peerDeps auto installed but somewhere an npm employee mentioned that peerDeps are eventually going to just be warnings.
The double run is on karma-browserify's end. I've never been able to properly track that down.
I still get this 'require is undefined' issue when I install deps via:
// Did not work
npm i -D proxyquire-universal proxyquireify proxyquire
However... This worked:
// Did work
npm i -D proxyquire-universal thlorenz/proxyquireify#5762d478a22bb76807e3b92a3b881c42686b3b69 proxyquire
Forgive my lack of npm-fu here... But I'm assuming we're just waiting on @bendrucker's proxyquireify fix to be published to npm before the 1st snippet will work?
correct
Just pinged Thorsten to release p-ify
published
Repo demonstrating the problem here (see the Readme): https://github.com/jamestalmage/karma-browserify-proxyquire-issue
Possibly related to these issues:
When it fails it seems to run twice; Once correctly, then with the following error:
I do see it occasionally run twice per save, even on the
no-proxyquire
branch, so there may be underlying issues further up the tool chain. I've got a moderately larger project (5 source files, 3 test files, 44 tests), that also usesbrowserify-shim
to requireangular
. The problem reproduces with far more regularity in that project. I originally tried a test project using onlybrowserify-shim
to require angular, and could not reproduce the error.Console dump: