getconfig
getconfig copied to clipboard
be more careful about the "test" environment
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.