Type object
File match stryker.conf.json stryker-*.conf.json
Schema URL https://catalog.lintel.tools/schemas/schemastore/stryker-mutator/latest.json
Source https://raw.githubusercontent.com/stryker-mutator/stryker/master/packages/api/schema/stryker-core.json

Validate with Lintel

npx @lintel/lintel check
Type: object

JSON schema for the Stryker Mutator configuration file

Properties

allowConsoleColors boolean

The 'allowConsoleColors' value indicates whether Stryker should use colors in console.

Default: true
buildCommand string

Configure a build command to run after mutating the code, but before mutants are tested. This is generally used to transpile your code before testing. Only configure this if your test runner doesn't take care of this already and you're not using just-in-time transpiler like babel/register or ts-node.

Examples: "tsc -b", "babel src --out-dir lib", "npm run build"
checkers string[]

Enable checker plugins here. A checker plugin will be invoked for each mutant before it is run in a test runner. It can check to see of a given mutant is valid, by for example validate that it won't result in a type error

Default:
[]
checkerNodeArgs string[]

Configure arguments to be passed as exec arguments to the checker child process(es). For example, running Stryker with --concurrency 1 --checkerNodeArgs --inspect-brk will allow you to debug the checker child process. See execArgv of child_process.fork

Default:
[]
concurrency number | string

Set the concurrency of workers. Stryker will always run checkers and test runners in parallel by creating worker processes (note, not worker_threads). This defaults to n-1 where n is the number of logical CPU cores available on your machine, unless n <= 4, in that case it uses n. This is a sane default for most use cases. You can also specify a percentage string (e.g., "50%") to compute the worker count as a percentage of the logical CPU cores available (0%-100%).

Examples: 4, "50%", "100%"
commandRunner object
1 nested properties
command string

The command to test each mutant. For example "npm run mocha". Defaults to "npm test".

Default: "npm test"
coverageAnalysis string
Values: "off" "all" "perTest"
clearTextReporter object
8 nested properties
allowColor boolean

Indicates whether or not to use color coding in output.

Default: true
allowEmojis boolean

Enable emojis in your clear text report (experimental).

Default: false
logTests boolean

Indicates whether or not to log which tests were executed for a given mutant.

Default: true
maxTestsToLog integer

Indicates the maximum amount of test to log when logTests is enabled

Default: 3
min=0
reportTests boolean

Indicates whether or not to log all tests.

Default: true
reportMutants boolean

Indicates whether or not to log all mutants.

Default: true
reportScoreTable boolean

Indicates whether or not to log score table.

Default: true
skipFull boolean

Indicates whether rows with 100% mutation score are hidden in the score table.

Default: false
dashboard object
5 nested properties
project string

Indicates which project to use if the "dashboard" reporter is enabled.

version string

Indicates which version to use if the "dashboard" reporter is enabled.

module string

Indicates which module to use if the "dashboard" reporter is enabled.

baseUrl string

Indicates the base url of the stryker dashboard.

Default: "https://dashboard.stryker-mutator.io/api/reports"
reportType string
Values: "full" "mutationScore"
dryRunOnly boolean

Execute the initial test run only without doing actual mutation testing. Dry run only will still mutate your code before doing the dry run without those mutants being active, thus can be used to test that StrykerJS can run your test setup. This can be useful, for example, in CI pipelines.

Default: false
eventReporter object
1 nested properties
baseDir string

The base dir to write the events to

Default: "reports/mutation/events"
ignorePatterns string[]

