Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

JavaScript unit testing #9

Closed
dana-ross opened this issue Apr 13, 2018 · 6 comments
Closed

JavaScript unit testing #9

dana-ross opened this issue Apr 13, 2018 · 6 comments
Assignees
Labels
Enhancement New feature or request

Comments

@dana-ross
Copy link
Contributor

Do we want to add a framework for JavaScript unit tests?

@timwright12
Copy link
Contributor

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.

@timwright12 timwright12 added the Enhancement New feature or request label Apr 18, 2018
@timwright12
Copy link
Contributor

Currently exploring Jest for standard unit testing

@timwright12
Copy link
Contributor

@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.

@dana-ross
Copy link
Contributor Author

dana-ross commented Jul 3, 2018

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.

@timwright12
Copy link
Contributor

timwright12 commented Jul 3, 2018

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.

@timwright12
Copy link
Contributor

Seems like we're moving forward with Jest for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants