Search code examples
testingjestjscreate-react-app

Did I run create-react-app correctly to test?


I'm trying create-react-app for testing but can't get it to work.

npx create-react-app tester
cd tester
yarn
yarn test

OUTPUT:

yarn run v1.13.0
$ react-scripts test
Done in 0.59s.
terry@terry-sharewalker:~/myProjects/tester$ 

I thought I read that CRA starts in "watch mode", but it just jumps back to my cursor. Isn't is supposed to run something? I see a test in the src/ folder called App.test.js. But is it running? How can I test that the test is running?

EDIT -- HERE'S MY ENVIRONMENT INFO:

npx create-react-app testing --info npx: installed 63 in 11.717s

Environment Info:

System: OS: Linux 4.15 Ubuntu 16.04.5 LTS (Xenial Xerus) CPU: x64 Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz Binaries: Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node Yarn: 1.13.0 - ~/.nvm/versions/node/v10.15.3/bin/yarn npm: 6.9.0 - ~/.nvm/versions/node/v10.15.3/bin/npm Browsers: Chrome: 68.0.3440.106 Firefox: 64.0 npmPackages: react: Not Found react-dom: Not Found react-scripts: Not Found npmGlobalPackages: create-react-app: Not Found


Solution

  • After days of struggling with this I updated a whole slew of things on my system. node, npm, yarn, mocha, and all the packages installed globally with both npm and brew. This fixed it.