A comma separated list of patterns used for specifying which files need to be ignored. This should only be used in cases where you experience a slow Stryker startup, because too many (or too large) files are copied to the sandbox that are not needed to run the tests. For example, image or movie directories. Note: This option will have NO effect when using the --inPlace option. The directories node_modules, .git and some others are always ignored. Example: --ignorePatterns dist. These patterns are ALWAYS ignored: [node_modules, .git, /reports, *.tsbuildinfo, /stryker.log, .stryker-tmp]. Because Stryker always ignores these, you should rarely have to adjust the ignorePatterns setting at all. This is useful to speed up Stryker by ignoring big directories/files you might have in your repo that has nothing to do with your code. For example, 1.5GB of movie/image files. Specify the patterns to all files or directories that are not used to run your tests and thus should NOT be copied to the sandbox directory for mutation testing. Each patterns in this array should be a glob pattern. If a glob pattern starts with /, the pattern is relative to the current working directory. For example, /foo.js matches to foo.js but not subdir/foo.js. However to SELECT specific files TO BE mutated, you better use --mutate.

Default:
[]
ignoreStatic boolean

Ignore static mutants. Static mutants are mutants which are only executed during the loading of a file. This means that Stryker has to reload the entire environment in order to test the mutant AND has to run all tests. Therefore, it might make sense to ignore static mutants.

Default: false
incremental boolean

Enable 'incremental mode'. Stryker will store results in a file and use that file to speed up the next --incremental run

Default: false
incrementalFile string

Specify the file to use for incremental mode.

Default: "reports/stryker-incremental.json"
force boolean

Run all mutants, even if --incremental is provided and an incremental file exists. Can be used to force a rebuild of the incremental file.

Default: false
fileLogLevel string
Values: "off" "fatal" "error" "warn" "info" "debug" "trace"
inPlace boolean

Determines whether or not Stryker should mutate your files in place. Note: mutating your files in place is generally not needed for mutation testing, unless you have a dependency in your project that is really dependent on the file locations (like "app-root-path" for example).

When true, Stryker will override your files, but it will keep a copy of the originals in the temp directory (using tempDirName) and it will place the originals back after it is done. Also with true the ignorePatterns has no effect any more.

When false (default) Stryker will work in the copy of your code inside the temp directory.

Default: false
logLevel string
Values: "off" "fatal" "error" "warn" "info" "debug" "trace"
maxConcurrentTestRunners number

[DEPRECATED please use "concurrency" instead]. Specifies the maximum number of concurrent test runners to spawn. Mutation testing is time consuming. By default, Stryker tries to make the most of your CPU's, by spawning as many test runners as you have CPU cores (Number.MAX_SAFE_INTEGER).

Default: 9007199254740991
maxTestRunnerReuse number

Restart each test runner worker process after n runs. Not recommended unless you are experiencing memory leaks that you are unable to resolve. Configuring 0 here means infinite reuse.

Default: 0
mutate string[]

With mutate you configure the subset of files or just one specific file to be mutated. These should be your production code files, and definitely not your test files. (Whereas with ignorePatterns you prevent non-relevant files from being copied to the sandbox directory in the first place) The default will try to guess your production code files based on sane defaults. It reads like this:

  • Include all js-like files inside the src or lib dir
  • Except files inside __tests__ directories and file names ending with test or spec. If the defaults are not sufficient for you, for example in a angular project you might want to exclude not only the *.spec.ts files but other files too, just like the default already does. It is possible to specify exactly which code blocks to mutate by means of a mutation range. This can be done postfixing your file with :startLine[:startColumn]-endLine[:endColumn]. Example: src/index.js:1:3-1:5
Default:
[
  "{src,lib}/**/!(*.+(s|S)pec|*.+(t|T)est).+(cjs|mjs|js|ts|mts|cts|jsx|tsx|html|vue|svelte)",
  "!{src,lib}/**/__tests__/**/*.+(cjs|mjs|js|ts|mts|cts|jsx|tsx|html|vue|svelte)"
]
mutator object
2 nested properties
plugins string | array[] | null

Override the default babel plugins Stryker uses to parse your JavaScript files. The default list of plugins is extensive and normally doesn't need overriding. Stryker also loads your babel plugins by default (if you have them). If Stryker's default babel plugins conflicts with your plugins, try to override this list with an empty array.

