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

Tests #6

Closed
bbrock25 opened this issue Sep 28, 2016 · 6 comments
Closed

Tests #6

bbrock25 opened this issue Sep 28, 2016 · 6 comments

Comments

@bbrock25
Copy link
Contributor

How do we want to handle the tests in our app?

Should we try out mocha/enzyme or stick with jest?

Also, is there a need for the tests/ directory anymore? It seems that the documentation suggests having the specs closer to the code.

If its ok to remove that directory, and start investigating a good testing setup for react apps, I can get started on putting something together. I enjoyed using mocha for testing redux actions and reducers on the last app we worked on fwiw.

@samcdavid
Copy link
Contributor

my vote is for jest

@bbrock25
Copy link
Contributor Author

@samcdavid have you used jest?

@samcdavid
Copy link
Contributor

very little, but I am opposed to the mocha ecosystem. I just want to include one thing that handles testing. Not 10 that no one fully knows how to use other than include everything and hope it works.

@bbrock25
Copy link
Contributor Author

bbrock25 commented Sep 28, 2016

I would also like to consider Enzyme, as it seems to have a lot of momentum: https://github.com/airbnb/enzyme

I think its higher level than mocha or jest. Not sure really what the differentiator is for all of them though. I haven't done much testing of rendered components, rather mostly the strict business logic of the actions and stores...

[edit]
Apparently facebook has provided documentation for enzyme on the jest docs. https://facebook.github.io/jest/docs/tutorial-react.html

@gabeweaver
Copy link

@bbrock25 @samcdavid current test suite looks like:

  • BDD/TDD assertion library via Chai
  • Unit Testing via Enzyme
  • Spies via SinonJS
  • Test runner via Karma
  • Test framework via Mocha
  • A bout 10 additional deps to support this...and it now appears there is lots of duplication amongst some of those in terms of purpose

Thing's ive been investigating:

  • Test runner via Ava because it's 2-3x faster than Mocha and has good documentation of using Ava + Enzyme and a really good workshop that extensively covers setting up a test framework for react.

Why AVA

It also might be worthwhile to read through this convo folks in the create-react-app community were having about adding a standard, no config required, test framework to create react

@gabeweaver
Copy link

This PR completes the initial refactoring of the test suite. The readme has been updated to reflect the changes...but long and short, this is the solution we landed on:

  • Test framework - Jasmine (under the hood of Jest)
  • Feature tests - Jest + Nightmare
  • Unit Tests - Test + Enzyme

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

No branches or pull requests

3 participants