October 2017
Intermediate to advanced
458 pages
11h 13m
English
As I said earlier, Karma is an abstraction, which makes it possible to run different tests from different test frameworks. While I do not want to dwell on this for too long, learning a single test framework is enough after all, I do wish to quickly show you how this is done.
So, let's install Mocha (https://mochajs.org/) and the popular Chai (http://chaijs.com/) assertion library:
npm install mocha --save-dev npm install chai --save-dev
Now, create a file called mocha-tests.js inside your test folder. We are going to test repository.search in mocha-tests.js:
describe('web app tests', function() { describe('repository', function () { it('should search products with "fantas"', function() { var products = repository.search('fantas'); ...Read now
Unlock full access