Default: null
excludedMutations string[]
Default:
[]
packageManager enum

The package manager Stryker can use to install missing dependencies.

Values: "npm" "yarn" "pnpm"
plugins string[]

With 'plugins', you can add additional Node modules for Stryker to load (or require). By default, all node_modules starting with @stryker-mutator/* will be loaded, so you would normally not need to specify this option. These modules should be installed right next to stryker. For a current list of plugins, you can consult 'npm' or 'stryker-mutator.io.'

Default:
[
  "@stryker-mutator/*"
]
appendPlugins string[]

A list of additional plugins you want Stryker to load (require) without overwriting the (default) plugins.

Default:
[]
reporters string[]

With reporters, you can set the reporters for stryker to use.

Default:
[
  "clear-text",
  "progress",
  "html"
]
htmlReporter object
1 nested properties
fileName string

The fileName of the html report.

Default: "reports/mutation/mutation.html"
jsonReporter object
1 nested properties
fileName string

The relative filename for the json report.

Default: "reports/mutation/mutation.json"
disableTypeChecks boolean | string

Set to 'true' to disable type checking, or 'false' to enable it. For more control, configure a pattern that matches the files of which type checking has to be disabled. This is needed because Stryker will create (typescript) type errors when inserting the mutants in your code. Stryker disables type checking by inserting // @ts-nocheck atop those files and removing other // @ts-xxx directives (so they won't interfere with @ts-nocheck). The default setting allows these directives to be stripped from all JavaScript and friend files in lib, src and test directories.

Default: true
Examples: "{test,src,lib}/**/*.{js,ts,jsx,tsx,html,vue,cts,mts}"
symlinkNodeModules boolean

The 'symlinkNodeModules' value indicates whether Stryker should create a symbolic link to your current node_modules directory in the sandbox directories. This makes running your tests by Stryker behave more like your would run the tests yourself in your project directory. Only disable this setting if you really know what you are doing.

Default: true
tempDirName string

Choose a different temp dir that Stryker uses for mutation testing. This directory will contain copies of your source code during a mutation test run. It will be created if it not exists and is entirely deleted after a successful run, so change this with caution.

Default: ".stryker-tmp"
cleanTempDir enum

Choose whether or not to clean the temp dir (which is ".stryker-tmp" inside the current working directory by default).

  • false: Never delete the temp dir;
  • true: Delete the tmp dir after a successful run;
  • "always": Always delete the temp dir, regardless of whether the run was successful.
Default: true
Values: "always" false true
testRunner string

With 'testRunner' you specify the test runner that Stryker uses to run your tests. The default value is command. The command runner runs a configurable bash/cmd command and bases the result on the exit code of that program (0 for success, otherwise failed). You can configure this command via the config file using the 'commandRunner: { command: 'npm run mocha' }'. It uses 'npm test' as the command by default.

Default: "command"
testRunnerNodeArgs string[]

Configure arguments to be passed as exec arguments to the test runner child process. For example, running Stryker with --timeoutMS 9999999 --concurrency 1 --testRunnerNodeArgs --inspect-brk will allow you to debug the test runner child process. See execArgv of child_process.fork

Default:
[]
thresholds object
3 nested properties
high number
min=0max=100
low number
min=0max=100
break null | percentage
Default: null
timeoutFactor number

Configure the allowed timeout deviation relative to the time of a normal test run. Tweak this if you notice that mutants are prone to creating slower code, but not infinite loops (for that, use timeoutMS)

Default: 1.5
timeoutMS number

Configure an absolute timeout deviation. Tweak this if you run Stryker on a busy machine and you need to wait longer to make sure that the code indeed entered an infinite loop.

Default: 5000
dryRunTimeoutMinutes number

Configure an absolute timeout for the initial test run. (It can take a while, therefore we use minutes as time unit.)

