Created by: jwalton9
This PR fixes react-scripts@5 including test files when type checking during npm start and npm build. This was changed in the upgrade to webpack@5 https://github.com/facebook/create-react-app/pull/11201/files#diff-8e25c4f6f592c1fcfc38f0d43d62cbd68399f44f494c1b60f0cf9ccd7344d697R732 however the syntax does not exclude .spec and .test files.
There is a reproduction repo at https://github.com/jwalton9/cra-test-type-error which introduces a type error to src/App.test.tsx. Running npm start causes these issues to be reported.
The changes were validated by using npm link and running npm start
Fixes #11979