freeCodeCamp/chapter

Testing libraries/frameworks?

cmenedes opened this issue Β· 17 comments

Hi, I think this project would benefit from a test-driven workflow, so i'm opening this issue for others to openly discuss any specific libraries/frameworks they would recommend to test code for this project.

Personally, I use Jest to unit test my Javascript (which is mainly JQuery) code at work. I know Jest or Jasmine aren't specific to a Javascript library whereas Enzyme is meant to be used with React. Both can be used together as well.

I would appreciate someone with more experience writing tests with React to chime in on this as my experience is limited! (going based off the assumption we will be using React on the front-end)

Some resources i've looked into:

I teach teams how to build systems using (A)TDD, including systems in react.

It’s not easy for individuals to change their fundamental approach to software dev, especially a large open source community.

I think if we have a number of people here familiar & productive with GOOS-style ATDD, and willing to spend significant effort providing pairing it could work. Struggle to see it otherwise

I would definitely recommend getting a test runner setup tho, if not I will definitely be spending some time getting this in place

@craigjbass πŸ‘

It’s not easy for individuals to change their fundamental approach to software dev, especially a large open source community.

I would imagine so. I haven't been writing tests for too long and i'm still getting used to TDD, but I've found it very helpful so far. I haven't been a maintainer on an open source project with more than two members, so I'm just going based off my current experience. But yeah, I suppose that would belong in a higher-level conversation with some more input.

I would definitely recommend getting a test runner setup tho, if not I will definitely be spending some time getting this in place

Would Jest be considered a test runner in this scenario? I'm a little unfamiliar with terminology. Either way, I would be interested in helping set that up.

Would Jest be considered a test runner in this scenario? I'm a little unfamiliar with terminology. Either way, I would be interested in helping set that up.

Yes. Jest comes with create-react-app which is a fairly sensible starting point for most teams.

I've seen great success with Jest and React-Testing-Library. I'm all for using those tools.

My vote vor jest + React-Testing-Library + Cypress

Edited: It's ok by doing TDD. but keep the focus on the MVP, and clever tests

I think Jest will be a great choice

Jest > Jasmine, my opinion. I think for MVP, there should be more time spent on holistic tests, perhaps E2E tests, instead of individual unit tests. Agree with @wuilliam321 that any testing we do should be smart for MVP, then we can fill that gaps later.

It seems it will be Jest + React testing library to start with.

IMHO for MVP I think adding cypress is kinda bit overkill right now, I would suggest we go for Jest + RTL first

testing-library
huge community and support + cover almost everything

What I've gathered is that folks are fond of Jest + React-Testing library. Sticking to a defined test-driven workflow might not be applicable for an MVP; clever and holistic tests seem to be a good start. @QuincyLarson , should getting a test runner set up with some basic testing be part of the MVP?

@cmenedes I think it's very important to get some basic tests going so we can be confident that the App does what we expect to do before initial release. You have my thumbs up for getting some tests going, however, perhaps it would be wise to wait until we have the basic app in the repo. I imagine this will be over the weekend or early next week, as we have an open PR right now that is receiving final tweaks.

Thanks for your thoughts!

I think Jest + React testing library would really be cool for this project especially MVP. Maybe later cypress can be added for end to end testing.

I agree with Jest + React Testing Library πŸ‘

I think Jest will a good way to start.

Thanks for your input everyone.

There seems to be a consensus that we should use Jest + React. I'm going to consider this resolved and close this issue.