UNPKG

24.5 kBJSONView Raw
1{
2 "$schema": "http://json-schema.org/draft-07/schema#",
3 "title": "StrykerMonoSchema",
4 "description": "Options for Stryker for JS and TypeScript and all officially supported plugins.",
5 "type": "object",
6 "properties": {
7 "allowConsoleColors": {
8 "description": "The 'allowConsoleColors' value indicates whether Stryker should use colors in console.",
9 "type": "boolean",
10 "default": true
11 },
12 "buildCommand": {
13 "type": "string",
14 "description": "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`.",
15 "examples": [
16 "tsc -b",
17 "babel src --out-dir lib",
18 "npm run build"
19 ]
20 },
21 "checkers": {
22 "description": "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",
23 "type": "array",
24 "items": {
25 "type": "string"
26 },
27 "default": []
28 },
29 "concurrency": {
30 "description": "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 cpu's available on your machine. This is a sane default for most use cases.",
31 "type": "number"
32 },
33 "maxTestRunnerReuse": {
34 "description": "Restart each forked threads after <n> runs. Not recommended unless you are experiencing memory leaks that you are unable to resolve. (default: 0)",
35 "type": "number",
36 "default": 0
37 },
38 "commandRunner": {
39 "description": "Options used by the command test runner. Note: these options will only be used when the command test runner is activated (this is the default)",
40 "$ref": "#/definitions/commandRunnerOptions",
41 "default": {}
42 },
43 "coverageAnalysis": {
44 "$ref": "#/definitions/coverageAnalysis",
45 "description": "Indicates which coverage analysis strategy to use. During mutation testing, stryker will try to only run the tests that cover a particular line of code.\n\n'perTest': Analyse coverage per test.\n'all': Analyse the coverage for the entire test suite.\n'off' (default): Don't use coverage analysis",
46 "default": "off"
47 },
48 "clearTextReporter": {
49 "description": "The options for the clear text reporter.",
50 "$ref": "#/definitions/clearTextReporterOptions",
51 "default": {}
52 },
53 "dashboard": {
54 "description": "The options for the dashboard reporter.",
55 "$ref": "#/definitions/dashboardOptions",
56 "default": {}
57 },
58 "eventReporter": {
59 "description": "The options for the event recorder reporter.",
60 "$ref": "#/definitions/eventRecorderOptions",
61 "default": {}
62 },
63 "fileLogLevel": {
64 "description": "Set the log level that Stryker uses to write to the \"stryker.log\" file",
65 "$ref": "#/definitions/logLevel",
66 "default": "off"
67 },
68 "files": {
69 "description": "With `files` you can choose which files should be included in your test runner sandbox.\nThis is normally not needed as it defaults to all files not ignored by git.\nTry it out yourself with this command: `git ls-files --others --exclude-standard --cached --exclude .stryker-tmp`.\n\nIf you do need to override `files` (for example: when your project does not live in a git repository),\nyou can override the files here.\n\nWhen using the command line, the list can only contain a comma separated list of globbing expressions.\nWhen using the config file you can provide an array with `string`s",
70 "type": "array",
71 "items": {
72 "type": "string"
73 }
74 },
75 "logLevel": {
76 "description": "Set the log level that Stryker uses to write to the console.",
77 "$ref": "#/definitions/logLevel",
78 "default": "info"
79 },
80 "maxConcurrentTestRunners": {
81 "description": "[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`).",
82 "type": "number",
83 "default": 9007199254740991
84 },
85 "mutate": {
86 "description": "With mutate you configure the subset of files to use for mutation testing. Generally speaking, these should be your own source files.",
87 "type": "array",
88 "items": {
89 "type": "string"
90 },
91 "default": [
92 "{src,lib}/**/!(*.+(s|S)pec|*.+(t|T)est).+(cjs|mjs|js|ts|jsx|tsx|html|vue)",
93 "!{src,lib}/**/__tests__/**/*.+(cjs|mjs|js|ts|jsx|tsx|html|vue)"
94 ]
95 },
96 "mutator": {
97 "description": "Configure how Stryker mutates your code.",
98 "$ref": "#/definitions/mutatorDescriptor",
99 "default": {}
100 },
101 "packageManager": {
102 "enum": [
103 "npm",
104 "yarn"
105 ],
106 "description": "The package manager Stryker can use to install missing dependencies."
107 },
108 "plugins": {
109 "description": "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.'",
110 "type": "array",
111 "items": {
112 "type": "string"
113 },
114 "default": [
115 "@stryker-mutator/*"
116 ]
117 },
118 "appendPlugins": {
119 "description": "A list of additional plugins you want Stryker to load (`require`) without overwriting the (default) `plugins`.",
120 "type": "array",
121 "items": {
122 "type": "string"
123 },
124 "default": []
125 },
126 "reporters": {
127 "description": "With reporters, you can set the reporters for stryker to use.",
128 "type": "array",
129 "items": {
130 "type": "string"
131 },
132 "default": [
133 "clear-text",
134 "progress",
135 "html"
136 ]
137 },
138 "htmlReporter": {
139 "description": "The options for the html reporter",
140 "$ref": "#/definitions/htmlReporterOptions"
141 },
142 "disableTypeChecks": {
143 "description": "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. You can specify a different glob expression or set it to `false` to completely disable this behavior.",
144 "anyOf": [
145 {
146 "enum": [
147 false
148 ]
149 },
150 {
151 "type": "string"
152 }
153 ],
154 "default": "{test,src,lib}/**/*.{js,ts,jsx,tsx,html,vue}"
155 },
156 "symlinkNodeModules": {
157 "description": "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.",
158 "type": "boolean",
159 "default": true
160 },
161 "tempDirName": {
162 "description": "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.",
163 "type": "string",
164 "default": ".stryker-tmp"
165 },
166 "cleanTempDir": {
167 "description": "Choose whether or not to clean the temp dir (which is \".stryker-tmp\" inside the current working directory by default) after a successful run. The temp dir will never be removed when the run failed for some reason (for debugging purposes)",
168 "type": "boolean",
169 "default": true
170 },
171 "testRunner": {
172 "description": "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.",
173 "type": "string",
174 "default": "command"
175 },
176 "thresholds": {
177 "description": "Specify the thresholds for mutation score.",
178 "$ref": "#/definitions/mutationScoreThresholds",
179 "default": {}
180 },
181 "timeoutFactor": {
182 "description": "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`)",
183 "type": "number",
184 "default": 1.5
185 },
186 "timeoutMS": {
187 "description": "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.",
188 "type": "number",
189 "default": 5000
190 },
191 "tsconfigFile": {
192 "description": "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",
193 "type": "string",
194 "default": "tsconfig.json"
195 },
196 "warnings": {
197 "default": true,
198 "oneOf": [
199 {
200 "type": "boolean"
201 },
202 {
203 "$ref": "#/definitions/warningOptions"
204 }
205 ],
206 "description": "Enable or disable certain warnings"
207 },
208 "jasmineConfigFile": {
209 "description": "Specify your [jasmine configuration file](https://jasmine.github.io/setup/nodejs.html#configuration) to be loaded. Leaving this blank will result in the jasmine defaults, which are undocumented (see [source code here](https://github.com/jasmine/jasmine-npm/blob/master/lib/jasmine.js#L10-L38)).",
210 "type": "string"
211 },
212 "jest": {
213 "title": "JestOptions",
214 "description": "Configuration for @stryker-mutator/jest-runner",
215 "type": "object",
216 "default": {},
217 "properties": {
218 "projectType": {
219 "$ref": "#/definitions/jestProjectType",
220 "default": "custom"
221 },
222 "configFile": {
223 "description": "Path to your Jest config file. Please leave it empty if you want jest configuration to be loaded from package.json or a standard jest configuration file.",
224 "type": "string"
225 },
226 "config": {
227 "description": "A custom Jest configuration object. You could also use `require` to load it here.",
228 "type": "object"
229 },
230 "enableFindRelatedTests": {
231 "description": "Whether to run jest with the `--findRelatedTests` flag. When `true`, Jest will only run tests related to the mutated file per test. (See [_--findRelatedTests_](https://jestjs.io/docs/en/cli.html#findrelatedtests-spaceseparatedlistofsourcefiles)",
232 "type": "boolean",
233 "default": true
234 }
235 },
236 "additionalProperties": false
237 },
238 "karma": {
239 "description": "Configuration for @stryker-mutator/karma-runner",
240 "title": "StrykerKarmaSetup",
241 "additionalProperties": false,
242 "type": "object",
243 "default": {},
244 "properties": {
245 "projectType": {
246 "$ref": "#/definitions/karmaProjectKind",
247 "default": "custom"
248 },
249 "configFile": {
250 "description": "Specify a ['karma.conf.js' file](http://karma-runner.github.io/2.0/config/configuration-file.html) to be loaded. Options specified directly in your stryker.conf.js file using `karma.config` will overrule options in your karma.conf.js file.",
251 "type": "string"
252 },
253 "config": {
254 "description": "Specify [karma configuration options](http://karma-runner.github.io/2.0/config/configuration-file.html) directly. Options specified here will overrule any options in your karma.conf.js file.",
255 "type": "object"
256 },
257 "ngConfig": {
258 "$ref": "#/definitions/karmaNgConfigOptions"
259 }
260 }
261 },
262 "mochaOptions": {
263 "title": "MochaOptions",
264 "additionalProperties": false,
265 "type": "object",
266 "description": "Configuration for @stryker-mutator/mocha-runner",
267 "default": {},
268 "properties": {
269 "require": {
270 "description": "Set mocha's [`require` option](https://mochajs.org/#-r---require-module-name)",
271 "type": "array",
272 "items": {
273 "type": "string"
274 }
275 },
276 "ignore": {
277 "description": "Set mocha's [`ignore option](https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.yml#L26)",
278 "type": "array",
279 "items": {
280 "type": "string"
281 }
282 },
283 "file": {
284 "description": "Set mocha's [`file options`](https://mochajs.org/#-file-filedirectoryglob)",
285 "type": "array",
286 "items": {
287 "type": "string"
288 }
289 },
290 "opts": {
291 "description": "Specify a ['mocha.opts' file](https://mochajs.org/#mochaopts) 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.",
292 "type": "string"
293 },
294 "config": {
295 "description": "Explicit path to the [mocha config file](https://mochajs.org/#-config-path)",
296 "type": "string"
297 },
298 "package": {
299 "description": "Specify an explicit path to a package.json file (ostensibly containing configuration in a mocha property). See https://mochajs.org/#-package-path.",
300 "type": "string"
301 },
302 "no-package": {
303 "type": "boolean",
304 "description": "Explicit turn off [mocha package file](https://mochajs.org/#-package-path)"
305 },
306 "no-opts": {
307 "type": "boolean",
308 "description": "Explicit turn off [mocha opts file](https://mochajs.org/#-opts-path)"
309 },
310 "no-config": {
311 "type": "boolean",
312 "description": "Explicit turn off [mocha config file](https://mochajs.org/#-config-path)"
313 },
314 "async-only": {
315 "description": "Set mocha's [`async-only` option](https://mochajs.org/#-async-only-a)",
316 "type": "boolean"
317 },
318 "ui": {
319 "description": "Set the name of your [mocha ui](https://mochajs.org/#-u---ui-name)",
320 "type": "string",
321 "enum": [
322 "bdd",
323 "tdd",
324 "qunit",
325 "exports"
326 ]
327 },
328 "files": {
329 "description": "DEPRECATED, use `spec` instead.",
330 "oneOf": [
331 {
332 "type": "string"
333 },
334 {
335 "type": "array",
336 "items": {
337 "type": "string"
338 }
339 }
340 ]
341 },
342 "spec": {
343 "description": "Choose which files to include. This is comparable to [mocha's test directory](https://mochajs.org/#the-test-directory) although there is no support for `--recursive`.\n\nIf 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.",
344 "type": "array",
345 "items": {
346 "type": "string"
347 }
348 },
349 "grep": {
350 "description": "Specify a mocha [`grep`](https://mochajs.org/#grep) command, to single out individual tests.",
351 "type": "string"
352 },
353 "extension": {
354 "description": "Specify mocha [--extension](https://mochajs.org/#-extension-ext) property.",
355 "type": "array",
356 "items": {
357 "type": "string"
358 }
359 }
360 }
361 }
362 },
363 "definitions": {
364 "commandRunnerOptions": {
365 "title": "CommandRunnerOptions",
366 "type": "object",
367 "properties": {
368 "command": {
369 "description": "The command to test each mutant. For example \"npm run mocha\". Defaults to \"npm test\".",
370 "type": "string",
371 "default": "npm test"
372 }
373 }
374 },
375 "logLevel": {
376 "title": "LogLevel",
377 "type": "string",
378 "enum": [
379 "off",
380 "fatal",
381 "error",
382 "warn",
383 "info",
384 "debug",
385 "trace"
386 ],
387 "tsEnumNames": [
388 "Off",
389 "Fatal",
390 "Error",
391 "Warning",
392 "Information",
393 "Debug",
394 "Trace"
395 ]
396 },
397 "coverageAnalysis": {
398 "title": "CoverageAnalysis",
399 "type": "string",
400 "enum": [
401 "off",
402 "all",
403 "perTest"
404 ]
405 },
406 "reportType": {
407 "title": "ReportType",
408 "type": "string",
409 "enum": [
410 "full",
411 "mutationScore"
412 ],
413 "tsEnumNames": [
414 "Full",
415 "MutationScore"
416 ]
417 },
418 "clearTextReporterOptions": {
419 "title": "ClearTextReporterOptions",
420 "type": "object",
421 "properties": {
422 "allowColor": {
423 "description": "Indicates whether or not to use color coding in output.",
424 "type": "boolean",
425 "default": true
426 },
427 "logTests": {
428 "description": "Indicates whether or not to log which tests were executed for a given mutant.",
429 "type": "boolean",
430 "default": true
431 },
432 "maxTestsToLog": {
433 "description": "Indicates the maximum amount of test to log when `logTests` is enabled",
434 "type": "integer",
435 "minimum": 0,
436 "default": 3
437 }
438 }
439 },
440 "dashboardOptions": {
441 "title": "DashboardOptions",
442 "additionalProperties": false,
443 "type": "object",
444 "properties": {
445 "project": {
446 "description": "Indicates which project to use if the \"dashboard\" reporter is enabled.",
447 "type": "string"
448 },
449 "version": {
450 "description": "Indicates which version to use if the \"dashboard\" reporter is enabled.",
451 "type": "string"
452 },
453 "module": {
454 "description": "Indicates which module to use if the \"dashboard\" reporter is enabled.",
455 "type": "string"
456 },
457 "baseUrl": {
458 "description": "Indicates the base url of the stryker dashboard.",
459 "type": "string",
460 "default": "https://dashboard.stryker-mutator.io/api/reports"
461 },
462 "reportType": {
463 "description": "Indicates wether to send a full report (inc. source code and mutant results) or only the mutation score.",
464 "$ref": "#/definitions/reportType",
465 "default": "full"
466 }
467 }
468 },
469 "eventRecorderOptions": {
470 "title": "EventRecorderOptions",
471 "additionalProperties": false,
472 "type": "object",
473 "properties": {
474 "baseDir": {
475 "description": "The base dir to write the events to",
476 "type": "string",
477 "default": "reports/mutation/events"
478 }
479 }
480 },
481 "htmlReporterOptions": {
482 "title": "HtmlReporterOptions",
483 "additionalProperties": false,
484 "type": "object",
485 "properties": {
486 "baseDir": {
487 "description": "The output folder for the html report.",
488 "type": "string",
489 "default": "reports/mutation/html"
490 }
491 }
492 },
493 "mutationScoreThresholds": {
494 "title": "MutationScoreThresholds",
495 "additionalProperties": false,
496 "type": "object",
497 "properties": {
498 "high": {
499 "$ref": "#/definitions/percentage",
500 "default": 80
501 },
502 "low": {
503 "$ref": "#/definitions/percentage",
504 "default": 60
505 },
506 "break": {
507 "oneOf": [
508 {
509 "type": "null"
510 },
511 {
512 "$ref": "#/definitions/percentage"
513 }
514 ],
515 "default": null
516 }
517 }
518 },
519 "percentage": {
520 "type": "number",
521 "minimum": 0,
522 "maximum": 100
523 },
524 "mutatorDescriptor": {
525 "type": "object",
526 "additionalProperties": false,
527 "properties": {
528 "plugins": {
529 "description": "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.",
530 "anyOf": [
531 {
532 "type": "array",
533 "items": {
534 "type": [
535 "string",
536 "array"
537 ]
538 }
539 },
540 {
541 "type": "null"
542 }
543 ],
544 "default": null
545 },
546 "excludedMutations": {
547 "type": "array",
548 "items": {
549 "type": "string"
550 },
551 "default": []
552 }
553 }
554 },
555 "warningOptions": {
556 "title": "WarningOptions",
557 "type": "object",
558 "default": {},
559 "properties": {
560 "unknownOptions": {
561 "description": "decide whether or not to log warnings when additional stryker options are configured",
562 "type": "boolean",
563 "default": true
564 },
565 "preprocessorErrors": {
566 "description": "decide whether or not to log warnings when a preprocessor error occurs. For example, when the disabling of type errors fails.",
567 "type": "boolean",
568 "default": true
569 }
570 }
571 },
572 "jestProjectType": {
573 "description": "The type of project you are working on. \n* `custom` uses the `config` option. \n*`create-react-app` when you are using [create-react-app](https://github.com/facebook/create-react-app)\n* `create-react-app-ts` when you are using [create-react-app-typescript](https://github.com/wmonk/create-react-app-typescript)\n* `react`: DEPRECATED, please use `create-react-app`.",
574 "enum": [
575 "create-react-app",
576 "create-react-app-ts",
577 "custom"
578 ]
579 },
580 "karmaProjectKind": {
581 "title": "ProjectKind",
582 "description": "Specify which kind of project you're using. This determines which command is used to start karma\n* `custom`: configure @stryker-mutator/karma-runner to use `karma start`\n* `angular-cli`: configure @stryker-mutator/karma-runner to use `ng test`",
583 "enum": [
584 "custom",
585 "angular-cli"
586 ]
587 },
588 "karmaNgConfigOptions": {
589 "title": "NgConfigOptions",
590 "type": "object",
591 "additionalProperties": false,
592 "properties": {
593 "testArguments": {
594 "description": "Add [ng test arguments](https://github.com/angular/angular-cli/wiki/test#options). For example, specify an alternative project with: `\"testArguments\": { \"project\": \"my-lib\" }",
595 "title": "NgTestArguments",
596 "type": "object",
597 "additionalProperties": {
598 "type": "string"
599 }
600 }
601 }
602 }
603 }
604}
\No newline at end of file