Issue
I'm working on a Node.js project and using Jest as the test framework. This project runs on Windows as it happens, and I'm having a heck of a time setting more than one environment variable on the command line.
Here's the relevant line in package.json
"scripts": {
"test": "SET NODE_ENV=test & SET DB_URI=postgresql://<database stuff>> & jest -t Suite1 --watch --verbose false"
},
As can be seen above, I'm setting both a NODE_ENV
and DB_URI
environment variable prior to running jest
via npm run test
.
My problem is the that DB_URI
environment variable doesn't appear to be set when jest runs. The error I get back from jest makes it obvious it can't find it. I do know that the first, NODE_ENV
environment variable is set ok, but am not sure what's wrong with the second one, did I get the syntax wrong somehow? Is anyone with jest experience on Windows doing something similar to what I'm trying?
Solution
Just make the following change:
Use &&, also you need to remove the white space before and after the "&&".
"scripts": {
"test": "SET NODE_ENV=test&&SET DB_URI=postgresql://<database stuff>>&&jest -t Suite1 --watch --verbose false"
},
Answered By - Prabhjot Singh Kainth Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.