hrtimemock

mocking lib for process.hrtime

hrtimemock

hrtimemock is a mocking function that causes process.hrtime to output what ever time should have elapsed.

var hrtimemock = require('hrtimemock');
 
hrtimemock(1000);
 
var a = process.hrtime();
var elapsed = process.hrtime(a);
 
console.log(elapsed); //will output [1,0]

Works only for a pair of process.hrtime calls. After that it has to be called again.