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

refactor(tests): enzyme => react-testing-library #37712

Merged
merged 3 commits into from Nov 8, 2019

Conversation

theashraf
Copy link
Contributor

  • I have read freeCodeCamp's contribution guidelines.
  • My pull request has a descriptive title (not a vague title like Update index.md)
  • My pull request targets the master branch of freeCodeCamp.
  • None of my changes are plagiarized from another source without proper attribution.
  • All the files I changed are in the same world language (for example: only English changes, or only Chinese changes, etc.)
  • My changes do not use shortened URLs or affiliate links.

Closes #37690

@theashraf theashraf requested a review from a team November 7, 2019 13:08
@gitpod-io
Copy link

gitpod-io bot commented Nov 7, 2019

@raisedadead
Copy link
Member

raisedadead commented Nov 7, 2019

Ah.. my bad. I forgot to mention and clarify that we use Enzyme for our in browser test runner (for the curriculum), where should probably leave it as is in the test runner(for now).

Hey @ValeraS do you think there is a better way to test the react challenges?

@ValeraS
Copy link
Contributor

ValeraS commented Nov 7, 2019

@raisedadead It may be difficult to replace the enzyme in challenges tests. The enzyme allows you to check the internal state of the component. testing-library does not.

IMHO, we can use the testing-library for client tests as best practice and enzyme for challenges tests, because we want to check the internals of the components.

@theashraf
Copy link
Contributor Author

Well, I added back enzyme for the reasons mentioned by @ValeraS which makes sense

@raisedadead
Copy link
Member

raisedadead commented Nov 8, 2019

Thanks @ValeraS !
Thanks @theashraf will have this pulled down and merged soon :)

@raisedadead raisedadead changed the title refactor(tests): 💡 rewrite enzyme tests in react-testing-library refactor(tests): enzyme => react-testing-library Nov 8, 2019
@raisedadead raisedadead merged commit 94532f9 into freeCodeCamp:master Nov 8, 2019
@RandellDawson
Copy link
Member

@raisedadead I believe this PR may have broken something. We are receiving many reports on the forum about the React challenges no longer working. I have validated they do not seem to work on Chrome or Firefox. The following error appears in the console with the correct solution for the first challenge.

image

Link to challenge

@RandellDawson
Copy link
Member

RandellDawson commented Nov 11, 2019

Update: Now I am not sure. Reverting or not reverting the changes, I can not reproduce the problem locally.

@ojeytonwilliams
Copy link
Contributor

I can't reproduce it either. .org .dev and local all seem fine. Also, the changes in frame-runner.js should not have any effect on the functionality.

One complete guess is that, somehow, they've got a broken version of the enzyme adapter cached. Maybe.

@RandellDawson
Copy link
Member

When you say "they", how do you mean?

@ojeytonwilliams
Copy link
Contributor

I just meant "the people that are experiencing the problem.".

Since you don't see the problem when you npm run clean-and-develop you could try building the site and checking again. It looks webpack related, after all.

@raisedadead
Copy link
Member

Hi @RandellDawson @ojeytonwilliams can you point me to the threads on forum? Thanks.

@RandellDawson
Copy link
Member

RandellDawson commented Nov 12, 2019

@raisedadead
https://www.freecodecamp.org/forum/t/react-redux-tutorials-tests-are-not-executing/326155/6

I have tried everything I know to do, but still get the error I show above when running any of the React challenges' tests.

abbathaw pushed a commit to abbathaw/freeCodeCamp that referenced this pull request Jul 24, 2020
* refactor: 💡 rewrite enzyme tests in react-testing-library

* fix: 🐛 remove enzyme imports from frame-runner.js

* chore: 🤖 install and add enzyme imports to frame-runner.js back
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.

rewrite enzyme tests in react-testing-library
5 participants