3. Why Mocha?
⢠Client side
⢠Server side
⢠Well maintained
⢠Well documented
⢠Integration with CI
⢠We can choose desired assertion library
8. Setup
⢠Expects tests to be in <project_root>/test
⢠Allows of per project options file:
⢠mocha.opts
⢠To run test:
⢠mocha
9. First test
describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() {
[1,2,3].indexOf(5).should.equal(-1);
[1,2,3].indexOf(0).should.equal(-1);
})
})
})