googlearchive/node-big-rig

Only mock browser host objects briefly, and restore afterwards

Closed this issue · 8 comments

Hey Paul. Thanks for Bigrig - loving it!

One little quibble: I have it hooked up to a webdriver test suite which happens to use Mocha. Faking the browser environment in global-config.js makes sense, but it causes Mocha to run in 'browser' rather than 'Node' mode, and things break very unexpectedly (took me an hour to get this far!).

I wonder if it'd be possible to stub the browser environment only just before running the trace viewer, and then restoring them as they were after it's run. I'm not even calling bigrig at this stage - just requiring the project is enough to break Mocha.

I regrettably don't have time for a PR right now, but if you agree, I might be able to look into it. It has to be low priority for me, unfortunately.

Cheers

That makes perfect sense! Let me have a look this afternoon.

The change is in; all tests are passing, so I'll push a new version to npm.

OK, 0.1.10 is published. Can you confirm it no longer clobbers your stuff?

Hmm - NPM has it as 1.0.10, but the tag here is 0.1.10. Might want to look at that.

Sorry, 1.1.10. Fixed the release... might have done that hastily.

It's fixed for me. Many thanks for jumping on it so quickly.

No worries; thanks for a good bug report!