Sets NODE_ENV to 'test'
Last updated 6 years ago by naholyr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install env-test 
SYNC missed versions from official npm registry.


Set $NODE_ENV to "test".

Works best with mocha --require=env-test.


Because to force environment, I was used to add process.env.NODE_ENV = "test" at the beginning of every test file.

Because relying on Makefile or package.json to set this environment is almost always OK, but when one user just throws mocha in his terminal we don't want to punish him with data loss or any other hell.

Whereas relying on mocha.opts makes it easy (no more ugly line in each test file) and reliable (always loaded).


  • Install with npm install --save-dev env-test
  • Edit test/mocha.opts and add the line --require=env-test

Current Tags

  • 1.0.0                                ...           latest (6 years ago)

1 Versions

  • 1.0.0                                ...           6 years ago
Maintainers (1)
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 9
Dependencies (0)
Dev Dependencies (0)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |