@pigs/plugin-karma
v13.0.2
Published
Automatic (headless) browser testing with [Karma](https://karma-runner.github.io/latest/index.html).
Downloads
3
Readme
@pigs/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 @pigs/plugin-karma --dev
How to use
In your pigs.config.js
:
module.exports = {
plugins: [
{
resolve: '@pigs/plugin-karma'
}
]
}
This plugin injected a new command to Pigs CLI: pigs test:unit
which is a command running in Pigs's test
mode.
To run it easier, you can configure this in npm scripts:
{
"name": "my-project",
"scripts": {
"test": "pigs test:unit",
"build": "pigs --prod",
"start": "pigs --serve"
},
"devDependencies": {
"pigs": "^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):
pigs 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.