fake-env

1.0.0 • Public • Published

fake-env

Fakeout your environment variables, maybe for your tests.

Example

test('fakeout $HOME', (assert) => {
  assert.equal(process.env.HOME, '/Users/rclark', 'yep, that is correct');
 
  const env = new FakeEnv({
    HOME: '/tricked/you'
  });
 
  assert.equal(process.env.HOME, '/tricked/you', 'ooooh its been mocked!');
 
  env.restore();
 
  assert.equal(process.env.HOME, '/Users/rclark', 'restored to normal');
 
  assert.end();
});

Readme

Keywords

none

Package Sidebar

Install

npm i fake-env

Weekly Downloads

415

Version

1.0.0

License

ISC

Last publish

Collaborators

  • rclark