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();
});

/fake-env/

    Package Sidebar

    Install

    npm i fake-env

    Weekly Downloads

    977

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • rclark