I am trying to set up a Node Express server with some basic routes and I have some unit tests to run against them. But when I try to run the tests I get the following error.
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
The npm scripts for the same are
"test": "NODE_ENV=testing jest --forceExit --detectOpenHandles --silent",
"test-routes": "npm run test -t router",
I am on a Windows machine, using Visual Studio Code with its integrated terminal pointing to Git-Bash.
I thought since I am using git-bash, NODE_ENV=testing
should work automatically. But it doesn't.
When I change the script to
"test": "SET NODE_ENV=testing jest --forceExit --detectOpenHandles --silent",
the error goes away but tests are not running.
$ yarn test-routes
yarn run v1.17.3
$ npm run test -t router
> api-design-v3@1.0.0 test D:\learning_workspace\api-design-node-v3
> set NODE_ENV=testing jest --detectOpenHandles "router"
Done in 1.70s.