This repository is the example repo used for the React.js Singapore meetup on 23rd of May 2017.
The slides for the talk are available at:
https://presenting.joeir.net/reactjs-sg-enzyme#/
A full article describing each of these tools is available on my blog at:
https://blog.joeir.net/automated-testing-of-react-js-apps-with-depth
Don't just copy and paste it into your own projects, rather, tinker with the provided configurations and see what breaks/works better.
Clone this repo. If you use yarn
(which you should), install the dependencies like this:
# yarn install
Or else plain ol' npm
will do:
# npm install
To run the Karma tests (which runs the Enzyme tests):
# npm run test
Coverage reports will be available in the /static/coverage/karma
folder.
Run npm run dev
and access it at http://localhost:3000/static/coverage/karma/index.html.
To run ESLint:
# npm run eslint
To run the Plato ECMAScript code quality tool:
# npm run plato
Coverage reports will be available in the /static/coverage/plato
folder.
Run npm run dev
and access it at http://localhost:3000/static/coverage/plato/index.html.
To run the Feature tests (which uses Codecept):
- Start up the selenium server with:
# npm run selenium
Wait till you see a line of output that looks like the following before proceeding:
[INFO - YYYY-MM-DDTHH:mm:ss.XXXX] GhostDriver - Main - running on port 4444
- In another terminal, run the application:
# npm run dev
Wait till you see a line of output that looks like the following before proceeding:
Compiled successfully in ???ms
- Finally in a last terminal, run Codecept:
# npm run codecept
Coverage reports will be available in the /static/coverage/codecept
folder.
Run npm run dev
and access it at http://localhost:3000/static/coverage/codecept/index.html.