Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@stryker-mutator/karma-runner
Advanced tools
A plugin to use the karma test runner in Stryker, the JavaScript mutation testing framework
A plugin to use the karma test runner (or @angular/cli's ng test
) in Stryker, the JavaScript mutation testing framework
Install @stryker-mutator/karma-runner locally within your project folder, like so:
npm i --save-dev @stryker-mutator/karma-runner
The @stryker-mutator/karma-runner
is a plugin for stryker
to enable karma
as a test runner.
However, it does not come packaged with it's own version of karma
, instead it
uses your very own karma version. It can also work with @angular/cli
, see Configuring
Note: karma v2.0.3 has a known issue which makes it impossible to use it with Stryker. please upgrade to 2.0.4 or higher.
You can configure the @stryker-mutator/karma-runner
using the stryker.conf.js
(or stryker.conf.json
) config file.
// Stryker.conf.js
module.exports = {
// ...
testRunner: 'karma',
// ...
karma: {
projectType: 'custom', // or 'angular-cli'
configFile: 'path/to/karma.conf.js', // default `undefined`
config: { // default `undefined`
browsers: ['ChromeHeadless'] // override config settings
}
}
}
karma.projectType
["custom"
| "angular-cli"
]Default: "custom"
Specify which kind of project you're using. This determines which command is used to start karma
"custom"
: configure @stryker-mutator/karma-runner to use karma start
."angular-cli"
: configure @stryker-mutator/karma-runner to use ng test
(see configuring for angular-cli).karma.configFile
[string
]Default: undefined
Specify a 'karma.conf.js' file to be loaded.
Options specified directly in your stryker.conf.js file using karma.config
will overrule options in your karma.conf.js file.
karma.config
[object
]Default: undefined
Specify karma configuration options directly. Options specified here will overrule any options in your karma.conf.js file.
karma.ngConfig.testArguments
[object
]Default: undefined
Add ng test arguments. For example, specify an alternative project with:
karma: {
projectType: 'angular-cli',
ngConfig: {
testArguments: {
project: 'my-lib'
}
}
}
This will run ng test with --project
argument: ng test --project=my-lib
.
The browser's life cycle is determined by @stryker-mutator/karma-runner
. I.e. these settings cannot be overridden:
{
browserNoActivityTimeout: 1000000,
autoWatch: false,
singleRun: false,
detached: false
}
The coverage
plugin will also be removed (not needed for mutation testing).
Note: this requires v6.1.0-rc0 or higher of the @angular/cli
This is an example for a configuration of stryker using the angular cli:
// stryker.conf.js
exports = function(config){
config.set({
// ...
karma: {
projectType: 'angular-cli',
karma: {
configFile: 'src/karma.conf.js'
},
ngConfig: {
// Override ng arguments here
testArguments: {
project: 'my-lib'
}
}
}
// ...
});
}
As Stryker runs karma in its own process, its logging output will be consumed by Stryker.
To see all logging from karma, set the log level to trace
in stryker.conf.js
.
// stryker.conf.js
exports = function(config){
config.set({
// ...
logLevel: 'trace'
// ...
});
}
FAQs
A plugin to use the karma test runner in Stryker, the JavaScript mutation testing framework
The npm package @stryker-mutator/karma-runner receives a total of 2,263 weekly downloads. As such, @stryker-mutator/karma-runner popularity was classified as popular.
We found that @stryker-mutator/karma-runner demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.