To test with different kinds of env vars in different unit tests we need to do the following.
- set up the vars on
process.env.NODE_ENV
- run the test
- reset it
Step three is very important since process.env
is a global variable, we want to make sure that when every test uses it, it returns what is expected.