@stryker-mutator/wct-runner
v4.0.0
Published
This was a plugin to use web component tester as a test runner for Stryker, the mutation testing framework for JavaScript and friends. However support was dropped in Stryker v4
Downloads
54
Keywords
Readme
Stryker WCT runner
Installation
Install @stryker-mutator/wct-runner locally within your project folder, like so:
npm i --save-dev @stryker-mutator/wct-runner
Peer dependencies
The @stryker-mutator/wct-runner is a plugin to enable the Web Component Tester (wct) as a test runner for Stryker. As such, you should make sure you have the correct versions of its dependencies installed:
- web-component-tester
- @stryker-mutator/core
For the minimum supported versions, see the peerDependencies section in package.json.
Note for Polymer users: if you're using a global installation of polymer-cli to run your tests, you will need to install web-component-tester locally, right next to the @stryker-mutator/wct-runner package. The @stryker-mutator/wct-runner will not be able to find your global installation of the polymer-cli. You can use this command: npm i -D web-component-tester
.
Configuration
Configuring Stryker
Make sure you set the testRunner
option to "wct" and set coverageAnalysis
to "off" in your Stryker configuration.
{
testRunner: 'wct'
coverageAnalysis: 'off', // coverage analysis is not supported yet for the @stryker-mutator/wct-runner.
concurrency: 4, // A maximum of half your CPU's is recommended
timeoutMS: 10000 // A higher timeout is recommended to allow for browser startup
}
For more information on what these options mean, take a look at the Stryker readme.
Configuring WCT
The @stryker-mutator/wct-runner will honor your regular wct configuration. This means that it will automatically load the wct.conf.json file from the current working directory as expected. You can change this to a different file using the wct.configFile
property in your Stryker config:
// Override config file example
wct: {
configFile: 'config/wct.conf.json'
}
It is also possible to override other wct properties specific for stryker. Full example:
// Full example
wct: {
configFile: 'alternative/wct/configuration.json',
verbose: true,
npm: true,
plugins: {
local: {
browsers: ["chrome"],
skipSeleniumInstall: true,
browserOptions: {
chrome: ["window-size=1920,1080", "headless", "disable-gpu"],
firefox: ["--headless"]
}
}
}
}
wct.verbose
[boolean
]
Default: false
Enable/disable verbose WCT logging. WCT can be noisy. By default, Stryker will swallow any wct log messages. Enabling this option will forward any wct log messages to Stryker logging. Don't forget to set logLevel
(or fileLogLevel
) to 'debug'
in your Stryker configuration to get the most logging out of WCT.
wct.npm
[boolean
]
Default: false
Use WCT with the --npm
flag. This will allow web-components installed via npm, instead of bower.
wct.plugins.local.browserOptions
Default: undefined
It is recommended to configure a headless browser when using WCT in combination with Stryker. An example configuration:
wct: {
plugins: {
local: {
browserOptions: {
chrome: ["window-size=1920,1080", "headless", "disable-gpu"],
firefox: ["--headless"]
}
}
}
}
Other wct options
For more information about the available wct options, please see wct's config.ts file.
Loading the plugin
In order to use the @stryker-mutator/wct-runner
it must be loaded in the Stryker mutation testing framework via the Stryker configuration. The easiest way to achieve this, is not have a plugins section in your config file. That way, all node_modules starting with stryker-
will be loaded.
Contributing
Make sure to read the Stryker contribution guidelines located in the Stryker mono repository.