Mocha JS Testing Framework
Mocha JS Testing Framework
Mocha JS Testing Framework
Angelo Gulina
Frontend for CAP
Eduard Mathias
vs Jest
Jest: recommended by FB Devs, uses Jasmine, React native
Mocha: more popular, simple API, faster, flexible
Useful
https://www.sitepoint.com/unit-test-javascript-mocha-chai/
run
$ ./node_modules/.bin/mocha
run
$ npm test
scripts: {
test: ./node_modules/.bin/mocha require ./mochaSetup.js
}
scripts: {
test: ./node_modules/.bin/mocha ./dir require ./mochaSetup.js
}
it().should.work()
actually
it().should.fail()
then
it().should.work()
https://github.com/tmpvar/jsdom
https://gist.github.com/mkretschek/902344f1136d3aa7fe40de9348be0e14
https://gist.github.com/mkretschek/902344f1136d3aa7fe40de9348be0e14
for PM
https://medium.com/javascript-scene/the-outrageous-cost-
of-skipping-tdd-code-reviews-57887064c412#.l0g4dhm9a
for Dev
https://medium.com/javascript-scene/5-common-
misconceptions-about-tdd-unit-
tests-863d5beb3ce9#.twcvovgic