Jest is a big name in JavaScript testing. We use it ourselves on CodePen to do our JavaScript unit tests. Koen Vendrik has created a way to run Jest in the browser (rather than in Node): jest-lite.
Here's a Pen from Koen that I lightly doctored up to be more in the CodePen format. It tests some React code:
See the Pen
jest-lite CDN Example by Chris Coyier (@chriscoyier)
on CodePen.
There are other testing frameworks!
There is Mocha/Chai, Jasmine, Tape, qUnit... all of which can work on CodePen. Benjamin Gandhi-Shepard has a blog post about that. Here's Jasmine (which is also capable of testing React):
See the Pen
Unit Testing JS with Jasmine by BROWNERD (@brownerd)
on CodePen.
The post Jest on CodePen appeared first on CodePen Blog.