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

theashraf commented Nov 7, 2019

  • 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 freeCodeCamp/dev-team as a code owner Nov 7, 2019
@gitpod-io

This comment has been minimized.

Copy link

gitpod-io bot commented Nov 7, 2019

@raisedadead

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

theashraf commented Nov 7, 2019

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

@raisedadead

This comment has been minimized.

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
2 checks passed
2 checks passed
Gitpod Open an online workspace in Gitpod
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@RandellDawson

This comment has been minimized.

Copy link
Member

RandellDawson commented Nov 11, 2019

@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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

ojeytonwilliams commented Nov 11, 2019

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

This comment has been minimized.

Copy link
Member

RandellDawson commented Nov 11, 2019

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

@ojeytonwilliams

This comment has been minimized.

Copy link
Contributor

ojeytonwilliams commented Nov 11, 2019

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

This comment has been minimized.

Copy link
Member

raisedadead commented Nov 12, 2019

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

@RandellDawson

This comment has been minimized.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.