react-scripts v5 type checks test files when running start command
Created by: jwalton9
Describe the bug
When upgrading to react-scripts v5, and running react-scripts start
or react-scripts build
any .test.ts
or .spec.ts
file with type errors are reported to the build process and the build fails.
Did you try recovering your dependencies?
I started a fresh project to reproduce the error and the bug still exists
Which terms did you search for in User Guide?
Typescript, types, tests.
Environment
Environment Info:
current version of create-react-app: 5.0.0
running from /Users/joewalton/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: macOS 12.0.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 16.13.1 - ~/.asdf/installs/nodejs/16.13.1/bin/node
Yarn: 1.22.17 - ~/.asdf/installs/nodejs/16.13.1/.npm/bin/yarn
npm: 8.1.2 - ~/.asdf/installs/nodejs/16.13.1/bin/npm
Browsers:
Chrome: 97.0.4692.71
Edge: Not Found
Firefox: Not Found
Safari: 15.1
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: ^5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
- Create a new create-react-app using the typescript template.
npx create-react-app my-app --template typescript
- Add a type error to
src/App.test.tsx
- run
npm run build
Expected behavior
Type errors should be ignored in test files when running or building app code.
Actual behavior
Type errors are reported in test files when running or building app code.