node-vasync
node-vasync copied to clipboard
Add VASYNC_MODE=direct setting
Some mockup libraries (like testdouble) makes it easy to turn synchronous code into synchronous code (for easier testing).
By default, vasync breaks synchronous flow by calling callbacks inside a setImmediate block.
While this is desirable in production (generally also when running tests), it is also useful to let the user disable this behavior when required.
Note, a side effect of this PR is also to stop defining setImmediate() globally when it's not already defined.