This project offers two options for unit testing:
- Karma and Mocha.
- Jest: the test runner that launches JSDOM runs the tests and reports the results to us.
Jest runs this file before it runs the unit tests. It sets the Vue production tip to false.
The Jest boilerplate comes with the ability to mock dependencies. See the mock functions guide for more details.
Karma and Mocha
- Karma: the test runner that launches browsers, runs the tests and reports the results to us.
- karma-webpack: the plugin for Karma that bundles our tests using Webpack.
- Mocha: the test framework that we write test specs with.
- Chai: test assertion library that provides better assertion syntax.
- Sinon: test utility library that provides spies, stubs and mocks.
Chai and Sinon are integrated using karma-sinon-chai, so all Chai interfaces (
sinon are globally available in test files.
This is the entry file used by
karma-webpackto bundle all the test code and source code (for coverage purposes). You can ignore it for the most part.
This directory is where you write your actual tests. You can use full ES2015+ and all supported Webpack loaders in your tests.
This is the Karma configuration file. See Karma docs for more details.
Running Tests in More Browsers
You can run the tests in multiple real browsers by installing more karma launchers and adjusting the
browsers field in