Stryker WCT runner
Install @stryker-mutator/wct-runner locally within your project folder, like so:
npm i --save-dev @stryker-mutator/wct-runner
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:
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.
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.maxConcurrentTestRunners: 4 // A maximum of half your CPU's is recommendedtimeoutMS: 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.
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 examplewct:configFile: 'config/wct.conf.json'
It is also possible to override other wct properties specific for stryker. Full example:
// Full examplewct:configFile: 'alternative/wct/configuration.json'verbose: truenpm: trueplugins:local:browsers: "chrome"skipSeleniumInstall: truebrowserOptions:chrome: "window-size=1920,1080" "headless" "disable-gpu"firefox: "--headless"
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
'debug' in your Stryker configuration to get the most logging out of WCT.
Use WCT with the
--npm flag. This will allow web-components installed via npm, instead of bower.
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.
Make sure to read the Stryker contribution guidelines located in the Stryker mono repository.