xt-test
xt-test command runs unit tests.
This command will setup extension testing environment that is pre-initialized
with mocha, chai,
and expect. nyc is used for computing code coverage. 
The following browser features are initialized for convenience: window, chrome, document. 
Window is setup using jsdom-global and
chrome using sinon-chrome.
By default this command looks for unit tests in test/ directory, in any file ending with .js. 
Mocha will execute with babel, meaning you can use this test environment with modern JavaScript
 syntax.
You may extend this unit testing environment within an extension project. This is simply a base setup for running unit tests for web extensions. You may also create your very own test environment if this setup is not suitable for your project.
Commands
Braces { } indicate that the user must choose one (and only one) of the items inside the braces.
Run unit tests (default)
1 |  | 
Configure custom test directory path or match pattern
Defaults to ./test/**/*.js if not specified
1 |  | 
Execute tests and keep watching changes
1 |  | 
Get help using this command
1 |  | 
Package.json scripts
After installing extension-cli, you can run these commands from a terminal using syntax npx xt-test.
You may also add an option to packages.json scripts section as shown below, then
- run unit tests from terminal: 
npm run test - run unit tests and save coverage to file: 
npm run coverage. 
1 2 3 4  |  | 
Reporting Coverage
Coveralls
The general setup is:
- 
Install coveralls as a dev dependency at project level:
1npm install coveralls --save-dev - 
Run unit tests with coverage report during CI/CD workflow, then pipe the result to coveralls:
1nyc --reporter=lcov npm run test | coveralls 
If using Github actions, use Coveralls Github action to report results. Example:
1 2 3 4 5 6 7  |  |