Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.6k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...