Comments (16)
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.
from node-libs-browser.
This should propably be fixed in simon or bluebird... Am I right?
from node-libs-browser.
Perhaps, but I think this is an artifact coming from the "browserifying" of it. The process.nextTick
implementation in process could hold onto the "real" setTimeout and call it. Or maybe bluebird could do a better job of detecting fake node "process" and revert back to using mutation observers? CC @petkaantonov
from node-libs-browser.
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
from node-libs-browser.
maybe bluebird could do a better job of detecting fake node "process"
I don't think this is the issue given https://github.com/petkaantonov/bluebird/blob/master/src/util.js#L280-L281
from node-libs-browser.
Also worth mentioning you can always tell bluebird explicitly how to schedule via Promise.setScheduler
- although like Petka said it's not bluebird misdetecting here.
from node-libs-browser.
@petkaantonov then why does installing process 0.8.0 again inside the webpack deps fix the problem?
from node-libs-browser.
@gnarf can you provide a test case so we can play around with it?
from node-libs-browser.
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.
from node-libs-browser.
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();
});
});
from node-libs-browser.
It's in 2.9.6+
from node-libs-browser.
sinon fake timers do stop process.nextTick
until you call timers.tick(ms)
, if I get the documentation correctly...
from node-libs-browser.
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
from node-libs-browser.
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 ?
from node-libs-browser.
Make sure to use latest bluebird?
On Apr 24, 2015 10:37 AM, "Karolis Narkevicius" [email protected]
wrote:
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
https://github.com/gnarf ?—
Reply to this email directly or view it on GitHub
#20 (comment)
.
from node-libs-browser.
Sorry, misread... Look at the scheduler code in bluebird. The node process
object has a special to string value so you can detect it is node
On Apr 24, 2015 10:38 AM, "Corey Frang" [email protected] wrote:
Make sure to use latest bluebird?
On Apr 24, 2015 10:37 AM, "Karolis Narkevicius" [email protected]
wrote: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
https://github.com/gnarf ?—
Reply to this email directly or view it on GitHub
#20 (comment)
.
from node-libs-browser.
Related Issues (20)
- The Elliptic package 6.5.2 for Node.js allows ECDSA signature malleability via variations in encoding, leading '\0' bytes, or integer overflows.
- The new version of readable-stream is incompatible HOT 1
- New version of stream browser/ index.js
- dependencies:{"readable-stream": "^2.3.3" } in package.json ,have a mistake in building project HOT 1
- Deprecate the npm package? HOT 1
- good idea why stop develop
- bump url dependency module version to remove querystring dependency
- 请求报错 code: MissingDateHeader
- crypto-browserify needs help
- console polyfill outdated
- Incompatibility between Node.js core libs and webpack's lib HOT 4
- Publish on npm already! HOT 1
- Old path-browserify is very slow on long pathnames (should I say ReDoS'able?) HOT 1
- Module not found: Can't resolve 'util' HOT 2
- process.nextTick polyfill is slow when tab is unfocused
- buffer 4.9.1 can cause errors
- why has this become deprecated? HOT 8
- Compatibility with new readable-stream HOT 3
- TypeError: The "original" argument must be of type Function HOT 5
- path-browserify 0.X won't support path.parse method HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-libs-browser.