Karma with Mocha Testing Framework
Qualified has support for testing in-browser code using Karma with Mocha.
There is very little changes necessary from testing normal code, except your code will be run inside a PhantomJS headless browser, enabling you to test browser-specific events.
All code run in the browser is compiled via tsc, so you can safely use ES2015 code.
Mocha in Karma works the same as the normal Mocha Testing Framework (BDD), with one exception: Chai will already be loaded for you, with
assert all available, no
Note on Chai Failure Reporting
By default Chai truncates objects and arrays over
40characters in length. If you want to show longer objects (especially arrays) to candidates, you should add the following to your
// How many characters to show before truncating long objects? 0 means no truncating. chai.config.truncateThreshold = 1000;