Skip to content

kentcdodds/react-mocha-workshop

Repository files navigation

React + Mocha + Enzyme = ❤️

slides-badge PRs Welcome Donate

Find slides here

This is a workshop for learning how to test React with the Mocha testing framework and the Enzyme testing library. It also uses Chai for helpful assertions

Project Setup

This project assumes you have NodeJS v6 or greater installed. You should also have npm v3 or greater installed as well (this comes packaged with Node 6). You'll also need a recent version of git installed as well.

You may have come to this project from different varying sources. There are a different series of branches for each workshop/course I've done. To get started with the project, start with this:

  1. Sign up for a GitHub Account (if you don't already have one)
  2. Clone this repository
  3. In the directory you cloned the repository, run npm run setup

If you need help with these steps, you might check out this free Egghead.io course which can help you get things going.

If the npm run setup script finishes without errors (don't worry about warnings) then you're good to go. Otherwise, please file an issue.

Testing Instructions

There are two directories in this project that you should be interested in:

  • app: Where the unfinished tests are (where you should add your tests).
  • app-final: Where the finished tests are (where you can reference if you get stuck).

The tests in app are actually all scaffolded for you. So your goal is to go through and write all the tests. Do this:

  1. Run npm run watch:test which will start running the tests in watch mode, meaning that as you save your file, it will automatically re-run your tests so you can quickly see how you're doing.
  2. Choose a file in the app directory that ends in .test.js and implement the tests by changing it.skip( to it( one-by-one.

Good luck!

LICENSE

MIT

About

🐯 A workshop repository for testing React ⚛ with Mocha ☕ --> slides

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published