The extension features a number of unit tests written in Jasmine. There are a few steps necessary to run them.
- Node and npm
- Google Chrome
The tests are designed to be run with Chrome, either headless (as they run on GitHub actions) or otherwise. They are launched using the Karma test runner, which can be installed using npm.
- Install Node and npm.
- In the project directory,
npm install
- (optional)
npm install -g karma-cli
. If you don't, replacekarma
withnode_modules/.bin/karma
in the step below. - Finally,
karma start
orkarma start --browsers Chrome_CI
for headless.
All of the necessary node packages are installed in the project folder in the
node_modules directory (which is part of .gitignore
).
By default, karma runs in an 'iterative' mode, where it watches input files and
editing test or source code instantly causes the test suite to be re-run. If
you'd like to only do a single pass of the test suite, pass karma the flag
--single-run
.
It shouldn't be too hard to add additional browsers/launchers. Simply:
npm install --save-dev karma-somebrowser-launcher
- Add the new launcher to the plugins section of
karma.conf.js
- Run
karma start --browsers SomeBrowser