getconfig icon indicating copy to clipboard operation
getconfig copied to clipboard

be more careful about the "test" environment

Open nlf opened this issue 3 years ago • 0 comments

it is extremely undesirable to run npm test and inadvertently use the wrong configuration because of forgetting to set NODE_ENV=test

we can use some npm provided environment variables to more forcefully prevent this. particularly npm_lifecycle_event, which will be set to the name of the script that's currently running. we'll likely want the condition that forces the environment to test to be process.env.npm_lifecycle_event.startsWith('test') since scripts like test:client and test:server are common.

nlf avatar Jun 21 '21 16:06 nlf