Mocha is a feature-rich JavaScript test framework running on Node.js and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
browser support simple async support, including promises test coverage reporting string diff support javascript API for running tests proper exit status for CI support etc auto-detects and disables coloring for non-ttys maps uncaught exceptions to the correct test case async test timeout support test-specific timeouts growl notification support reports test durations highlights slow tests file watcher support global variable leak detection optionally run tests that match a regexp auto-exit to prevent "hanging" with an active loop easily meta-generate suites & test-cases mocha.opts file support clickable suite titles to filter test execution node debugger support detects multiple calls to done() use any assertion library you want extensible reporting, bundled with 9+ reporters extensible test DSLs or "interfaces" before, after, before each, after each hooks arbitrary transpiler support (coffee-script etc) TextMate bundle
$ npm install -g mocha $ mkdir test $ $EDITOR test/test.js
In your editor:
var assert = require('assert'); describe('Array', function() { describe('#indexOf()', function () { it('should return -1 when the value is not present', function () { assert.equal(-1, .indexOf(5)); assert.equal(-1, .indexOf(0)); }); }); });
Back in the terminal:
$ mocha . ✔ 1 test complete (1ms)
Mocha allows you to use any assertion library you want, if it throws an error, it will work! This means you can utilize libraries such as:
Points: 0
You voted ‘up’
View MANUFACTURERS Wallboard
Theme by Danetsoft and Danang Probo Sayekti