@linaj/plugin-karma
v0.1.0
Published
Automatic (headless) browser testing with [Karma](https://karma-runner.github.io/latest/index.html).
Downloads
3
Readme
@linaj/plugin-karma
Automatic (headless) browser testing with Karma.
Introduction
This plugin pre-configures Karma, Jasmine for you so that you can run the tests without any configurations.
Install
yarn add @linaj/plugin-karma --dev
How to use
In your lazy.config.js
:
module.exports = {
plugins: [
{
resolve: '@linaj/plugin-karma'
}
]
}
This plugin injected a new command to lazy CLI: lazy test:unit
which is a command running in lazy's test
mode.
To run it easier, you can configure this in npm scripts:
{
"name": "my-project",
"scripts": {
"test": "lazy test:unit",
"build": "lazy --prod",
"start": "lazy --serve"
},
"devDependencies": {
"lazy": "^12.0.0"
}
}
Now you can run npm test
instead.
Test File Patterns
By default this plugin use **/*.{test,spec}.{js,ts}
(excluded node_modules
) as test files, you can change this to any minimatch pattern (note the quotes to avoid shell expansion):
lazy test:unit "**/*.spec.coffee"
Coverage Report
Use --coverage
flag to show code coverage and generate coverage report to ./coverage
folder.
Watching Files
Use --watch
flag to watch test files.
Running on CI
To run your tests in Continuous Integration Platforms like CircleCI, you will need Chrome
installed in your test environment.