intro-to-graphql icon indicating copy to clipboard operation
intro-to-graphql copied to clipboard

Cannot run lesson-2 tests

Open MrSamsa42 opened this issue 5 years ago • 2 comments

I am not able to run the tests associated with lesson 2. See terminal output below. Environment is Windows 10, Node 12.10

npm run test-schema

[email protected] test-schema C:\Users\mrsam\Projects\Education\intro-to-graphql GQL_LESSON=lesson-2 npm test -- -t lesson-2

'GQL_LESSON' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] test-schema: GQL_LESSON=lesson-2 npm test -- -t lesson-2 npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] test-schema script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\mrsam\AppData\Roaming\npm-cache_logs\2019-11-03T21_38_39_591Z-debug.log

MrSamsa42 avatar Nov 03 '19 21:11 MrSamsa42

It took forever, but I found the solution. Stack Overflow to the rescue (again): https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows

So, change the script in the package.json file to:
"test-schema": "set GQL_LESSON=lesson-2 && npm test -- -t lesson-2"

MrSamsa42 avatar Nov 05 '19 04:11 MrSamsa42

It should be: "test-schema": "cross-env GQL_LESSON=lesson-2 npm test -- -t lesson-2"

peerhenry avatar Dec 24 '19 17:12 peerhenry