mock-os

1.0.0 • Public • Published

mock-os

mock-os is a testing module for the os core module in Node.js.

Installation

npm install --save-dev mock-os

Example

The code below makes it so the os module can output fake system metrics.

var mock = require('mock-os');

mock({
  'freemem': 100000,
  'loadavg': [2, 2, 2],
  'homedir': '/Users/username'
});

When you are ready to restore the os module to its original behavior, call mock.restore().

// after a test runs
mock.restore();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    199
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    199
  • 0.1.0
    2
  • 0.0.1
    111

Package Sidebar

Install

npm i mock-os

Weekly Downloads

312

Version

1.0.0

License

MIT

Unpacked Size

5.48 kB

Total Files

5

Last publish

Collaborators

  • lfortin