Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@stryker-mutator/mocha-runner
Advanced tools
A plugin to use the mocha test runner in Stryker, the JavaScript mutation testing framework
A plugin to use Mocha in Stryker, the JavaScript mutation testing framework.
Install @stryker-mutator/mocha-runner locally within your project folder, like so:
npm i --save-dev @stryker-mutator/mocha-runner
The @stryker-mutator/mocha-runner
is a plugin for stryker
to enable mocha
as a test runner.
As such, you should make sure you have the correct versions of its dependencies installed:
mocha
@stryker-mutator/core
You can configure the mocha test runner in the stryker.conf.js
file.
// stryker.conf.js
module.exports = function (config) {
config.set({
// ...
testRunner: 'mocha',
// ...
mochaOptions: {
// Optional mocha options
files: [ 'test/**/*.js' ]
opts: 'path/to/mocha.opts',
ui: 'bdd',
timeout: 3000,
require: [ /*'babel-register' */],
asyncOnly: false,
grep: /.*/
}
});
}
mochaOptions.files
[string
or string[]
]Default: 'test/**/*.js'
Choose which files to include. This is comparable to mocha's test directory although there is no support for --recursive
.
If you want to load all files recursively: use a globbing expression ('test/**/*.js'
). If you want to decide on the order of files, use multiple globbing expressions. For example: use ['test/helpers/**/*.js', 'test/unit/**/*.js']
if you want to make sure your helpers are loaded before your unit tests.
mochaOptions.opts
[string
| false]Default: 'test/mocha.opts'
Specify a 'mocha.opts' file to be loaded. Options specified directly in your stryker.conf.js file will overrule options from the 'mocha.opts' file. Disable loading of an additional mocha.opts file with false
.
The only supported mocha options are used: --ui
, --require
, --async-only
, --timeout
, --grep
(or their short form counterparts). Others are ignored by the @stryker-mutator/mocha-runner.
mochaOptions.grep
[RegExp
]Default: undefined
Specify a mocha grep
command, to single out individual tests.
mochaOptions.ui
[string
]Default: undefined
Set the name of your mocha ui
mochaOptions.require
[string[]
]Default: []
Set mocha's require
option
mochaOptions.asyncOnly
[boolean
]Default: false
Set mocha's asyncOnly
option
mochaOptions.timeout
[number
]Default: undefined
Set mocha's timeout
option
FAQs
A plugin to use the mocha test runner in Stryker, the JavaScript mutation testing framework
We found that @stryker-mutator/mocha-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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.