Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
mocking lib for process.hrtime
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
tests
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

hrtimemock

Build Status

NPM

NPM

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

hrtimemock(mstime)

monkeypatches process.hrtime and for the second call returns the elapsed time specified by mstime in the familiar array form.

  • mstime time in milliseconds

Example

var hrtimemock = require('hrtimemock');

hrtimemock(1000);

var a = process.hrtime();
var elapsed = process.hrtime(a);

console.log(elapsed); //will output [1,0]

Notice:

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

Something went wrong with that request. Please try again.