-
Notifications
You must be signed in to change notification settings - Fork 39
JavaScript unit testing #9
Comments
We can, but we never settled on one (at least on the FE team). I know React apps use Jest and our best practice docs say Mocha and Chai. I'd like to put more thought into that and figure out what we're Unit testing and the best way to go about it on our more common projects. |
Currently exploring Jest for standard unit testing |
@daveross @tlovett1 It seems like Jest is a decent direction to take, it works in React and non-React environments. We can also run UI (E2E) tests on components to make sure they work as expected in combination with Puppeteer. I'm still learning it a bit, but I threw together a super basic (and poorly written) test as a POC https://github.com/timwright12/10up-unit-testing/tree/master/jest-puppeteer Leaning heavily towards a recommendation of Jest + Puppeteer for unit and e2e tests. I'm not sure there's anything for the scaffold beyond getting them in the package file and creating a basic "does the site render" test, but that may be a starting point. |
Starting points are good. If we can make it so the team can write tests and drop them in a directory to run with an npm command we've removed a lot of a friction from the process for them. That might be the difference between a project having tests and not having them. |
Yeah, I'm going to do some work testing the framework out, but I think I can get something in place for a PR in a week or two. I want to make sure the team is OK with the choice as well. |
Seems like we're moving forward with Jest for this. |
Do we want to add a framework for JavaScript unit tests?
The text was updated successfully, but these errors were encountered: