I have a couple of Jest tests running in my NodeJS application that is configured to extract a dbConnString
setting from config, using node-config.
I have a test.json file that specifies a dbConnString
value (this is the one I expect the Jest tests to use). I also have a custom-environment-variables.json
file that contains mappings of keys to environment variables that contain the actual connection strings to use for my dev environment.
What I'm finding is that the Jest tests are using the said environment variables mapped in custom-environment-variables.json
. How can I force the Jest tests to use the dbConnString
setting defined in test.json
?
I have confirmed that in a test the process.env.NODE_ENV
does return test
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…