Default: 5
min=0
tsconfigFile string

Configure the (root) tsconfig file for typescript projects. This will allow Stryker to rewrite the extends and references settings in this and related tsconfig files in your sandbox. Defaults to tsconfig.json. This setting is also used when you enable the `@stryker-mutator/typescript-checker plugin

Default: "tsconfig.json"
warnings boolean | warningOptions

Enable or disable certain warnings

Default: true
disableBail boolean

Disables the default of bailing after first failing test. When true runs all tests covering a mutant. Useful when the subject under test is not completely isolated by mocks and you want to know which tests are killing the mutants. This will impact performance.

Default: false
allowEmpty boolean

Allows stryker to exit without any errors in cases where no tests are found

Default: false
ignorers string[]

Specify which ignore-plugins to use. With an ignore-plugin you can ignore mutants inside common code patterns that you don't want to test for some reason. For example, you can use this to ignore all console.debug() statements from being mutated.

Default:
[]
testFiles string[]

With testFiles you can limit which test files are executed during mutation testing. When specified, only tests from these files will be run, allowing you to verify that a module's dedicated unit tests can kill all its mutants independently. Glob patterns are supported.

Default:
[]

Definitions

commandRunnerOptions object
command string

The command to test each mutant. For example "npm run mocha". Defaults to "npm test".

Default: "npm test"
logLevel string
coverageAnalysis string
reportType string
clearTextReporterOptions object
allowColor boolean

Indicates whether or not to use color coding in output.

Default: true
allowEmojis boolean

Enable emojis in your clear text report (experimental).

Default: false
logTests boolean

Indicates whether or not to log which tests were executed for a given mutant.

Default: true
maxTestsToLog integer

Indicates the maximum amount of test to log when logTests is enabled

Default: 3
min=0
reportTests boolean

Indicates whether or not to log all tests.

Default: true
reportMutants boolean

Indicates whether or not to log all mutants.

Default: true
reportScoreTable boolean

Indicates whether or not to log score table.

Default: true
skipFull boolean

Indicates whether rows with 100% mutation score are hidden in the score table.

Default: false
dashboardOptions object
project string

Indicates which project to use if the "dashboard" reporter is enabled.

version string

Indicates which version to use if the "dashboard" reporter is enabled.

module string

Indicates which module to use if the "dashboard" reporter is enabled.

baseUrl string

Indicates the base url of the stryker dashboard.

Default: "https://dashboard.stryker-mutator.io/api/reports"
reportType string
Values: "full" "mutationScore"
eventRecorderOptions object
baseDir string

The base dir to write the events to

Default: "reports/mutation/events"
htmlReporterOptions object
fileName string

The fileName of the html report.

Default: "reports/mutation/mutation.html"
jsonReporterOptions object
fileName string

The relative filename for the json report.

Default: "reports/mutation/mutation.json"
mutationScoreThresholds object
high number
min=0max=100
low number
min=0max=100
break null | percentage
Default: null
percentage number
mutatorDescriptor object
plugins string | array[] | null

Override the default babel plugins Stryker uses to parse your JavaScript files. The default list of plugins is extensive and normally doesn't need overriding. Stryker also loads your babel plugins by default (if you have them). If Stryker's default babel plugins conflicts with your plugins, try to override this list with an empty array.

Default: null
excludedMutations string[]
Default:
[]
warningOptions object
unknownOptions boolean

decide whether or not to log warnings when additional stryker options are configured

Default: true
preprocessorErrors boolean

decide whether or not to log warnings when a preprocessor error occurs. For example, when the disabling of type errors fails.

Default: true
unserializableOptions boolean

decide whether or not to log warnings when a configuration options are unserializable. For example, using a /regex/ or function in your configuration options.

Default: true
slow boolean

decide whether or not to log warnings when Stryker detects a slow part of mutation that can be sped up by changing some configuration. For example using --ignoreStatic.

Default: true