mootant 0.1.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/build-dry-file.d.ts +12 -12
- package/dist/adapters/jest/collect-jest-dependencies.d.ts +15 -12
- 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/runner.d.ts +1 -1
- package/dist/adapters/jest/runner.js +1 -1
- 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 +5 -4
- package/dist/adapters/jest/types/unit-worker.d.ts +16 -8
- package/dist/adapters/jest/types/worker-channel.d.ts +7 -0
- package/dist/adapters/jest/types/worker-session.d.ts +6 -7
- package/dist/adapters/jest/worker/boot-worker.d.ts +5 -3
- 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 +24 -17
- package/dist/adapters/jest/worker/vm-setup.js +1 -1
- package/dist/adapters/jest/worker/worker.js +1 -1
- package/dist/adapters/jest/write-worker-session.d.ts +1 -2
- package/dist/adapters/jest/write-worker-session.js +2 -2
- 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 -49
- 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 +19 -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/node-test-record.d.ts +3 -3
- package/dist/adapters/node-test/types/node-test-unit.d.ts +6 -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 +29 -0
- package/dist/adapters/shared/create-input-filter.js +32 -0
- 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-inputs.d.ts +7 -3
- package/dist/adapters/shared/track-file-inputs.js +16 -7
- package/dist/adapters/shared/track-file-reads.d.ts +13 -8
- package/dist/adapters/shared/track-file-reads.js +122 -69
- package/dist/adapters/shared/track-inputs.d.ts +13 -6
- package/dist/adapters/shared/track-inputs.js +7 -7
- package/dist/adapters/shared/track-process-group.d.ts +2 -1
- package/dist/adapters/shared/track-process-group.js +7 -2
- package/dist/adapters/shared/types/file-input-tracking.d.ts +6 -0
- package/dist/adapters/shared/types/input-tracking.d.ts +3 -3
- package/dist/adapters/vitest/build-isolated-facts.d.ts +4 -3
- package/dist/adapters/vitest/collect-dependencies.d.ts +10 -3
- package/dist/adapters/vitest/collect-dependencies.js +36 -26
- 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 +46 -29
- 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 +10 -0
- package/dist/adapters/vitest/is-virtual-module.js +8 -0
- 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-out-files.d.ts +7 -2
- package/dist/adapters/vitest/read-out-files.js +5 -5
- package/dist/adapters/vitest/read-out-records.d.ts +17 -0
- package/dist/adapters/vitest/read-out-records.js +27 -0
- package/dist/adapters/vitest/read-strays.d.ts +20 -0
- package/dist/adapters/vitest/read-strays.js +53 -0
- package/dist/adapters/vitest/read-unit-inputs.d.ts +9 -2
- package/dist/adapters/vitest/read-unit-inputs.js +1 -1
- package/dist/adapters/vitest/run-dry.js +17 -17
- package/dist/adapters/vitest/run-plan.d.ts +10 -6
- package/dist/adapters/vitest/run-plan.js +16 -16
- package/dist/adapters/vitest/run-specifications.d.ts +11 -3
- package/dist/adapters/vitest/run-specifications.js +22 -12
- package/dist/adapters/vitest/runner.d.ts +92 -46
- package/dist/adapters/vitest/runner.js +126 -104
- 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/stray-decisions.d.ts +8 -0
- package/dist/adapters/vitest/types/unit-outcome.d.ts +2 -1
- package/dist/adapters/vitest/types/vitest-session-state.d.ts +9 -8
- package/dist/adapters/vitest/types/vitest-worker.d.ts +118 -32
- 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/encode-stray.d.ts +16 -0
- package/dist/adapters/vitest/worker/encode-stray.js +16 -0
- package/dist/adapters/vitest/worker/intercept-strays.d.ts +26 -0
- package/dist/adapters/vitest/worker/intercept-strays.js +13 -0
- package/dist/adapters/vitest/worker/read-try-facts.d.ts +5 -4
- 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/adapters/vitest/worker/write-out-record.d.ts +2 -2
- 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 +2 -1
- package/dist/cli/html/client/main.js +1 -1
- package/dist/cli/html/client/render-change.d.ts +3 -2
- package/dist/cli/html/client/render-code.d.ts +1 -1
- package/dist/cli/html/client/render-overview.d.ts +3 -3
- package/dist/cli/html/pack-replacement.d.ts +1 -1
- 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-list-report.js +1 -1
- package/dist/cli/report/build-run-report.js +2 -1
- package/dist/cli/report/format-command.d.ts +5 -0
- package/dist/cli/report/format-command.js +1 -1
- package/dist/cli/report/format-file-groups.d.ts +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 +55 -47
- package/dist/cli/terminal/create-spinner.d.ts +2 -3
- package/dist/cli/terminal/create-spinner.js +23 -32
- package/dist/cli/terminal/get-text-style.js +4 -4
- 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 +5 -4
- 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 +11 -6
- package/dist/core/cache/hash-files.js +22 -17
- 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 +64 -16
- package/dist/core/cache/prepare-run-cache.js +109 -62
- 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/save-run-cache.d.ts +8 -7
- package/dist/core/cache/save-run-cache.js +2 -1
- package/dist/core/cache/unknown-hash.d.ts +7 -0
- package/dist/core/cache/unknown-hash.js +2 -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/files/select-changed-mutants.d.ts +11 -6
- package/dist/core/files/select-changed-mutants.js +38 -13
- package/dist/core/generate/apply-solitary-rule.d.ts +8 -5
- package/dist/core/generate/apply-solitary-rule.js +36 -29
- package/dist/core/generate/collect-candidates.d.ts +23 -5
- package/dist/core/generate/collect-candidates.js +202 -92
- package/dist/core/generate/compare-targets.d.ts +14 -0
- package/dist/core/generate/compare-targets.js +6 -0
- package/dist/core/generate/deduplicate-candidates.d.ts +6 -4
- package/dist/core/generate/deduplicate-candidates.js +11 -9
- package/dist/core/generate/find-list-removal.d.ts +20 -0
- package/dist/core/generate/find-list-removal.js +26 -0
- package/dist/core/generate/generate-file-mutants.js +49 -47
- package/dist/core/generate/get-mutant-site.d.ts +18 -0
- package/dist/core/generate/get-mutant-site.js +4 -0
- package/dist/core/generate/get-target.d.ts +14 -0
- package/dist/core/generate/get-target.js +4 -0
- package/dist/core/generate/pick-host.d.ts +10 -0
- package/dist/core/generate/pick-host.js +16 -0
- package/dist/core/generate/validate-replacement.d.ts +15 -4
- package/dist/core/generate/validate-replacement.js +28 -13
- package/dist/core/ignore/find-ignore-rule.d.ts +8 -7
- package/dist/core/index.d.ts +18 -0
- package/dist/core/instrument/find-attribute-values.d.ts +12 -0
- package/dist/core/instrument/find-attribute-values.js +13 -0
- package/dist/core/instrument/get-site-syntax.d.ts +14 -0
- package/dist/core/instrument/get-site-syntax.js +12 -0
- package/dist/core/instrument/group-mutant-ranges.d.ts +7 -3
- package/dist/core/instrument/group-mutant-ranges.js +25 -19
- package/dist/core/instrument/instrument-file.d.ts +5 -3
- package/dist/core/instrument/instrument-file.js +10 -9
- package/dist/core/instrument/instrumenter-version.d.ts +1 -1
- package/dist/core/instrument/render-branch.d.ts +17 -0
- package/dist/core/instrument/render-branch.js +81 -0
- package/dist/core/instrument/render-mutant-range.d.ts +17 -6
- package/dist/core/instrument/render-mutant-range.js +39 -13
- package/dist/core/list-mutants.d.ts +7 -5
- package/dist/core/list-mutants.js +2 -2
- package/dist/core/mutators/array-element.d.ts +7 -6
- package/dist/core/mutators/array-element.js +13 -13
- package/dist/core/mutators/assignment-operator.js +34 -33
- package/dist/core/mutators/boolean-literal.d.ts +3 -2
- package/dist/core/mutators/number-literal.d.ts +1 -1
- package/dist/core/mutators/object-property.d.ts +4 -3
- package/dist/core/mutators/object-property.js +7 -8
- package/dist/core/mutators/return-value.js +65 -33
- package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +14 -9
- package/dist/core/mutators/shared/get-branch-copy-skip.js +34 -35
- package/dist/core/mutators/shared/get-canonical-falsy-default.d.ts +32 -0
- package/dist/core/mutators/shared/get-canonical-falsy-default.js +11 -0
- package/dist/core/mutators/shared/get-comparison-plan.d.ts +2 -2
- package/dist/core/mutators/shared/get-comparison-plan.js +86 -85
- package/dist/core/mutators/shared/get-condition-constants.d.ts +8 -8
- package/dist/core/mutators/shared/get-condition-constants.js +3 -3
- package/dist/core/mutators/shared/get-default-option-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-endless-value.d.ts +20 -0
- package/dist/core/mutators/shared/get-endless-value.js +25 -0
- package/dist/core/mutators/shared/get-forced-test-justifier.d.ts +44 -0
- package/dist/core/mutators/shared/get-forced-test-justifier.js +25 -0
- package/dist/core/mutators/shared/get-group-constant.d.ts +6 -6
- package/dist/core/mutators/shared/get-group-constant.js +2 -2
- package/dist/core/mutators/shared/get-literal-skip.d.ts +9 -9
- package/dist/core/mutators/shared/get-literal-skip.js +2 -2
- package/dist/core/mutators/shared/get-logical-drops.d.ts +8 -8
- package/dist/core/mutators/shared/get-logical-drops.js +80 -82
- 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/get-owner-constant.d.ts +3 -1
- package/dist/core/mutators/shared/get-running-value.d.ts +5 -4
- package/dist/core/mutators/shared/get-toward-mutant.d.ts +10 -2
- package/dist/core/mutators/shared/get-toward-mutant.js +45 -40
- package/dist/core/mutators/shared/has-other-exit.js +16 -36
- package/dist/core/mutators/shared/is-loop-exit.d.ts +20 -0
- package/dist/core/mutators/shared/is-loop-exit.js +32 -0
- package/dist/core/mutators/shared/is-read-only.d.ts +26 -0
- package/dist/core/mutators/shared/is-read-only.js +53 -0
- 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/mutators/statement-removal.d.ts +4 -3
- package/dist/core/mutators/statement-removal.js +69 -73
- package/dist/core/mutators/string-literal.d.ts +15 -5
- package/dist/core/mutators/string-literal.js +79 -50
- 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/presets/recommended.d.ts +2 -2
- package/dist/core/presets/strict.d.ts +4 -2
- 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-batch-result.d.ts +23 -22
- package/dist/core/run/apply-batch-result.js +5 -5
- package/dist/core/run/apply-isolated-result.d.ts +21 -12
- package/dist/core/run/apply-isolated-result.js +45 -25
- package/dist/core/run/classify-try.d.ts +9 -8
- 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-test-file-limits.d.ts +13 -0
- package/dist/core/run/get-test-file-limits.js +13 -0
- package/dist/core/run/get-unit-evidence.d.ts +12 -3
- 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/plan-batch.d.ts +6 -3
- package/dist/core/run/plan-batch.js +36 -31
- package/dist/core/run/plan-isolated.d.ts +3 -1
- package/dist/core/run/plan-isolated.js +8 -14
- package/dist/core/run/read-isolated-unit.d.ts +9 -6
- 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-batch-phases.d.ts +4 -3
- package/dist/core/run/run-dry-phase.d.ts +35 -19
- package/dist/core/run/run-dry-phase.js +127 -77
- package/dist/core/run/run-isolated-rounds.d.ts +15 -10
- package/dist/core/run/run-isolated-rounds.js +4 -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 +59 -22
- package/dist/core/run-mutants.js +356 -208
- package/dist/core/runtime/create-hit-limit-error.d.ts +5 -3
- package/dist/core/runtime/create-hit-limit-error.js +1 -1
- package/dist/core/runtime/install-mutant-runtime.js +23 -6
- package/dist/core/runtime/runtime-version.d.ts +4 -4
- package/dist/core/skips/skip-rules.d.ts +7 -1
- package/dist/core/skips/skip-rules.js +4 -0
- package/dist/core/syntax/is-brace-sensitive-attribute.d.ts +18 -0
- package/dist/core/syntax/is-brace-sensitive-attribute.js +28 -0
- package/dist/core/syntax/is-spread-safe-member.d.ts +18 -0
- package/dist/core/syntax/is-spread-safe-member.js +18 -0
- package/dist/core/syntax/is-value-position.d.ts +3 -1
- package/dist/core/text/get-list-removal-range.d.ts +22 -0
- package/dist/core/text/get-list-removal-range.js +46 -0
- package/dist/core/text/is-plain-attribute-string.d.ts +10 -0
- package/dist/core/text/is-plain-attribute-string.js +5 -0
- package/dist/core/text/parse-expression.d.ts +8 -4
- package/dist/core/text/parse-expression.js +1 -0
- package/dist/core/text/remove-list-element.d.ts +2 -4
- package/dist/core/text/remove-list-element.js +4 -45
- package/dist/docs/styles/colors.js +1 -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 +6 -3
- package/dist/types/adapter/dry-run-request.d.ts +5 -4
- package/dist/types/adapter/isolated-plan.d.ts +2 -1
- package/dist/types/adapter/isolated-result.d.ts +3 -1
- package/dist/types/adapter/mutant-runtime.d.ts +30 -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/cli/text-style.d.ts +1 -1
- package/dist/types/config/plugin.d.ts +11 -2
- package/dist/types/config/preset-settings.d.ts +2 -2
- package/dist/types/config/run-config.d.ts +22 -4
- package/dist/types/config/run-settings.d.ts +6 -0
- package/dist/types/html/indexed-mutant.d.ts +4 -2
- package/dist/types/html/shown-change.d.ts +4 -3
- package/dist/types/mutant/core-note.d.ts +12 -0
- package/dist/types/mutant/diagnostic.d.ts +1 -0
- package/dist/types/mutant/list-removal.d.ts +37 -0
- package/dist/types/mutant/mutant-candidate.d.ts +11 -17
- package/dist/types/mutant/mutant-host.d.ts +49 -0
- package/dist/types/mutant/mutant-kind.d.ts +18 -0
- package/dist/types/mutant/mutant-range.d.ts +15 -8
- package/dist/types/mutant/mutant.d.ts +9 -15
- package/dist/types/mutant/registered-skip-rule.d.ts +11 -0
- package/dist/types/mutant/site-syntax.d.ts +14 -0
- package/dist/types/mutant/skip-justifier.d.ts +3 -1
- 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 +27 -17
- package/dist/types/mutant/skipped-mutant.d.ts +15 -12
- package/dist/types/mutator/mutator.d.ts +3 -2
- package/dist/types/mutator/registered-mutator.d.ts +8 -0
- package/dist/types/mutator/replacement.d.ts +14 -3
- package/dist/types/regex/regex-change.d.ts +2 -2
- package/dist/types/report/html-report.d.ts +13 -9
- package/dist/types/report/list-report-focus.d.ts +3 -2
- package/dist/types/report/list-report-justifier.d.ts +4 -2
- package/dist/types/report/list-report-mutant.d.ts +15 -9
- package/dist/types/report/list-report-skipped.d.ts +6 -4
- package/dist/types/report/list-report.d.ts +1 -1
- package/dist/types/report/run-report.d.ts +13 -4
- package/dist/types/report/slim-list-report.d.ts +6 -3
- package/dist/types/report/slim-run-report.d.ts +2 -2
- package/dist/types/run/isolated-evidence.d.ts +3 -2
- package/dist/types/run/isolated-reason.d.ts +6 -4
- package/dist/types/run/mutant-state.d.ts +1 -1
- package/dist/types/run/run-durations.d.ts +8 -3
- package/dist/types/run/run-event.d.ts +11 -8
- package/dist/types/run/run-kind.d.ts +3 -2
- package/dist/types/run/run-result.d.ts +17 -5
- package/dist/types/run/run-state.d.ts +30 -1
- package/dist/types/run/run-status.d.ts +2 -2
- package/dist/types/run/try-cause.d.ts +10 -7
- package/dist/types/syntax/syntax-helpers.d.ts +5 -3
- package/package.json +5 -5
- package/readme.md +85 -68
- package/skills/mootant/SKILL.md +50 -31
- package/skills/mootant/references/mutators.md +31 -23
- package/dist/adapters/node-test/list-flag-values.js +0 -9
- package/dist/core/instrument/get-site-check.d.ts +0 -9
- package/dist/core/instrument/get-site-check.js +0 -5
- package/dist/core/instrument/get-template-site-check.d.ts +0 -12
- package/dist/core/instrument/get-template-site-check.js +0 -5
- /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/cli/{built-in-adapters.d.ts → get-built-in-adapters.d.ts} +0 -0
- /package/dist/cli/{built-in-adapters.js → get-built-in-adapters.js} +0 -0
- /package/dist/cli/terminal/{colors.d.ts → create-colors.d.ts} +0 -0
- /package/dist/cli/terminal/{colors.js → create-colors.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
|
@@ -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
|
|
|
@@ -221,7 +224,7 @@ export type RunEvent =
|
|
|
221
224
|
kind: 'dry-start'
|
|
222
225
|
|
|
223
226
|
/**
|
|
224
|
-
*
|
|
227
|
+
* Switched files of the dry run.
|
|
225
228
|
*/
|
|
226
229
|
files: number
|
|
227
230
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Kind of a run of the test runner:
|
|
3
3
|
*
|
|
4
|
-
* - `dry`: the tests without a mutant,
|
|
4
|
+
* - `dry`: the tests without a mutant, and the reruns of failed test files;
|
|
5
5
|
* - `batch`: a batch phase;
|
|
6
6
|
* - `recovery`: batch tries that went missing, planned again;
|
|
7
|
-
* - `confirmation`: batch timeouts tried again with
|
|
7
|
+
* - `confirmation`: batch timeouts tried again with twice the time of their whole
|
|
8
|
+
* test file;
|
|
8
9
|
* - `isolated`: isolated units.
|
|
9
10
|
*/
|
|
10
11
|
export type RunKind = 'confirmation' | 'recovery' | 'isolated' | 'batch' | 'dry'
|
|
@@ -13,14 +13,14 @@ 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
|
|
|
20
21
|
/**
|
|
21
22
|
* Ids of the tests whose two dry tries differed in pass/fail or had stray
|
|
22
|
-
* errors, sorted; null outside fast mode, which tries each test once
|
|
23
|
-
* not check.
|
|
23
|
+
* errors, sorted; null outside fast mode, which tries each test once.
|
|
24
24
|
*/
|
|
25
25
|
unrepeatable: string[] | null
|
|
26
26
|
|
|
@@ -61,6 +61,13 @@ export interface RunResult {
|
|
|
61
61
|
*/
|
|
62
62
|
results: MutantResult[]
|
|
63
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
|
+
|
|
64
71
|
/**
|
|
65
72
|
* Durations of the phases.
|
|
66
73
|
*/
|
|
@@ -84,13 +91,18 @@ export interface RunResult {
|
|
|
84
91
|
listedIds: string[]
|
|
85
92
|
|
|
86
93
|
/**
|
|
87
|
-
* Tests the dry run saw
|
|
94
|
+
* Tests the dry run saw, or the dry run of an earlier run that the run
|
|
95
|
+
* reused.
|
|
88
96
|
*/
|
|
89
97
|
tests: DryTest[]
|
|
90
98
|
|
|
91
99
|
/**
|
|
92
100
|
* Whether verdicts were reused from and saved to the cache: false with
|
|
93
|
-
* `--no-cache`, `run.cache: false`,
|
|
101
|
+
* `--no-cache`, `run.cache: false`, an adapter without cache support, and
|
|
102
|
+
* when no test file has a key, as when after the dry run a file every verdict
|
|
103
|
+
* depends on, other than one the tests read and wrote themselves, has a
|
|
104
|
+
* modification time at or after the start of the run, which a `cache-skipped`
|
|
105
|
+
* warning names.
|
|
94
106
|
*/
|
|
95
107
|
cache: boolean
|
|
96
108
|
|
|
@@ -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,16 +87,36 @@ 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
|
*/
|
|
91
112
|
retried: boolean
|
|
92
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Whether the unit confirms a hit-limit timeout, with `factor × floor` more
|
|
116
|
+
* site evaluations than planned.
|
|
117
|
+
*/
|
|
118
|
+
raised: boolean
|
|
119
|
+
|
|
93
120
|
/**
|
|
94
121
|
* Id of the mutant.
|
|
95
122
|
*/
|
|
@@ -112,7 +139,9 @@ export interface LimitSettings {
|
|
|
112
139
|
timeout: { constant: number; factor: number }
|
|
113
140
|
|
|
114
141
|
/**
|
|
115
|
-
* Hit limit
|
|
142
|
+
* Hit limit of a try or of loading a test file: `max(floor, factor × dry
|
|
143
|
+
* hits)`. A unit that confirms a hit-limit timeout gets `factor × floor`
|
|
144
|
+
* more.
|
|
116
145
|
*/
|
|
117
146
|
hitLimit: { factor: number; floor: number }
|
|
118
147
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Final state of a mutant after a run:
|
|
3
3
|
*
|
|
4
4
|
* - `Killed`: a test failed with the mutant active (`cause` tells how);
|
|
5
|
-
* - `Timeout`: a test did not finish (hit limit,
|
|
6
|
-
*
|
|
5
|
+
* - `Timeout`: a test did not finish (hit limit, timer or hang, each confirmed by
|
|
6
|
+
* a second run); counts as detected;
|
|
7
7
|
* - `Survived`: every test of the test files that cover it passed in a fresh
|
|
8
8
|
* module graph, and one of them reached it (always the isolated path);
|
|
9
9
|
* - `NoCoverage`: no test reached it;
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
* How a mutant was detected:
|
|
3
3
|
*
|
|
4
4
|
* - `assertion`: a test or hook failed;
|
|
5
|
-
* - `stray-error`: an unhandled error
|
|
6
|
-
* try doubtful);
|
|
5
|
+
* - `stray-error`: an unhandled error that the test runner counts (isolated path
|
|
6
|
+
* only; in batch it makes the try doubtful);
|
|
7
7
|
* - `load-error`: the test file failed to load with the mutant active;
|
|
8
8
|
* - `hook-error`: a suite hook (such as `beforeAll`/`before`, `afterAll`/`after`,
|
|
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
|
|
13
|
-
*
|
|
14
|
-
* - `
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* - `crash`: the worker died with the mutant active, and again in a later run of
|
|
13
|
+
* the unit (isolated path);
|
|
14
|
+
* - `hit-limit`: the hit counter stopped a loop or far hotter code (confirmed
|
|
15
|
+
* with doubled time and `factor × floor` more evaluations);
|
|
16
|
+
* - `time-limit`: a timer stopped stuck or far slower code (confirmed with
|
|
17
|
+
* doubled time);
|
|
18
|
+
* - `hang`: the watchdog stopped a worker that was stuck or far slower with the
|
|
19
|
+
* mutant active (confirmed like `time-limit`).
|
|
17
20
|
*/
|
|
18
21
|
export type TryCause =
|
|
19
22
|
| 'stray-error'
|
|
@@ -178,7 +178,9 @@ export interface SyntaxHelpers {
|
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* Whether a replacement may stand in place of the node: an expression whose
|
|
181
|
-
* value is read and that the mutant switch can wrap.
|
|
181
|
+
* value is read and that the mutant switch can wrap. A quoted JSX attribute
|
|
182
|
+
* value is not one, though a plain string may replace it (see
|
|
183
|
+
* `Replacement.node`).
|
|
182
184
|
*/
|
|
183
185
|
isValuePosition(node: Node): boolean
|
|
184
186
|
|
|
@@ -252,8 +254,8 @@ export interface SyntaxHelpers {
|
|
|
252
254
|
|
|
253
255
|
/**
|
|
254
256
|
* Whether the node is part of the runtime tree of the file. Scope analysis
|
|
255
|
-
* also sees nodes outside it, such as ambient declarations and
|
|
256
|
-
*
|
|
257
|
+
* also sees nodes outside it, such as ambient declarations and module
|
|
258
|
+
* specifiers, which the tree-bound helpers do not accept.
|
|
257
259
|
*/
|
|
258
260
|
isRuntimeNode(node: Node): boolean
|
|
259
261
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mootant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Mutation testing tool that ships with an agent skill for finding and fixing weak tests",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mutation-testing",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"jest",
|
|
17
17
|
"node-test"
|
|
18
18
|
],
|
|
19
|
-
"homepage": "https://
|
|
19
|
+
"homepage": "https://mootant.org",
|
|
20
20
|
"repository": "azat-io/mootant",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"author": "Azat S. <to@azat.io>",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"./skills"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@eslint-community/regexpp": "^4.12.
|
|
57
|
-
"lilconfig": "^3.1.
|
|
58
|
-
"oxc-parser": "^0.
|
|
56
|
+
"@eslint-community/regexpp": "^4.12.3",
|
|
57
|
+
"lilconfig": "^3.1.5",
|
|
58
|
+
"oxc-parser": "^0.159.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@vue/compiler-dom": "^3.5.0",
|
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
|
-
node -e "for(const m of require('./.mootant/before.json').mutants)console.log(m.id,m.status,m.file+':'+m.line,m.scope||'-',m.mutator,m.tests)"
|
|
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
|
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -127,9 +135,9 @@ smaller path, list the rest as not reached.
|
|
|
127
135
|
when git does not track it.
|
|
128
136
|
2. **Run once**, as Start says, in the background or with the longest timeout,
|
|
129
137
|
and wait for the exit. Read its problems. An `Error:` line in the log: report
|
|
130
|
-
it with the lines under it and stop. `schemaVersion` other than 3: stop,
|
|
131
|
-
skill does not fit this Mootant. No mutants to act on and no errors: say
|
|
132
|
-
and stop.
|
|
138
|
+
it with the lines under it and stop. `schemaVersion` other than 3 or 4: stop,
|
|
139
|
+
this skill does not fit this Mootant. No mutants to act on and no errors: say
|
|
140
|
+
so and stop.
|
|
133
141
|
3. **Ledger.** One row per id with verdict `pending`; the report keeps the rest.
|
|
134
142
|
Over 20 rows: tell the user the counts per file and work file by file in the
|
|
135
143
|
report's order.
|
|
@@ -187,23 +195,34 @@ outputs in a throwaway test and recheck: `Killed` or `Timeout` means you found a
|
|
|
187
195
|
real test, so keep it; otherwise delete the throwaway test.
|
|
188
196
|
|
|
189
197
|
An ignore comment hides every mutant of the named mutators on the next line, not
|
|
190
|
-
one id
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
one id; a mutant is on its `line`, and one of `kind` `element` or `property` on
|
|
199
|
+
the line of its `focus`. Before you propose
|
|
200
|
+
`// mootant-ignore-next-line <mutator>: <reason>`, with mutator names separated
|
|
201
|
+
by commas and never without one, list what it would hide with
|
|
202
|
+
`<mootant> list <file> --json --verbose`, which gives `kind`. Propose it only
|
|
203
|
+
when each of those mutants is equivalent, and show the user each one with its
|
|
204
|
+
reason. When the user approves, add the comment and list the file again: the new
|
|
205
|
+
`Ignored` mutants must be exactly the ones you showed, with no
|
|
206
|
+
`malformed-directive` or `unknown-mutator` in `diagnostics`. A coarse mutant
|
|
207
|
+
that comes back gets its own row.
|
|
198
208
|
|
|
199
209
|
## Report
|
|
200
210
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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.
|
|
207
226
|
|
|
208
227
|
## Common mistakes
|
|
209
228
|
|