1.1.0 • Published 7 years ago
rnode v1.1.0
rnode
Make node become really random, useful when checking you have no race conditions.
This adds a random delay to the async fuctions in node's modules:
- fs
- dns
- child_process (exec and execFile only)
This random delay makes it much easier to spot if you are relying on timing of these async functions that might be working 90% of the time. A random delay can make it fail more like 1 in 2 times.
Installation
npm install rnodeUsage
The API is simply rnode(min, max), e.g.
const rnode = require('rnode');
rnode('100 ms', '1 second');You can pass either a string, as understood by the ms libarary, or a number of milliseconds. The defaults are 0 and 500ms.
License
MIT