mocha-srv runs a simple HTTP server, serving up your Mocha tests. This allows you to run the same suite of tests on the command line (with Node.js) and in the browser.
Current Version: 0.1.0
Node Support: 0.8, 0.10
mocha-srv requires Node.js and npm. Once you have these dependencies, you can install mocha-srv with the following command:
$ npm install -g mocha-srv
Once installed, the
mocha-srv command should be available to you.
Usage: mocha-srv [options] <path>Options:-h, --help output usage information-V, --version output the version number-p, --port <port> specify the port to run the server on. Default: 3000-t, --title <title> specify the test suite title-u, --ui <ui> specify the Mocha UI your tests use, one of: bdd (default), tdd
# Run mocha-srv, serving unit tests in ./tests$ mocha-srv ./tests# Run mocha-srv on port 1337 and run tests in TDD style$ mocha-srv -p 1337 -u tdd ./tests
To develop mocha-srv, you'll need to clone the repo and install dependencies with
make deps. If you're on Windows, you'll also need to install Make for Windows.
Once you're set up, you can run the following commands:
$ make deps # Install dependencies$ make lint # Run JSHint with the correct config$ make test # Run unit/feature tests
When no build target is specified, make will run
deps lint test. This means you can use the following command for brevity:
Code with lint errors or no/failing tests will not be accepted, please use the build tools outlined above.
mocha-srv is licensed under the MIT license.