I have used the following command :
npx create-react-app fresh-cra && cd fresh-cra
to create a fresh copy of a Create React App (CRA).
But when I run npm test
as suggested in the instructions that
follow, it gives me an error :
● Test suite failed to run
Frustratingly, there is no additional information about the error.
^ click to enlarge
How can I work around this error?
After searching the internet for days, I finally found the question Jest from create-react-app not running on Windows which seems to report the exact same error, but for Windows 8.1. 1
Just as the asker of that question, I'm baffled. Not only by the error, but also by the time that has passed since then. Is it really true that after more than three years, the same error still prevails – without anyone in the Create React App team having fixed this bug? 2
Don't get me wrong. I'm a big fan of the create-react-app npm package.
But if this is a Windows-only bug, I honestly cannot help feeling a bit bullied for being on Windows.
Does anyone on Linux or macOS get this same error when running
npm test
on a fresh Create React App?
Support for the experimental syntax 'jsx' isn't currently enabled
Since npm test
didn't work, I felt inclined to run Jest directly,
so I tried the npx jest
command.
3
But this answer says that a Create React App is
not configured out-of-the-box to run the jest
command.
So that appears to be a dead-end alley that I don't want to try.
References
- Create React App (CRA)
- Jest from create-react-app not running on Windows
- The create-react-app npm package
- Delightful JavaScript testing
- Answer to Jest on a Create React App not running on Windows
1 When I first wrote this question, I was on Windows 10, version 21H2.
2 Or is it the Jest team that doesn't reach up to standards?
3 As did the asker of Jest from create-react-app not running on Windows.