Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/byteclubfr/node-env-test
Set $NODE_ENV to "test" works best with mocha --require=env-test
https://github.com/byteclubfr/node-env-test
Last synced: 1 day ago
JSON representation
Set $NODE_ENV to "test" works best with mocha --require=env-test
- Host: GitHub
- URL: https://github.com/byteclubfr/node-env-test
- Owner: byteclubfr
- License: mit
- Created: 2014-07-15T14:16:20.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-15T14:21:54.000Z (over 10 years ago)
- Last Synced: 2024-08-09T20:10:30.509Z (3 months ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 37
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
node-env-test
=============Set `$NODE_ENV` to "test".
Works best with `mocha --require=env-test`.
Why?
----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).
How?
----* Install with `npm install --save-dev env-test`
* Edit `test/mocha.opts` and add the line `--require=env-test`