mocha-examples
mocha-examples copied to clipboard
Working examples of common configurations using mocha ☕️
Mocha examples
A set of examples to help demonstrate common configurations using Mocha. They should all run out-the-box.
Examples
- Apollo-Server GraphQL API
- Async setup with --delay
- Async setup with --file
- Babel application
- Karma
- Programmatic usage
- React, webpack
- Selenium application
- Third party reporter
- TypeScript application
- Vue and Puppeteer application
- Puppeteer application
- TypeScript, Babel
- Express REST API
- Node Sqlite 3 example
- Playwright application
- RxJs example
Adding a new example
Follow the below steps:
- Clone this repo locally
- Create your folder under
packages/ - Run
npm init - Now build your application and open a PR (its
npm testwill automatically be run in CI).
Linting
There is generally no linting requirement for each example, but we recommend running prettier. You can install and run it with:
npm install prettier
prettier --write .
Requirements
Each example application will have its own package dependencies but also a version of Node.js it was designed and built from.
Reporting a bug?
Feel free to send a branch to supply an MCVE from one of the applications.
Potential setups to add in future
- Angular
- Pipe json output to file
We welcome suggestions on other useful setups.