testing-react-apps
testing-react-apps copied to clipboard
Error running tests
When cloning and using node setup an error happens when trying to start the tests.
Error message when running npm t
$ npm t
> [email protected] test MY_DIRECTORY\epic-react\testing-react-apps
> react-scripts test
Error: Failed to initialize watch plugin "node_modules/jest-watch-typeahead/filename.js":
● Test suite failed to run
file:///MY_DIRECTORY/epic-react/testing-react-apps/node_modules/jest-watch-typeahead/build/file_name_plugin/prompt.js:4
import { PatternPrompt, printPatternCaret, printRestoredPatternCaret } from 'jest-watcher';
^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'printPatternCaret' not found. The requested module 'jest-watcher' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'jest-watcher';
const { PatternPrompt, printPatternCaret, printRestoredPatternCaret } = pkg;
at async requireOrImportModule (node_modules/jest-util/build/requireOrImportModule.js:65:32)
at async watch (node_modules/@jest/core/build/watch.js:337:34)
at async _run10000 (node_modules/@jest/core/build/cli/index.js:311:7)
at async runCLI (node_modules/@jest/core/build/cli/index.js:173:3)
npm ERR! Test failed. See above for more details.
Setup message
$ node setup
▶️ Starting workshop setup...
Running the following command: npx "https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733" -q
npx: installed 1 in 6.363s
▶️ Starting: System Validation
Ensuring the correct versions of tools are installed on this computer.
Running the following command: npx "https://gist.github.com/kentcdoddsabbc32701f78fa70298d444c2303b6d9"
npx: installed 2 in 4.061s
✅ Success: System Validation
▶️ Starting: Dependency Installation
Installing third party code dependencies so the workshop works properly on this computer.
Running the following command: npm install --legacy-peer-deps --no-save
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my
best with it!
> [email protected] install MY_DIRECTORY\epic-react\testing-react-apps\node_modules\husky
> node husky install
husky > Setting up git hooks
husky > Done
> [email protected] postinstall MY_DIRECTORY\epic-react\testing-react-apps\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js
> https://patreon.com/zloirock
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
Also, the author of core-js ( https://github.com/zloirock ) is looking for a goo
d job -)
> [email protected] postinstall MY_DIRECTORY\epic-react\testing-react-apps\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
> [email protected] postinstall MY_DIRECTORY\epic-react\testing-react-apps\node_modules\hus
ky
> opencollective-postinstall || exit 0
Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate
> [email protected] postinstall MY_DIRECTORY\epic-react\testing-react-apps\node_modules\msw
> node -e "try{require('./config/scripts/postinstall')}catch(e){}"
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
added 1401 packages from 770 contributors and audited 1405 packages in 125.236s
198 packages are looking for funding
run `npm fund` for details
found 1 high severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
✅ Success: Dependency Installation
▶️ Starting: Project Validation
Running validation checks to ensure dependencies were installed properly
Running the following command: npm run validate -s
RUNS src/__tests__/final/05.extra-4.js
PASS src/__tests__/final/06.extra-2.js (5.714 s)
PASS src/__tests__/exercise/06.js
PASS src/__tests__/exercise/05.js (16.289 s)
PASS src/__tests__/exercise/02.js
PASS src/__tests__/final/05.js (17.162 s)
PASS src/__tests__/final/05.extra-1.js (17.21 s)
PASS src/__tests__/final/05.extra-3.js (17.648 s)
PASS src/__tests__/final/05.extra-2.js (17.596 s)
PASS src/__tests__/final/05.extra-4.js (18.525 s)
PASS src/__tests__/final/04.extra-3.js (11.293 s)
PASS src/__tests__/final/08.extra-3.js
PASS src/__tests__/final/03.extra-1.js
PASS src/__tests__/final/04.js
PASS src/__tests__/final/07.extra-2.js
PASS src/__tests__/final/04.extra-1.js
PASS src/__tests__/final/07.extra-3.js
PASS src/__tests__/final/06.js
PASS src/__tests__/final/03.js
PASS src/__tests__/final/07.extra-1.js
PASS src/__tests__/final/04.extra-4.js
PASS src/__tests__/final/08.extra-2.js
PASS src/__tests__/final/08.js
PASS src/__tests__/final/04.extra-2.js
PASS src/__tests__/exercise/04.js
PASS src/__tests__/exercise/08.js
PASS src/__tests__/exercise/03.js
PASS src/__tests__/final/06.extra-1.js
PASS src/__tests__/final/07.js
PASS src/__tests__/final/02.js
PASS src/__tests__/final/01.extra-1.js
PASS src/__tests__/final/01.js
PASS src/__tests__/exercise/01.js
PASS src/__tests__/final/02.extra-1.js
PASS src/__tests__/exercise/07.js
PASS src/__tests__/final/08.extra-1.js
Test Suites: 35 passed, 35 total
Tests: 48 passed, 48 total
Snapshots: 2 passed, 2 total
Time: 29.204 s
Ran all test suites.
Compiled successfully.
File sizes after gzip:
105.46 kB build\static\js\main.266a9c8b.js
1.21 kB build\static\js\878.e924fdb4.chunk.js
978 B build\static\js\304.7048674c.chunk.js
928 B build\static\js\704.0807f0c9.chunk.js
467 B build\static\js\456.dd9828aa.chunk.js
442 B build\static\js\400.860bd762.chunk.js
354 B build\static\js\48.e96fc3b5.chunk.js
312 B build\static\css\main.98c25710.css
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
npm install -g serve
serve -s build
Find out more about deployment here:
https://cra.link/deployment
✅ Success: Project Validation
▶️ Starting: Autofilling Email
Each exercise comes with a elaboration form to help your retention. Pr
oviding your email now will mean you don't have to provide it each time you fill
out the form.
Running the following command: npx "https://gist.github.com/kentcdodds
/2d44448a8997b9964b1be44cd294d1f5"
npx: installed 86 in 28.717s
? What's your email address? MY_EMAIL
Updated 8 files with the email MY_EMAIL
Committing changes for you so your jest watch mode works nicely
[main afee034] email autofill
8 files changed, 8 insertions(+), 8 deletions(-)
✅ Success: Autofilling Email
✅ Workshop setup complete...
Found a related issue: https://github.com/facebook/create-react-app/issues/11792
Workaround install and use node v16.15.0
Bummer. Looks like I may have to bump the minimum required node version to 16 until that issue is fixed.