-
Notifications
You must be signed in to change notification settings - Fork 79
Version bumps causing problems with fake timers in tests. #20
Comments
Basically doing this: cd node_modules/webpack/node_modules/node-libs-browser ; npm i [email protected] Is how I'm fixing it right now, and it works. |
This should propably be fixed in simon or bluebird... Am I right? |
Perhaps, but I think this is an artifact coming from the "browserifying" of it. The |
For reference https://github.com/defunctzombie/node-process/blob/master/browser.js#L28 is the cause of the problem -- the old version in 0.8.0 used a much more clever way that avoided calling the sinon fake timer here: https://github.com/defunctzombie/node-process/blob/v0.8.0/browser.js#L14 |
I don't think this is the issue given https://github.com/petkaantonov/bluebird/blob/master/src/util.js#L280-L281 |
Also worth mentioning you can always tell bluebird explicitly how to schedule via |
@petkaantonov then why does installing process 0.8.0 again inside the webpack deps fix the problem? |
@gnarf can you provide a test case so we can play around with it? |
I didn't look into the real issue here, I was just pointing out that recent versions of bluebird check for authentic process object that cannot be faked without access to native v8 api. |
Oh - when did that check get added? Perhaps I'm still behind on bluebird somewhere. FWIW this test case fails: /* global sinon */
require('script!sinon/pkg/sinon');
describe.only('faketime', function() {
var timers;
beforeEach(function() {
timers = sinon.useFakeTimers();
});
afterEach(function() {
timers.restore();
});
it('can resolve a promise', function() {
return require('bluebird').resolve();
});
}); |
It's in 2.9.6+ |
sinon fake timers do stop |
Except that same test passes with process 0.8.0 instead of 0.10.0 --- it also passes with bluebird 2.9.13+ - so I think I know the answer -- dependency hunt time to figure out what isn't up to date with bluebird Sorry to take this up as an issue here instead of in bluebird! Thanks for the support @petkaantonov and @sokra |
I'm running into the same issue with when.js + webpack + sinon.useFakeTimers - all promises seem to break. Does bluebird do something extra to detect it's not actually a node env @gnarf ? |
Make sure to use latest bluebird?
|
Sorry, misread... Look at the scheduler code in bluebird. The node process
|
The new version bump for process 0.10.x is causing sinon fake timers + bluebird + webpack to make all bluebird promises "freeze" (because it's now using
setTimeout
instead of the other method it used to (mutation/etc selection process had in 0.8)Having a hard time figuring how how to undo this problem because webpack itself lists the dep on node-libs-browser to be
~0.4.0
and the bump here is definitely causing problems in all of our test suites that use sinon + bluebird.The text was updated successfully, but these errors were encountered: