3 ms·
Yeah, I'm aware I can do that, but it gets a bit painful for code that is stateful & executes on load (like IIFE does). You end up having to write a separate te
by bazzargh 14y ago
Yeah, I'm aware I can do that, but it gets a bit painful for code that is stateful & executes on load (like IIFE does). You end up having to write a separate test script to run in a separate process for each test case...way slower than if you can isolate the module and 'restart' it in a closure for each test.
A different approach that might work for me would be to subvert require.js, so that it pulls in mocks. I see there's other people thinking along the same lines:
https://github.com/tigbro/requirejs-factory-plugin https://github.com/tigbro/requirejs-factory-plugin