Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install enzyme and add starter test for Show component #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alcamerone
Copy link
Collaborator

Also delete the default test from CRA. Not entirely sure why it wants to rip out half your package-lock... Conflicting npm versions, perhaps...

@d-lord
Copy link
Owner

d-lord commented Jul 23, 2022

Thanks for the example! Running OK on my end, and looks green 😎

Yeah, seems like a version conflict - when I checked it out and ran npm install, it restored those packages and went back to "lockfileVersion": 2. npm -v says 8.13.2 for me, you?

@d-lord
Copy link
Owner

d-lord commented Jul 31, 2022

Ping 😄 I'm hoping this can be merged somehow without the lockfile change - it seems like we should be able to just add enzyme and a couple of test files, without having to overhaul the whole package-lock.

@alcamerone
Copy link
Collaborator Author

@d-lord have upgraded my Node version to match yours, looks a little more agreeable now haha

@d-lord
Copy link
Owner

d-lord commented Aug 2, 2022

Thanks! npm install is giving me a resolution conflict now 🤕 It seems like enzyme-adapter-react-16 is for, well, React 16, and Twinkler is currently using 18. Doesn't seem like an 18 version of the adapter exists, at least not officially. How did you get it to work? Maybe from a fresh checkout?

$ git checkout add-enzyme
$ npm install
# nope! chuck testa, see below

$ rm -rf node_modules
$ npm install
# same again
Full run log
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: airbnb-prop-types@2.16.0
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN   react@"^18.2.0" from the root project
npm WARN   5 more (@testing-library/react, react-dom, react-router, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14 || ^15.0.0 || ^16.0.0-alpha" from airbnb-prop-types@2.16.0
npm WARN node_modules/airbnb-prop-types
npm WARN   airbnb-prop-types@"^2.16.0" from enzyme-adapter-utils@1.14.0
npm WARN   node_modules/enzyme-adapter-utils
npm WARN 
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^0.14 || ^15.0.0 || ^16.0.0-alpha" from airbnb-prop-types@2.16.0
npm WARN   node_modules/airbnb-prop-types
npm WARN     airbnb-prop-types@"^2.16.0" from enzyme-adapter-utils@1.14.0
npm WARN     node_modules/enzyme-adapter-utils
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: enzyme-adapter-react-16@1.15.6
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project
npm ERR!   peer react@"^18.0.0" from @testing-library/react@13.3.0
npm ERR!   node_modules/@testing-library/react
npm ERR!     @testing-library/react@"^13.3.0" from the root project
npm ERR!   4 more (react-dom, react-router, react-router-dom, react-scripts)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0-0" from enzyme-adapter-react-16@1.15.6
npm ERR! node_modules/enzyme-adapter-react-16
npm ERR!   dev enzyme-adapter-react-16@"^1.15.6" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.0.0-0" from enzyme-adapter-react-16@1.15.6
npm ERR!   node_modules/enzyme-adapter-react-16
npm ERR!     dev enzyme-adapter-react-16@"^1.15.6" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

"She'll be right," we thought, "it's one simple test framework and one simple test, how hard can it be?"

@alcamerone
Copy link
Collaborator Author

Hhhhuh, could have sworn it was React 16 when I started out, otherwise I would have used the 18 adapter... Or maybe I was just tired 🤷 will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants