mootant 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/mootant.js +3 -2
- package/dist/adapters/jest/collect-jest-dependencies.d.ts +8 -6
- package/dist/adapters/jest/collect-jest-dependencies.js +20 -14
- package/dist/adapters/jest/get-jest-cache-inputs.d.ts +14 -13
- package/dist/adapters/jest/index.d.ts +3 -1
- package/dist/adapters/jest/run-dry.js +20 -20
- package/dist/adapters/jest/start-jest-session.d.ts +6 -2
- package/dist/adapters/jest/start-jest-session.js +9 -2
- package/dist/adapters/jest/types/jest-handle.d.ts +2 -1
- package/dist/adapters/jest/types/jest-record.d.ts +4 -3
- package/dist/adapters/jest/types/worker-channel.d.ts +7 -0
- package/dist/adapters/jest/worker/boot-worker.d.ts +5 -4
- package/dist/adapters/jest/worker/create-test-runner.d.ts +4 -1
- package/dist/adapters/jest/worker/keep-reset-loads.d.ts +13 -0
- package/dist/adapters/jest/worker/list-runtime-files.d.ts +13 -0
- package/dist/adapters/jest/worker/run-unit.d.ts +25 -20
- package/dist/adapters/jest/worker/vm-setup.js +1 -1
- package/dist/adapters/jest/worker/worker.js +1 -1
- package/dist/adapters/node-test/check-typescript.js +2 -2
- package/dist/adapters/node-test/collect-node-dependencies.d.ts +7 -5
- package/dist/adapters/node-test/collect-node-dependencies.js +26 -20
- package/dist/adapters/node-test/create-spare-processes.d.ts +26 -0
- package/dist/adapters/node-test/create-spare-processes.js +53 -0
- package/dist/adapters/node-test/filter-exec-argv.d.ts +2 -1
- package/dist/adapters/node-test/filter-exec-argv.js +13 -12
- package/dist/adapters/node-test/get-node-cache-inputs.js +1 -1
- package/dist/adapters/node-test/get-unit-deadline.d.ts +6 -5
- package/dist/adapters/node-test/index.d.ts +2 -2
- package/dist/adapters/node-test/index.js +1 -0
- package/dist/adapters/node-test/is-group-alive.d.ts +8 -0
- package/dist/adapters/node-test/is-group-alive.js +8 -0
- package/dist/adapters/node-test/list-setup-files.js +2 -2
- package/dist/adapters/node-test/place-preload.d.ts +2 -1
- package/dist/adapters/node-test/place-preload.js +24 -18
- package/dist/adapters/node-test/preload/create-commonjs-route.js +1 -1
- package/dist/adapters/node-test/preload/preload.js +54 -52
- package/dist/adapters/node-test/preload/read-line-sync.d.ts +11 -0
- package/dist/adapters/node-test/preload/read-line-sync.js +25 -0
- package/dist/adapters/node-test/preload/read-unit.d.ts +11 -5
- package/dist/adapters/node-test/preload/read-unit.js +5 -4
- package/dist/adapters/node-test/run-isolated.d.ts +19 -10
- package/dist/adapters/node-test/run-isolated.js +68 -52
- package/dist/adapters/node-test/run-test-file.d.ts +12 -4
- package/dist/adapters/node-test/run-test-file.js +18 -14
- package/dist/adapters/node-test/run-test-process.d.ts +30 -13
- package/dist/adapters/node-test/run-test-process.js +38 -40
- package/dist/adapters/node-test/start-node-test-session.d.ts +10 -2
- package/dist/adapters/node-test/start-node-test-session.js +90 -84
- package/dist/adapters/node-test/start-test-process.d.ts +30 -0
- package/dist/adapters/node-test/start-test-process.js +27 -0
- package/dist/adapters/node-test/types/node-test-handle.d.ts +14 -1
- package/dist/adapters/node-test/types/process-watch.d.ts +4 -3
- package/dist/adapters/node-test/types/spare-processes.d.ts +20 -0
- package/dist/adapters/node-test/types/test-process-outcome.d.ts +8 -1
- package/dist/adapters/shared/allows-spares.d.ts +11 -0
- package/dist/adapters/shared/allows-spares.js +23 -0
- package/dist/adapters/shared/create-environment-proxy.d.ts +4 -3
- package/dist/adapters/shared/create-input-filter.d.ts +17 -14
- package/dist/adapters/shared/create-input-filter.js +2 -2
- package/dist/adapters/shared/enable-compile-cache.d.ts +32 -0
- package/dist/adapters/shared/enable-compile-cache.js +7 -0
- package/dist/adapters/shared/find-tsconfig-property.d.ts +13 -0
- package/dist/adapters/shared/find-tsconfig-property.js +6 -0
- package/dist/adapters/shared/get-spare-limit.d.ts +10 -0
- package/dist/adapters/shared/get-spare-limit.js +5 -0
- package/dist/adapters/shared/index-environment-hashes.d.ts +2 -2
- package/dist/adapters/shared/index-environment-hashes.js +5 -13
- package/dist/adapters/{node-test → shared}/list-flag-values.d.ts +2 -1
- package/dist/adapters/shared/list-flag-values.js +10 -0
- package/dist/adapters/shared/list-tsconfig-files.d.ts +14 -5
- package/dist/adapters/shared/list-tsconfig-files.js +15 -13
- package/dist/adapters/shared/parse-tsconfig.d.ts +10 -0
- package/dist/adapters/shared/parse-tsconfig.js +19 -0
- package/dist/adapters/shared/read-flag-name.d.ts +9 -0
- package/dist/adapters/shared/read-flag-name.js +5 -0
- package/dist/adapters/shared/read-node-options.d.ts +11 -0
- package/dist/adapters/shared/read-node-options.js +6 -0
- package/dist/adapters/shared/read-prefork-switch.d.ts +10 -0
- package/dist/adapters/shared/read-prefork-switch.js +5 -0
- package/dist/adapters/shared/read-tsconfig-extends.d.ts +2 -5
- package/dist/adapters/shared/read-tsconfig-extends.js +16 -31
- package/dist/adapters/shared/read-tsconfig-references.d.ts +12 -0
- package/dist/adapters/shared/read-tsconfig-references.js +13 -0
- package/dist/adapters/shared/track-file-reads.d.ts +13 -12
- package/dist/adapters/shared/track-file-reads.js +71 -71
- package/dist/adapters/shared/track-process-group.d.ts +2 -1
- package/dist/adapters/shared/track-process-group.js +7 -2
- package/dist/adapters/vitest/build-isolated-facts.d.ts +4 -3
- package/dist/adapters/vitest/collect-dependencies.d.ts +11 -5
- package/dist/adapters/vitest/collect-dependencies.js +36 -27
- package/dist/adapters/vitest/configure-project.d.ts +3 -2
- package/dist/adapters/vitest/configure-project.js +1 -1
- package/dist/adapters/vitest/create-forks-pool.d.ts +34 -7
- package/dist/adapters/vitest/create-forks-pool.js +102 -24
- package/dist/adapters/vitest/create-interleaved-sequencer.d.ts +3 -2
- package/dist/adapters/vitest/drop-signal-listeners.d.ts +14 -0
- package/dist/adapters/vitest/drop-signal-listeners.js +15 -0
- package/dist/adapters/vitest/get-cache-inputs.d.ts +3 -1
- package/dist/adapters/vitest/get-cache-inputs.js +43 -28
- package/dist/adapters/vitest/get-module-file.d.ts +3 -5
- package/dist/adapters/vitest/get-module-file.js +1 -1
- package/dist/adapters/vitest/get-spare-key.d.ts +15 -0
- package/dist/adapters/vitest/get-spare-key.js +15 -0
- package/dist/adapters/vitest/index.d.ts +2 -1
- package/dist/adapters/vitest/index.js +1 -0
- package/dist/adapters/vitest/is-virtual-module.d.ts +1 -2
- package/dist/adapters/vitest/is-virtual-module.js +1 -1
- package/dist/adapters/vitest/list-script-defines.d.ts +13 -0
- package/dist/adapters/vitest/list-script-defines.js +22 -0
- package/dist/adapters/vitest/read-unit-inputs.d.ts +2 -1
- package/dist/adapters/vitest/run-dry.js +1 -1
- package/dist/adapters/vitest/run-plan.d.ts +10 -8
- package/dist/adapters/vitest/run-plan.js +1 -1
- package/dist/adapters/vitest/run-specifications.d.ts +9 -2
- package/dist/adapters/vitest/run-specifications.js +22 -12
- package/dist/adapters/vitest/runner.d.ts +60 -29
- package/dist/adapters/vitest/runner.js +109 -86
- package/dist/adapters/vitest/start-vitest-session.d.ts +5 -1
- package/dist/adapters/vitest/start-vitest-session.js +64 -59
- package/dist/adapters/vitest/stop-hung-worker.d.ts +11 -4
- package/dist/adapters/vitest/stop-hung-worker.js +20 -7
- package/dist/adapters/vitest/types/mootant-forks-pool.d.ts +47 -0
- package/dist/adapters/vitest/types/vitest-session-state.d.ts +9 -8
- package/dist/adapters/vitest/types/vitest-worker.d.ts +48 -33
- package/dist/adapters/vitest/wait-for-workers.d.ts +5 -2
- package/dist/adapters/vitest/wait-for-workers.js +15 -15
- package/dist/adapters/vitest/worker/track-meta-defines.d.ts +39 -0
- package/dist/adapters/vitest/worker/track-meta-defines.js +23 -0
- package/dist/adapters/vitest/worker/track-values.d.ts +38 -0
- package/dist/adapters/vitest/worker/track-values.js +45 -0
- package/dist/adapters/vitest/worker/value-prefixes.d.ts +12 -0
- package/dist/adapters/vitest/worker/value-prefixes.js +6 -0
- package/dist/adapters/vitest/worker/wait-for-turn.d.ts +8 -6
- package/dist/adapters/vitest/worker/watch-property.d.ts +17 -0
- package/dist/adapters/vitest/worker/watch-property.js +27 -0
- package/dist/cli/create-run-progress.d.ts +8 -1
- package/dist/cli/create-run-progress.js +4 -1
- package/dist/cli/ensure-exit.d.ts +11 -0
- package/dist/cli/ensure-exit.js +15 -0
- package/dist/cli/html/build-html-report.js +1 -0
- package/dist/cli/html/client/main.js +1 -1
- package/dist/cli/html/client/render-overview.d.ts +3 -3
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +3 -2
- package/dist/cli/parse-arguments.d.ts +4 -0
- package/dist/cli/parse-arguments.js +4 -1
- package/dist/cli/report/build-run-report.js +1 -0
- package/dist/cli/report/format-command.d.ts +5 -0
- package/dist/cli/report/format-command.js +1 -1
- package/dist/cli/report/format-run-text-report.d.ts +5 -4
- package/dist/cli/report/format-run-text-report.js +10 -10
- package/dist/cli/report/slim-run-report.d.ts +10 -10
- package/dist/cli/report/slim-run-report.js +1 -0
- package/dist/cli/run-mutation.d.ts +5 -1
- package/dist/cli/run-mutation.js +32 -24
- package/dist/cli/terminal/create-spinner.d.ts +1 -2
- package/dist/cli/terminal/create-spinner.js +23 -32
- package/dist/cli/watch-interrupts.d.ts +41 -0
- package/dist/cli/watch-interrupts.js +32 -0
- package/dist/core/cache/apply-cached-units.d.ts +8 -7
- package/dist/core/cache/build-hash.d.ts +9 -0
- package/dist/core/cache/build-hash.js +2 -0
- package/dist/core/cache/cache-version.d.ts +4 -4
- package/dist/core/cache/check-dry-snapshot.d.ts +25 -0
- package/dist/core/cache/check-dry-snapshot.js +13 -0
- package/dist/core/cache/create-dry-reuse-miss.d.ts +12 -0
- package/dist/core/cache/create-dry-reuse-miss.js +7 -0
- package/dist/core/cache/create-dry-snapshot.d.ts +71 -0
- package/dist/core/cache/create-dry-snapshot.js +27 -0
- package/dist/core/cache/create-run-cache.d.ts +20 -2
- package/dist/core/cache/create-run-cache.js +31 -22
- package/dist/core/cache/create-snapshot-session.d.ts +12 -0
- package/dist/core/cache/create-snapshot-session.js +19 -0
- package/dist/core/cache/get-build-id.d.ts +11 -0
- package/dist/core/cache/get-build-id.js +7 -0
- package/dist/core/cache/get-cache-path.d.ts +1 -1
- package/dist/core/cache/get-cache-path.js +1 -1
- package/dist/core/cache/get-dry-snapshot-key.d.ts +47 -0
- package/dist/core/cache/get-dry-snapshot-key.js +43 -0
- package/dist/core/cache/get-dry-snapshot-path.d.ts +9 -0
- package/dist/core/cache/get-dry-snapshot-path.js +5 -0
- package/dist/core/cache/get-environment-key.d.ts +9 -4
- package/dist/core/cache/get-environment-key.js +3 -2
- package/dist/core/cache/get-test-file-keys.d.ts +2 -1
- package/dist/core/cache/get-test-file-keys.js +11 -10
- package/dist/core/cache/hash-files.d.ts +8 -7
- package/dist/core/cache/hash-files.js +17 -11
- package/dist/core/cache/hash-project-tree.d.ts +22 -0
- package/dist/core/cache/hash-project-tree.js +69 -0
- package/dist/core/cache/is-dry-reuse-miss.d.ts +8 -0
- package/dist/core/cache/is-dry-reuse-miss.js +4 -0
- package/dist/core/cache/list-file-hashes.d.ts +4 -0
- package/dist/core/cache/list-file-hashes.js +5 -2
- package/dist/core/cache/list-install-states.d.ts +12 -0
- package/dist/core/cache/list-install-states.js +19 -0
- package/dist/core/cache/list-variable-hashes.d.ts +15 -0
- package/dist/core/cache/list-variable-hashes.js +14 -0
- package/dist/core/cache/prepare-run-cache.d.ts +48 -22
- package/dist/core/cache/prepare-run-cache.js +86 -73
- package/dist/core/cache/read-dry-snapshot.d.ts +10 -0
- package/dist/core/cache/read-dry-snapshot.js +15 -0
- package/dist/core/cache/read-run-cache.js +6 -2
- package/dist/core/cache/save-dry-snapshot.d.ts +34 -0
- package/dist/core/cache/save-dry-snapshot.js +32 -0
- package/dist/core/cache/volatile-variables.d.ts +7 -0
- package/dist/core/cache/volatile-variables.js +11 -0
- package/dist/core/cache/write-run-cache.js +1 -1
- package/dist/core/config/load-typescript-config.d.ts +6 -1
- package/dist/core/config/load-typescript-config.js +26 -10
- package/dist/core/config/prepare-run.d.ts +7 -3
- package/dist/core/config/prepare-run.js +1 -0
- package/dist/core/config/resolve-run-settings.d.ts +3 -2
- package/dist/core/config/resolve-run-settings.js +1 -0
- package/dist/core/config/validate-config.js +3 -2
- package/dist/core/files/get-package-manifest.d.ts +12 -0
- package/dist/core/files/get-package-manifest.js +7 -0
- package/dist/core/generate/collect-candidates.d.ts +5 -1
- package/dist/core/generate/collect-candidates.js +125 -97
- package/dist/core/generate/generate-file-mutants.js +6 -5
- package/dist/core/index.d.ts +18 -0
- package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-comparison-plan.d.ts +2 -2
- package/dist/core/mutators/shared/get-default-option-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-group-constant.d.ts +2 -2
- package/dist/core/mutators/shared/get-literal-skip.d.ts +3 -3
- package/dist/core/mutators/shared/get-loop-running-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-nullish-swap-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-or-default-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-owned-constants.d.ts +2 -2
- package/dist/core/mutators/shared/leave-now-skip.d.ts +2 -2
- package/dist/core/mutators/shared/no-op-callback-skip.d.ts +2 -2
- package/dist/core/plugins/create-mutator-registry.d.ts +4 -2
- package/dist/core/plugins/create-mutator-registry.js +15 -5
- package/dist/core/plugins/validate-plugin.d.ts +3 -3
- package/dist/core/plugins/validate-plugin.js +32 -10
- package/dist/core/regex/collect-pattern-changes.d.ts +2 -2
- package/dist/core/regex/create-regex-replacement.d.ts +2 -2
- package/dist/core/run/apply-isolated-result.d.ts +22 -14
- package/dist/core/run/apply-isolated-result.js +45 -26
- package/dist/core/run/count-run.d.ts +2 -1
- package/dist/core/run/create-run-state.d.ts +5 -0
- package/dist/core/run/create-run-state.js +1 -0
- package/dist/core/run/create-work-directory.d.ts +4 -1
- package/dist/core/run/create-work-directory.js +15 -12
- package/dist/core/run/decide-evidence.d.ts +4 -3
- package/dist/core/run/get-unit-evidence.d.ts +13 -7
- package/dist/core/run/get-unit-evidence.js +1 -1
- package/dist/core/run/guard-session.d.ts +18 -0
- package/dist/core/run/guard-session.js +30 -0
- package/dist/core/run/live-work-directories.d.ts +5 -0
- package/dist/core/run/live-work-directories.js +2 -0
- package/dist/core/run/read-isolated-unit.d.ts +6 -3
- package/dist/core/run/read-isolated-unit.js +77 -38
- package/dist/core/run/remove-live-work-directories.d.ts +7 -0
- package/dist/core/run/remove-live-work-directories.js +12 -0
- package/dist/core/run/run-isolated-rounds.d.ts +16 -12
- package/dist/core/run/run-isolated-rounds.js +3 -2
- package/dist/core/run/validate-adapter.d.ts +1 -1
- package/dist/core/run/validate-adapter.js +1 -1
- package/dist/core/run-mutants.d.ts +34 -2
- package/dist/core/run-mutants.js +356 -216
- package/dist/core/skips/skip-rules.d.ts +3 -1
- package/dist/package.js +1 -1
- package/dist/types/adapter/adapter-context.d.ts +20 -0
- package/dist/types/adapter/adapter-session.d.ts +2 -1
- package/dist/types/adapter/cache-inputs.d.ts +3 -2
- package/dist/types/adapter/dry-file.d.ts +4 -2
- package/dist/types/adapter/isolated-plan.d.ts +2 -1
- package/dist/types/adapter/isolated-result.d.ts +3 -1
- package/dist/types/adapter/run-inputs.d.ts +5 -4
- package/dist/types/adapter/test-adapter.d.ts +7 -0
- package/dist/types/cache/cache-entry.d.ts +9 -7
- package/dist/types/cache/cached-inputs.d.ts +2 -2
- package/dist/types/cache/dry-snapshot.d.ts +76 -0
- package/dist/types/cache/project-tree.d.ts +16 -0
- package/dist/types/cache/run-cache-file.d.ts +1 -1
- package/dist/types/cache/run-cache.d.ts +6 -5
- package/dist/types/config/plugin.d.ts +11 -2
- package/dist/types/config/run-config.d.ts +10 -0
- package/dist/types/config/run-settings.d.ts +6 -0
- package/dist/types/mutant/core-note.d.ts +12 -0
- package/dist/types/mutant/diagnostic.d.ts +1 -0
- package/dist/types/mutant/registered-skip-rule.d.ts +11 -0
- package/dist/types/mutant/skip-note.d.ts +7 -6
- package/dist/types/mutant/skip-rule-id.d.ts +3 -2
- package/dist/types/mutant/skip-rule.d.ts +2 -1
- package/dist/types/mutant/skipped-candidate.d.ts +14 -7
- package/dist/types/mutant/skipped-mutant.d.ts +6 -6
- package/dist/types/mutator/mutator.d.ts +3 -2
- package/dist/types/mutator/registered-mutator.d.ts +8 -0
- package/dist/types/regex/regex-change.d.ts +2 -2
- package/dist/types/report/html-report.d.ts +3 -2
- package/dist/types/report/list-report-skipped.d.ts +3 -2
- package/dist/types/report/run-report.d.ts +11 -2
- package/dist/types/report/slim-run-report.d.ts +1 -1
- package/dist/types/run/isolated-evidence.d.ts +3 -2
- package/dist/types/run/isolated-reason.d.ts +2 -1
- package/dist/types/run/run-durations.d.ts +8 -3
- package/dist/types/run/run-event.d.ts +10 -7
- package/dist/types/run/run-result.d.ts +11 -2
- package/dist/types/run/run-state.d.ts +21 -0
- package/dist/types/run/try-cause.d.ts +2 -1
- package/package.json +1 -1
- package/readme.md +85 -68
- package/skills/mootant/SKILL.md +36 -19
- package/skills/mootant/references/mutators.md +29 -23
- package/dist/adapters/node-test/list-flag-values.js +0 -9
- /package/dist/adapters/{node-test → shared}/loader-flags.d.ts +0 -0
- /package/dist/adapters/{node-test → shared}/loader-flags.js +0 -0
- /package/dist/{adapters/shared → core/files}/list-package-files.d.ts +0 -0
- /package/dist/{adapters/shared → core/files}/list-package-files.js +0 -0
- /package/dist/{adapters/shared → core/files}/read-package-type.d.ts +0 -0
- /package/dist/{adapters/shared → core/files}/read-package-type.js +0 -0
|
@@ -111,7 +111,8 @@ export interface RunReportMutant extends Omit<ListReportMutant, 'status'> {
|
|
|
111
111
|
*/
|
|
112
112
|
export interface RunReportSummary {
|
|
113
113
|
/**
|
|
114
|
-
* Test runner runs by kind; kinds that did not run are left out
|
|
114
|
+
* Test runner runs by kind; kinds that did not run are left out, the dry run
|
|
115
|
+
* too when the run reused the dry run of an earlier run.
|
|
115
116
|
*/
|
|
116
117
|
runs: Partial<Record<RunKind, number>>
|
|
117
118
|
|
|
@@ -214,7 +215,8 @@ export interface RunReportSummary {
|
|
|
214
215
|
totalErrors: number
|
|
215
216
|
|
|
216
217
|
/**
|
|
217
|
-
* Tests the dry run ran
|
|
218
|
+
* Tests the dry run ran, or the dry run of an earlier run that the run
|
|
219
|
+
* reused.
|
|
218
220
|
*/
|
|
219
221
|
totalTests: number
|
|
220
222
|
|
|
@@ -285,6 +287,13 @@ export interface RunReport {
|
|
|
285
287
|
*/
|
|
286
288
|
files: ListReportFile[]
|
|
287
289
|
|
|
290
|
+
/**
|
|
291
|
+
* True when isolated units of one test file ran at the same time
|
|
292
|
+
* (`run.parallelUnits`), so tests that share a fixed file, port or database
|
|
293
|
+
* may have given false verdicts, mostly false kills; left out otherwise.
|
|
294
|
+
*/
|
|
295
|
+
parallelUnits?: true
|
|
296
|
+
|
|
288
297
|
/**
|
|
289
298
|
* Version of the report shape. It changes when a field changes meaning or is
|
|
290
299
|
* removed; new fields do not change it.
|
|
@@ -115,7 +115,7 @@ export interface SlimRunReportSummary extends Pick<
|
|
|
115
115
|
*/
|
|
116
116
|
export interface SlimRunReport extends Pick<
|
|
117
117
|
RunReport,
|
|
118
|
-
'runner' | 'listed' | 'preset' | 'mode'
|
|
118
|
+
'parallelUnits' | 'runner' | 'listed' | 'preset' | 'mode'
|
|
119
119
|
> {
|
|
120
120
|
/**
|
|
121
121
|
* Mutants of the mutated files, in file and canonical order: the ones to act
|
|
@@ -2,8 +2,9 @@ import { MutantVerdict } from './mutant-state.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Evidence of one isolated test file of a mutant: a kill, a timeout or an
|
|
4
4
|
* error, `none` for a file done without one (it passed or did not reach the
|
|
5
|
-
* mutant), `confirming` while a timeout waits for its confirmation
|
|
6
|
-
* `retrying` while a unit the test runner
|
|
5
|
+
* mutant), `confirming` while a timeout waits for its confirmation or a crash
|
|
6
|
+
* for the second run of its unit, or `retrying` while a unit the test runner
|
|
7
|
+
* did not report, or an inconclusive one, waits for its retry.
|
|
7
8
|
*/
|
|
8
9
|
export type IsolatedEvidence =
|
|
9
10
|
MutantVerdict | 'confirming' | 'retrying' | 'none'
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* - `batch-survivor`: it passed every batch try that reached it; batch passes are
|
|
14
14
|
* not trusted, so a fresh module graph with its whole covering test files
|
|
15
15
|
* decides whether it survives;
|
|
16
|
-
* - `recovery`: batch tries
|
|
16
|
+
* - `recovery`: its batch tries were still missing after two recovery runs, or
|
|
17
|
+
* went missing in the confirmation run;
|
|
17
18
|
* - `no-batch`: in fast mode, the adapter has no batch mode.
|
|
18
19
|
*/
|
|
19
20
|
export type IsolatedReason =
|
|
@@ -9,17 +9,22 @@ export interface RunDurations {
|
|
|
9
9
|
batch: number | null
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Isolated runs, retries and confirmations included
|
|
12
|
+
* Isolated runs, retries and confirmations included, and saving the cache and
|
|
13
|
+
* the dry run for later runs.
|
|
13
14
|
*/
|
|
14
15
|
isolated: number
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* Loading the configuration, listing mutants
|
|
18
|
+
* Loading the configuration, listing mutants, checking the dry run of an
|
|
19
|
+
* earlier run and hashing the project, and starting the test runner when that
|
|
20
|
+
* dry run is not reused.
|
|
18
21
|
*/
|
|
19
22
|
startup: number
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
|
-
* Dry runs, the uninstrumented check of failing tests included
|
|
25
|
+
* Dry runs, the uninstrumented check of failing tests included, and preparing
|
|
26
|
+
* the cache; only the latter when the run reuses the dry run of an earlier
|
|
27
|
+
* run.
|
|
23
28
|
*/
|
|
24
29
|
dryRun: number
|
|
25
30
|
|
|
@@ -3,11 +3,13 @@ import { RunKind } from './run-kind.js';
|
|
|
3
3
|
* What happens in a mutation run, as it happens; the command line turns these
|
|
4
4
|
* into live progress. Events come in this order: `mutants`, `dry-start`, units
|
|
5
5
|
* of the dry run, a `dry-again` before each later dry run, `dry-end`, then for
|
|
6
|
-
* every later run of the test runner a `run-start` and its units
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* every later run of the test runner a `run-start` and its units; a run that
|
|
7
|
+
* reuses the dry run of an earlier run has neither `dry-start` nor `dry-end`,
|
|
8
|
+
* and the events of its phases come all at once as it ends. When tests fail
|
|
9
|
+
* without mutants, `dry-failed` comes before the run throws. `verdicts` comes
|
|
10
|
+
* whenever the counts of decided mutants change, from right before the first
|
|
11
|
+
* `run-start` on; the last one counts the final results. `note` and `output`
|
|
12
|
+
* may come at any point.
|
|
11
13
|
*/
|
|
12
14
|
export type RunEvent =
|
|
13
15
|
| {
|
|
@@ -42,8 +44,9 @@ export type RunEvent =
|
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
46
|
* Distinct mutants of an isolated round whose units run again, as the
|
|
45
|
-
* test runner lost what they gave,
|
|
46
|
-
* in
|
|
47
|
+
* test runner lost what they gave, something else stopped the tests that
|
|
48
|
+
* reach them or their process died, and are not counted in `confirming`;
|
|
49
|
+
* 0 in other runs.
|
|
47
50
|
*/
|
|
48
51
|
retrying: number
|
|
49
52
|
|
|
@@ -13,7 +13,8 @@ import { RunMode } from './run-mode.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface RunResult {
|
|
15
15
|
/**
|
|
16
|
-
* Test runner runs by kind; kinds that did not run are left out
|
|
16
|
+
* Test runner runs by kind; kinds that did not run are left out, the dry run
|
|
17
|
+
* too when the run reused the dry run of an earlier run.
|
|
17
18
|
*/
|
|
18
19
|
runs: Partial<Record<RunKind, number>>
|
|
19
20
|
|
|
@@ -60,6 +61,13 @@ export interface RunResult {
|
|
|
60
61
|
*/
|
|
61
62
|
results: MutantResult[]
|
|
62
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Whether isolated units of one test file ran at the same time
|
|
66
|
+
* (`run.parallelUnits` with an adapter that runs them), so tests that share a
|
|
67
|
+
* fixed file, port or database may have given false verdicts.
|
|
68
|
+
*/
|
|
69
|
+
parallelUnits: boolean
|
|
70
|
+
|
|
63
71
|
/**
|
|
64
72
|
* Durations of the phases.
|
|
65
73
|
*/
|
|
@@ -83,7 +91,8 @@ export interface RunResult {
|
|
|
83
91
|
listedIds: string[]
|
|
84
92
|
|
|
85
93
|
/**
|
|
86
|
-
* Tests the dry run saw
|
|
94
|
+
* Tests the dry run saw, or the dry run of an earlier run that the run
|
|
95
|
+
* reused.
|
|
87
96
|
*/
|
|
88
97
|
tests: DryTest[]
|
|
89
98
|
|
|
@@ -49,6 +49,13 @@ export interface RunState {
|
|
|
49
49
|
*/
|
|
50
50
|
live: LiveVerdicts | null
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Whether isolated units of one test file may run at the same time
|
|
54
|
+
* (`AdapterContext.parallelUnits`), so they form no serial chain; false or
|
|
55
|
+
* omitted when they run one after another.
|
|
56
|
+
*/
|
|
57
|
+
parallelUnits?: boolean
|
|
58
|
+
|
|
52
59
|
/**
|
|
53
60
|
* Verdicts of earlier runs to reuse and the evidence of this run to store, or
|
|
54
61
|
* null when the cache is off.
|
|
@@ -80,11 +87,25 @@ export interface RunState {
|
|
|
80
87
|
* One mutant planned in one test file on the isolated path.
|
|
81
88
|
*/
|
|
82
89
|
export interface IsolatedRequest {
|
|
90
|
+
/**
|
|
91
|
+
* Whether an earlier unit of the mutant in the test file was inconclusive:
|
|
92
|
+
* something else stopped the tests that reach the mutant before they got to
|
|
93
|
+
* it, so an inconclusive unit now gives `Error`; false or omitted when none
|
|
94
|
+
* was.
|
|
95
|
+
*/
|
|
96
|
+
inconclusive?: boolean
|
|
97
|
+
|
|
83
98
|
/**
|
|
84
99
|
* Whether the unit confirms a timeout of an earlier unit.
|
|
85
100
|
*/
|
|
86
101
|
confirming: boolean
|
|
87
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Whether an earlier unit of the mutant in the test file crashed, so a crash
|
|
105
|
+
* of this one kills.
|
|
106
|
+
*/
|
|
107
|
+
crashed: boolean
|
|
108
|
+
|
|
88
109
|
/**
|
|
89
110
|
* Whether the unit already went missing once.
|
|
90
111
|
*/
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* `aroundAll`) or the file teardown, such as the cleanup of a worker-scoped
|
|
10
10
|
* fixture or the teardown of the test environment, failed with the mutant
|
|
11
11
|
* active, or the test file failed outside its tests (isolated path);
|
|
12
|
-
* - `crash`: the worker died with the mutant active
|
|
12
|
+
* - `crash`: the worker died with the mutant active, and again in a later run of
|
|
13
|
+
* the unit (isolated path);
|
|
13
14
|
* - `hit-limit`: the hit counter stopped a loop or far hotter code (confirmed
|
|
14
15
|
* with doubled time and `factor × floor` more evaluations);
|
|
15
16
|
* - `time-limit`: a timer stopped stuck or far slower code (confirmed with
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
# Mootant
|
|
2
2
|
|
|
3
|
-
<
|
|
4
|
-
<source
|
|
5
|
-
srcset="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-light.svg"
|
|
6
|
-
media="(prefers-color-scheme: light)"
|
|
7
|
-
/>
|
|
8
|
-
<source
|
|
9
|
-
srcset="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-dark.svg"
|
|
10
|
-
media="(prefers-color-scheme: dark)"
|
|
11
|
-
/>
|
|
3
|
+
<a href="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-light.svg">
|
|
12
4
|
<img
|
|
13
5
|
src="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-light.svg"
|
|
14
6
|
alt="Mootant Logo"
|
|
15
7
|
align="right"
|
|
16
|
-
height="160"
|
|
17
8
|
width="160"
|
|
18
9
|
/>
|
|
19
|
-
</
|
|
10
|
+
</a>
|
|
20
11
|
|
|
21
12
|
[](https://npmjs.com/package/mootant)
|
|
22
13
|
[](https://codecov.io/gh/azat-io/mootant)
|
|
@@ -25,12 +16,13 @@
|
|
|
25
16
|
Find the gaps in your tests.
|
|
26
17
|
|
|
27
18
|
Mutation testing for JavaScript and TypeScript. Mootant makes small changes to
|
|
28
|
-
your code
|
|
29
|
-
|
|
19
|
+
your code and shows which ones your tests miss. Use the findings to strengthen
|
|
20
|
+
your tests, or let your coding agent add missing cases and verify them with
|
|
21
|
+
Mootant's agent skill.
|
|
30
22
|
|
|
31
23
|
## See what your tests miss
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
Tests can miss a bug even with full coverage. In the
|
|
34
26
|
[sample shop](https://github.com/azat-io/mootant/tree/main/docs/demo), the tests
|
|
35
27
|
run every line and branch of `src/discount.ts`, yet all of them still pass after
|
|
36
28
|
Mootant makes this change:
|
|
@@ -40,36 +32,48 @@ Mootant makes this change:
|
|
|
40
32
|
+ if (total > 100 || isMember) {
|
|
41
33
|
```
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
No test checks a non-member's order of exactly 100, where this change removes
|
|
36
|
+
the discount. The change, called a mutant, survives because the tests miss it.
|
|
37
|
+
|
|
38
|
+
Mootant shows the diff and suggests `test/discount.test.ts` as the file to
|
|
39
|
+
extend. Add the missing boundary case:
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
```ts
|
|
42
|
+
it('gives orders of exactly 100 a discount', () => {
|
|
43
|
+
expect(getDiscount(100, false)).toBe(10)
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then re-check the mutant to confirm that your test catches it. Use the id from
|
|
48
|
+
your report; in this example, it is `q31p`:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npx mootant run src --mutant q31p
|
|
52
|
+
```
|
|
50
53
|
|
|
51
54
|
## Why Mootant
|
|
52
55
|
|
|
53
|
-
- **
|
|
54
|
-
|
|
55
|
-
and
|
|
56
|
-
- **
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
file. Re-check one mutant as you improve the tests, or export JSON for tools
|
|
62
|
-
and agents.
|
|
63
|
-
- **Check your next change.** Mootant caches verdicts between runs. In CI, check
|
|
64
|
-
changed lines with `--since` and set a passing score with `--threshold`.
|
|
56
|
+
- **Find hidden gaps.** Check edge cases in existing or AI-written tests.
|
|
57
|
+
- **Simulate common mistakes.** [Mutate](https://mootant.org/mutators) `await`s,
|
|
58
|
+
calls, return values and regular expressions.
|
|
59
|
+
- **Keep your setup.** Use your existing tests and configuration.
|
|
60
|
+
- **Less noise, faster reruns.** Skip duplicate and likely equivalent mutants,
|
|
61
|
+
and reuse cached verdicts.
|
|
62
|
+
- **Ready for CI.** Check changed lines with `--since` and enforce a minimum
|
|
63
|
+
score with `--threshold`.
|
|
65
64
|
|
|
66
65
|
## Getting started
|
|
67
66
|
|
|
68
67
|
> **Early development.** Expect breaking changes.
|
|
69
68
|
|
|
70
|
-
You need passing tests
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
You need passing tests with one of these runners:
|
|
70
|
+
|
|
71
|
+
- **Vitest** 5, including Vue and Svelte components.
|
|
72
|
+
- **Jest** 29.7 or 30.
|
|
73
|
+
- **Node Test**, the test runner built into Node.js.
|
|
74
|
+
|
|
75
|
+
See [compatibility](https://mootant.org/guide/compatibility) for supported
|
|
76
|
+
Node.js versions and other limits.
|
|
73
77
|
|
|
74
78
|
Install Mootant and point it at your source code:
|
|
75
79
|
|
|
@@ -78,49 +82,62 @@ npm install -D mootant
|
|
|
78
82
|
npx mootant run src
|
|
79
83
|
```
|
|
80
84
|
|
|
81
|
-
Mootant
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
Mootant applies mutations in memory, leaving your source files untouched. The
|
|
86
|
+
terminal report shows the changes your tests missed and suggests test files to
|
|
87
|
+
extend.
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
turn a surviving mutant into a test that catches it.
|
|
89
|
+
## Improve tests with your AI agent
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
Mootant ships with an [agent skill](https://mootant.org/agent-skill) for Claude
|
|
92
|
+
Code, Codex, Cursor and other coding agents. It guides your agent to read the
|
|
93
|
+
report, add missing tests and rerun Mootant to verify that they catch the
|
|
94
|
+
changes. You review the new tests.
|
|
89
95
|
|
|
90
|
-
|
|
91
|
-
with the lowest scores. Add `--html` to write `.mootant/report.html`, a single
|
|
92
|
-
file that opens offline:
|
|
96
|
+
With Mootant installed in your project, install the skill (Node.js 22.20+):
|
|
93
97
|
|
|
94
98
|
```sh
|
|
95
|
-
npx
|
|
99
|
+
npx skills add azat-io/mootant
|
|
96
100
|
```
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
srcset="https://raw.githubusercontent.com/azat-io/mootant/main/docs/public/report-overview-dark.webp"
|
|
104
|
-
media="(prefers-color-scheme: dark)"
|
|
105
|
-
/>
|
|
106
|
-
<img
|
|
107
|
-
src="https://raw.githubusercontent.com/azat-io/mootant/main/docs/public/report-overview-light.webp"
|
|
108
|
-
alt="Mootant report for a sample shop, showing surviving mutants and the mutators its tests miss."
|
|
109
|
-
width="900"
|
|
110
|
-
/>
|
|
111
|
-
</picture>
|
|
112
|
-
</a>
|
|
102
|
+
Then ask your agent:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
Fix the surviving mutants in src.
|
|
106
|
+
```
|
|
113
107
|
|
|
114
|
-
|
|
115
|
-
[learn about the HTML report](https://mootant.org/guide/report).
|
|
108
|
+
## Check changes in CI
|
|
116
109
|
|
|
117
|
-
|
|
110
|
+
Check the lines changed in a pull request and fail CI if their mutation score
|
|
111
|
+
falls below a threshold:
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
```sh
|
|
114
|
+
npx mootant run src --since origin/main --threshold 80
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
This requires a score of at least 80%. Replace `origin/main` with your target
|
|
118
|
+
branch and fetch it with enough history to find the merge base. See the
|
|
119
|
+
[CLI reference](https://mootant.org/guide/cli#shared-options) for details.
|
|
120
|
+
|
|
121
|
+
## Explore the HTML report
|
|
122
|
+
|
|
123
|
+
Find the files with the weakest scores, inspect each mutant in its code and see
|
|
124
|
+
which tests reach it. Generate the report with:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
npx mootant run src --html
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Mootant writes `.mootant/report.html`, a single file you can open offline or
|
|
131
|
+
keep as a CI artifact. Add `.mootant` to `.gitignore`: the report includes your
|
|
132
|
+
source code.
|
|
133
|
+
|
|
134
|
+
<a href="https://mootant.org/reports/html/demo">
|
|
135
|
+
<img
|
|
136
|
+
src="https://raw.githubusercontent.com/azat-io/mootant/main/docs/public/report-overview-light.webp"
|
|
137
|
+
alt="Mootant HTML report showing mutation scores and surviving mutants in a sample shop."
|
|
138
|
+
width="900"
|
|
139
|
+
/>
|
|
140
|
+
</a>
|
|
124
141
|
|
|
125
142
|
## Contributing
|
|
126
143
|
|
package/skills/mootant/SKILL.md
CHANGED
|
@@ -74,29 +74,37 @@ wrap redirects in `cmd /c "..."`, since its `>` writes UTF-16.
|
|
|
74
74
|
node -e "const fs=require('fs');fs.mkdirSync('.mootant',{recursive:true});fs.existsSync('.mootant/.gitignore')||fs.writeFileSync('.mootant/.gitignore','*')"
|
|
75
75
|
|
|
76
76
|
# The first run
|
|
77
|
-
<mootant> run [<paths>] [--since <base>] --no-fast --no-incremental [--mutant <id>] --json > .mootant/before.json 2> .mootant/before.log
|
|
77
|
+
<mootant> run [<paths>] [--since <base>] --no-fast --no-incremental --no-parallel-units [--mutant <id>] --json > .mootant/before.json 2> .mootant/before.log
|
|
78
78
|
|
|
79
79
|
# Problems of a run, then one line per mutant
|
|
80
80
|
node -e "const r=require('./.mootant/before.json');console.log(JSON.stringify({schemaVersion:r.schemaVersion,diagnostics:r.diagnostics,summary:r.summary}))"
|
|
81
81
|
node -e "for(const m of require('./.mootant/before.json').mutants)console.log(m.id,m.status,m.file+':'+(m.focus||m).line,m.scope||'-',m.mutator,m.tests)"
|
|
82
82
|
|
|
83
|
-
# A recheck: the mutant's recheck with <mootant> in place of mootant, always with --no-fast --no-incremental
|
|
84
|
-
<mootant> run [<paths>] --no-fast --no-incremental --mutant <id> [--mutant <id>] --json --all > .mootant/recheck.json 2> .mootant/recheck.log
|
|
83
|
+
# A recheck: the mutant's recheck with <mootant> in place of mootant, always with --no-fast --no-incremental --no-parallel-units
|
|
84
|
+
<mootant> run [<paths>] --no-fast --no-incremental --no-parallel-units --mutant <id> [--mutant <id>] --json --all > .mootant/recheck.json 2> .mootant/recheck.log
|
|
85
85
|
|
|
86
86
|
# The last run: the first run's command with --all, then the final status of full ids and any new problem ids
|
|
87
|
-
<mootant> run [<paths>] [--since <base>] --no-fast --no-incremental [--mutant <id>] --json --all > .mootant/after.json 2> .mootant/after.log
|
|
87
|
+
<mootant> run [<paths>] [--since <base>] --no-fast --no-incremental --no-parallel-units [--mutant <id>] --json --all > .mootant/after.json 2> .mootant/after.log
|
|
88
88
|
node -e "const b=require('./.mootant/before.json').mutants.map(m=>m.id),a=require('./.mootant/after.json').mutants;for(const id of process.argv.slice(1))console.log(id,(a.find(m=>m.id===id)||{status:'missing'}).status);for(const m of a)if(!b.includes(m.id)&&['Survived','NoCoverage','Error'].includes(m.status))console.log('new',m.id,m.status)" <id> <id>
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
A mutant in the report has
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
A mutant in the report has these fields:
|
|
92
|
+
|
|
93
|
+
| Field | Meaning |
|
|
94
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `id` | Mutant id |
|
|
96
|
+
| `file`, `line` | Source file and line |
|
|
97
|
+
| `mutator`, `status` | Mutator name and run verdict |
|
|
98
|
+
| `before`, `after` | Source lines before and after the change; `…` marks a cut |
|
|
99
|
+
| `scope` | The function or constant containing the mutant |
|
|
100
|
+
| `focus` | The part that changes, when smaller than the line |
|
|
101
|
+
| `test` | The first covering test: file, name and line |
|
|
102
|
+
| `testFiles` | An object of test files to extend, best first, each with its number of covering tests |
|
|
103
|
+
| `tests` | Number of covering tests. On a survivor, 0 means only module loading, a setup file or a hook such as `beforeAll` reached it |
|
|
104
|
+
| `recheck` | Command to run the mutant again |
|
|
105
|
+
|
|
106
|
+
With `--all`, killed and timed-out mutants keep only `id`, `file`, `line`,
|
|
107
|
+
`column`, `mutator`, `status` and `killedIn`.
|
|
100
108
|
|
|
101
109
|
| Recheck status | Meaning |
|
|
102
110
|
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -200,12 +208,21 @@ that comes back gets its own row.
|
|
|
200
208
|
|
|
201
209
|
## Report
|
|
202
210
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
Include these parts in the report:
|
|
212
|
+
|
|
213
|
+
- Scope and command.
|
|
214
|
+
- The score of that scope before → after, with the counts of errors and `Error`
|
|
215
|
+
mutants. `Error` mutants are excluded from the score.
|
|
216
|
+
- Killed mutants, confirmed by the last run.
|
|
217
|
+
- Needs your decision: pinned tests, suspected bugs, equivalent mutants and
|
|
218
|
+
anything that needs installing. For a proposed ignore comment, list every
|
|
219
|
+
mutant it would hide and why each is equivalent.
|
|
220
|
+
- Could not kill.
|
|
221
|
+
- Not testable.
|
|
222
|
+
- Not reached.
|
|
223
|
+
- Changed files.
|
|
224
|
+
|
|
225
|
+
Commit, push or open a pull request only when the user asks.
|
|
209
226
|
|
|
210
227
|
## Common mistakes
|
|
211
228
|
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
# Mutators
|
|
2
2
|
|
|
3
3
|
How to write a test that kills a surviving mutant of each built-in mutator. The
|
|
4
|
-
page of each mutator has examples
|
|
4
|
+
page of each mutator has examples, in Markdown at
|
|
5
|
+
`https://mootant.org/mutators/<id>.md`.
|
|
5
6
|
|
|
6
|
-
| Mutator | Kill it with
|
|
7
|
-
| --------------------- |
|
|
8
|
-
| `arithmetic-operator` |
|
|
9
|
-
| `array-element` | Inputs where every element makes a difference, and the whole array checked with `toEqual`; for `[]` → `[undefined]`, its length
|
|
10
|
-
| `assignment-operator` | The value after the assignment: a target
|
|
11
|
-
| `bitwise-operator` |
|
|
12
|
-
| `boolean-literal` | A case where the literal decides the result, such as a call that relies on a default.
|
|
13
|
-
| `comparison-operator` | The boundary and one step on each side, also for `===` and `!==` with a number; for other `===`, `in` and `instanceof`, one true and one false case.
|
|
14
|
-
| `condition` | One input for each outcome, and a check of a result that depends on the condition.
|
|
15
|
-
| `logical-operator` | A case where the dropped side decides the result, or where a condition made `true` or `false` has the other value; for a swap of `??` and the logical or, a falsy value other than `null`, `undefined` and the default, such as `''`, `0` or `false`.
|
|
16
|
-
| `method-call` | A value the call changes, such as `' 42 '` for `trim()`; a list where some items pass the check and others do not, for `every`, `some` and `filter`; a value the two methods of a pair treat differently.
|
|
17
|
-
| `missing-await` | A check of what the code does with the awaited value, a falsy awaited value where it is a condition, or an awaited call that fails; for the order of effects, a promise the test resolves itself, without real delays.
|
|
18
|
-
| `number-literal` | An input for which the old and the new number give different results, such as an amount over a cap.
|
|
19
|
-
| `object-property` | A check of the removed property or of a value the removed spread copies; `toHaveBeenCalledWith` for an object passed to another module.
|
|
20
|
-
| `optional-chaining` | `null` or `undefined` right before the `?.`, and a check of the result.
|
|
21
|
-
| `regex-flag` | Text for which the flag changes the result, such as letters in the other case for `i` or a second match for `g`.
|
|
22
|
-
| `regex-pattern` | Text the pattern must reject; for a removed alternative, a test for each alternative; for an optional part made required, text without that part.
|
|
23
|
-
| `return-value` | An exact check of the result, with an input for which the function returns something else; where a call becomes `undefined`, a check of what that call does.
|
|
24
|
-
| `statement-removal` | The effect of the statement: state it changes, an error it throws, or a call into another module.
|
|
25
|
-
| `string-literal` | The whole result with `toBe`, for an input that makes the string appear in it; for a quoted JSX attribute value, the attribute of the rendered element or a query that finds the element by it.
|
|
26
|
-
| `unary-operator` | A value the operator changes:
|
|
27
|
-
| `update-operator` | An input that reaches the update, and a check of the counter or of the value the update gives; for a postfix update whose value is used, the second value too.
|
|
7
|
+
| Mutator | Kill it with |
|
|
8
|
+
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `arithmetic-operator` | Values that give different results: 10 and 3 for `+` → `-` (13 versus 7), 10 and 2 for `*` → `/` (20 versus 5), 5 and 2 for `%` → `*` (1 versus 10), and 3 and 2 for `**` → `*` (9 versus 6). For a dropped right side of `+`, strings such as `'Mug '` and `'A1'`, and a check of the whole result. |
|
|
10
|
+
| `array-element` | Inputs where every element makes a difference, and the whole array checked with `toEqual`; for `[]` → `[undefined]`, its length or `toStrictEqual([])`, since Jest's `toEqual([])` accepts `[undefined]`; for a hook dependency, a rerender with a new value of it. |
|
|
11
|
+
| `assignment-operator` | The value after the assignment: for arithmetic operators, a target of 10 with 3 on the right; for bitwise operators, 6 with 2; for shifts, -8 with 1. For a logical assignment, a target it keeps, one it overwrites, and a falsy one other than `null`, `undefined` and the default, such as `''` or `0`. |
|
|
12
|
+
| `bitwise-operator` | Values that give different results: 1 and 2 for `&` → `\|` (0 versus 3), 3 and 1 for `^` → `\|` (2 versus 3), and 10 with a shift of 1 for `>>` → `<<` (5 versus 20). For `>>> 0` → `>> 0`, -1 gives 4294967295 versus -1. For a removed `\| 0`, a quotient such as 10 / 4 gives 2 versus 2.5. |
|
|
13
|
+
| `boolean-literal` | A case where the literal decides the result, such as a call that relies on a default. |
|
|
14
|
+
| `comparison-operator` | The boundary and one step on each side, also for `===` and `!==` with a number; for other `===`, `in` and `instanceof`, one true and one false case. |
|
|
15
|
+
| `condition` | One input for each outcome, and a check of a result that depends on the condition. |
|
|
16
|
+
| `logical-operator` | A case where the dropped side decides the result, or where a condition made `true` or `false` has the other value; for a swap of `??` and the logical or, a falsy value other than `null`, `undefined` and the default, such as `''`, `0` or `false`. |
|
|
17
|
+
| `method-call` | A value the call changes, such as `' 42 '` for `trim()`; a list where some items pass the check and others do not, for `every`, `some` and `filter`; a value the two methods of a pair treat differently. |
|
|
18
|
+
| `missing-await` | A check of what the code does with the awaited value, a falsy awaited value where it is a condition, or an awaited call that fails; for the order of effects, a promise the test resolves itself, without real delays. |
|
|
19
|
+
| `number-literal` | An input for which the old and the new number give different results, such as an amount over a cap. |
|
|
20
|
+
| `object-property` | A check of the removed property or of a value the removed spread copies; `toHaveBeenCalledWith` for an object passed to another module. |
|
|
21
|
+
| `optional-chaining` | `null` or `undefined` right before the `?.`, and a check of the result. |
|
|
22
|
+
| `regex-flag` | Text for which the flag changes the result, such as letters in the other case for `i` or a second match for `g`. |
|
|
23
|
+
| `regex-pattern` | Text the pattern must reject; for a removed alternative, a test for each alternative; for an optional part made required, text without that part. |
|
|
24
|
+
| `return-value` | An exact check of the result, with an input for which the function returns something else; where a call becomes `undefined`, a check of what that call does. |
|
|
25
|
+
| `statement-removal` | The effect of the statement: state it changes, an error it throws, or a call into another module. |
|
|
26
|
+
| `string-literal` | The whole result with `toBe`, for an input that makes the string appear in it; for a quoted JSX attribute value, the attribute of the rendered element or a query that finds the element by it. |
|
|
27
|
+
| `unary-operator` | A value the operator changes: 10 for `-` (-10 versus 10), a string such as `'3'` for `+` (the number 3 versus the string), a flag set in the value for `~`, and 2.5 for `~~` (2 versus 2.5). |
|
|
28
|
+
| `update-operator` | An input that reaches the update, and a check of the counter or of the value the update gives; for a postfix update whose value is used, the second value too. |
|
|
29
|
+
|
|
30
|
+
Check the results for the values you choose. Rounding can hide an arithmetic
|
|
31
|
+
change: `1e100 + 1` and `1e100 - 1` give the same result. Bitwise operations on
|
|
32
|
+
numbers convert their operands to 32-bit integers, so a nonzero input can become
|
|
33
|
+
0: `4294967296 >> 1` and `4294967296 << 1` both give 0.
|
|
28
34
|
|
|
29
35
|
A mutator whose id has a `/` comes from a plugin and has no row here. Read its
|
|
30
36
|
description in `<mootant> list <file> --json --verbose`, the changed source and
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|