Mocha Chai Browser Demo Save

An example setup for unit testing JavaScript in the browser with the Mocha testing framework and Chai assertions

Project README

A demo setup for unit testing client-side JavaScript code with Mocha.js and Chai.js.

Since mocha 1.2, you can install mocha via npm and run mocha init <path> to generate a client side testing skeleton.

Automated in-browser tests with Karma

This sample also includes a Karma configuration to run the tests automatically.

To use Karma, you need to have node.js and npm installed. In the project directory, type npm install karma-mocha. After the Karma install finishes, type node_modules/karma/bin/karma start and navigate to http://localhost:9876 to let Karma capture the web browser and run the tests automatically.

If you are familiar with npm, you can look at the package.json. That configuration allows you to just type npm install and then npm test to start the Karma server. Since the karma NPM package does not define a bin field, we must make use of the karma-cli package to be able to use the karma executable inside our test script.

Open Source Agenda is not affiliated with "Mocha Chai Browser Demo" Project. README Source: ludofischer/mocha-chai-browser-demo
Open Issues
Last Commit
5 years ago

Open Source Agenda Badge

Open Source Agenda Rating