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
|
@@ -10,16 +10,17 @@ import { getShiftedLiteral as c } from "./get-shifted-literal.js";
|
|
|
10
10
|
import { getLeaveNowValue as l } from "./get-leave-now-value.js";
|
|
11
11
|
import { getRootName as u } from "../../syntax/get-root-name.js";
|
|
12
12
|
import { getRunningValue as d } from "./get-running-value.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
13
|
+
import { getEndlessValue as f } from "./get-endless-value.js";
|
|
14
|
+
import { getLiteralValue as p } from "./get-literal-value.js";
|
|
15
|
+
import { isFunction as m } from "../../syntax/is-function.js";
|
|
16
|
+
import { isNumberLiteral as h } from "./is-number-literal.js";
|
|
17
|
+
import { LEAVE_NOW_SKIP as g } from "./leave-now-skip.js";
|
|
18
|
+
import { isNumericPair as _ } from "./is-numeric-pair.js";
|
|
19
|
+
import { getNumberText as v } from "./get-number-text.js";
|
|
20
|
+
import { hasOtherExit as y } from "./has-other-exit.js";
|
|
21
|
+
import { walkTree as b } from "../../tree/walk-tree.js";
|
|
22
|
+
import { getTypeView as x } from "./get-type-view.js";
|
|
23
|
+
let S = /* @__PURE__ */ new Map([
|
|
23
24
|
["<", [
|
|
24
25
|
{
|
|
25
26
|
region: "eq",
|
|
@@ -76,7 +77,7 @@ let x = /* @__PURE__ */ new Map([
|
|
|
76
77
|
to: !0
|
|
77
78
|
}
|
|
78
79
|
]]
|
|
79
|
-
]),
|
|
80
|
+
]), C = [
|
|
80
81
|
{
|
|
81
82
|
region: "lt",
|
|
82
83
|
to: "<="
|
|
@@ -89,7 +90,7 @@ let x = /* @__PURE__ */ new Map([
|
|
|
89
90
|
region: "eq",
|
|
90
91
|
to: !1
|
|
91
92
|
}
|
|
92
|
-
],
|
|
93
|
+
], w = [
|
|
93
94
|
{
|
|
94
95
|
region: "gt",
|
|
95
96
|
to: "<"
|
|
@@ -102,18 +103,18 @@ let x = /* @__PURE__ */ new Map([
|
|
|
102
103
|
region: "eq",
|
|
103
104
|
to: !0
|
|
104
105
|
}
|
|
105
|
-
],
|
|
106
|
-
["!==",
|
|
107
|
-
["!=",
|
|
108
|
-
["===",
|
|
109
|
-
["==",
|
|
110
|
-
]),
|
|
106
|
+
], T = /* @__PURE__ */ new Map([
|
|
107
|
+
["!==", w],
|
|
108
|
+
["!=", w],
|
|
109
|
+
["===", C],
|
|
110
|
+
["==", C]
|
|
111
|
+
]), E = [{
|
|
111
112
|
region: null,
|
|
112
113
|
to: !0
|
|
113
114
|
}, {
|
|
114
115
|
region: null,
|
|
115
116
|
to: !1
|
|
116
|
-
}],
|
|
117
|
+
}], D = /* @__PURE__ */ new Map([
|
|
117
118
|
["!==", ["lt", "gt"]],
|
|
118
119
|
["!=", ["lt", "gt"]],
|
|
119
120
|
["<=", ["lt", "eq"]],
|
|
@@ -122,22 +123,22 @@ let x = /* @__PURE__ */ new Map([
|
|
|
122
123
|
["==", ["eq"]],
|
|
123
124
|
["<", ["lt"]],
|
|
124
125
|
[">", ["gt"]]
|
|
125
|
-
]),
|
|
126
|
+
]), O = /* @__PURE__ */ new Set([
|
|
126
127
|
"boolean",
|
|
127
128
|
"bigint",
|
|
128
129
|
"number",
|
|
129
130
|
"string"
|
|
130
|
-
]),
|
|
131
|
+
]), k = /* @__PURE__ */ new Map([
|
|
131
132
|
["lt", "gt"],
|
|
132
133
|
["eq", "eq"],
|
|
133
134
|
["gt", "lt"]
|
|
134
135
|
]);
|
|
135
|
-
function
|
|
136
|
-
let { sourceCode: n, settings: r } = t, { operator: i } = e, a =
|
|
136
|
+
function A(e, t) {
|
|
137
|
+
let { sourceCode: n, settings: r } = t, { operator: i } = e, a = G(e, t), o = V(e, t), c = I(e, t), l = R(c, 0), u = r.timeouts ? null : f(e, t), d = N(e, t, u), p = new Map([...d, ...s(e, t)]), m = j(e, t, u), h = F(e, t), g = {
|
|
137
138
|
guard: c?.bound.guards?.has(e) ?? !1,
|
|
138
139
|
operand: c,
|
|
139
140
|
constantSkips: p,
|
|
140
|
-
valueSkips:
|
|
141
|
+
valueSkips: d
|
|
141
142
|
}, _ = [], v = [], y = /* @__PURE__ */ new Map();
|
|
142
143
|
function b(t, n) {
|
|
143
144
|
v.push({
|
|
@@ -152,7 +153,7 @@ function k(e, t) {
|
|
|
152
153
|
rule: "lower-bound"
|
|
153
154
|
} : null;
|
|
154
155
|
if (typeof r == "boolean") {
|
|
155
|
-
let e = s ?? (o ?
|
|
156
|
+
let e = s ?? (o ? z(g, R(c, o.step), i) : p.get(r));
|
|
156
157
|
e ? (b(a, e), y.set(r, e)) : _.push({
|
|
157
158
|
kind: o ? "shift" : "constant",
|
|
158
159
|
value: r,
|
|
@@ -164,15 +165,15 @@ function k(e, t) {
|
|
|
164
165
|
let u = s ?? m.get(r) ?? (h && t === "eq" ? {
|
|
165
166
|
reason: "at equality both branches of the min/max ternary give the same value",
|
|
166
167
|
rule: "min-max-idiom"
|
|
167
|
-
} : null), d = u ? null :
|
|
168
|
-
u ?? d ? (b(a, u ?? d), d && !y.has(
|
|
169
|
-
value:
|
|
168
|
+
} : null), d = u ? null : z(g, l, r);
|
|
169
|
+
u ?? d ? (b(a, u ?? d), d && !y.has(q(l, r)) && y.set(q(l, r), d)) : _.push({
|
|
170
|
+
value: D.get(r).includes(t),
|
|
170
171
|
kind: "swap",
|
|
171
172
|
region: t,
|
|
172
173
|
text: a
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
|
-
for (let e of [!0, !1]) !y.has(e) && a.every((t) =>
|
|
176
|
+
for (let e of [!0, !1]) !y.has(e) && a.every((t) => Z(t) !== e || t.region !== null && l.has(t.region)) && y.set(e, {
|
|
176
177
|
reason: `a lower bound of an operand makes every input where the comparison is not ${e} impossible (${c.bound.because})`,
|
|
177
178
|
rule: "lower-bound"
|
|
178
179
|
});
|
|
@@ -182,15 +183,15 @@ function k(e, t) {
|
|
|
182
183
|
skipped: v
|
|
183
184
|
};
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
-
let r = /* @__PURE__ */ new Map([[
|
|
186
|
+
function j(e, t, n) {
|
|
187
|
+
let r = /* @__PURE__ */ new Map([[P(e, t), {
|
|
187
188
|
reason: "the loop moves the counter one way, keeps the bound and has no other exit, so this form ends the loop at the same point",
|
|
188
189
|
rule: "one-way-counter"
|
|
189
190
|
}]]);
|
|
190
|
-
if (n && r.set(n
|
|
191
|
+
if (n !== null && r.set(n ? "!=" : "==", {
|
|
191
192
|
reason: "a counter that steps over the bound may keep the loop running forever",
|
|
192
193
|
rule: "loop-running"
|
|
193
|
-
}),
|
|
194
|
+
}), S.has(e.operator) && x(t.hints.getType(e.left)).type === "object" && x(t.hints.getType(e.right)).type === "object") {
|
|
194
195
|
let e = {
|
|
195
196
|
reason: "both operands are objects, so it compares references instead of order",
|
|
196
197
|
rule: "reference-equality"
|
|
@@ -199,29 +200,29 @@ function A(e, t, n) {
|
|
|
199
200
|
}
|
|
200
201
|
return r;
|
|
201
202
|
}
|
|
202
|
-
function
|
|
203
|
+
function M(e, t) {
|
|
203
204
|
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [
|
|
204
205
|
e.test,
|
|
205
206
|
e.type === "ForStatement" ? e.update : null,
|
|
206
207
|
e.body
|
|
207
208
|
];
|
|
208
|
-
for (let e of i) e &&
|
|
209
|
+
for (let e of i) e && b(e, (e, i) => {
|
|
209
210
|
let a = null;
|
|
210
|
-
if (e.type === "UpdateExpression" || e.type === "AssignmentExpression" ? a =
|
|
211
|
-
return !
|
|
211
|
+
if (e.type === "UpdateExpression" || e.type === "AssignmentExpression" ? a = U(e, t) : L(i, r) && H(e, t) && (a = "other"), a && n.add(a), e.type === "ObjectPattern") for (let t of e.properties) r.add(t);
|
|
212
|
+
return !m(e);
|
|
212
213
|
});
|
|
213
214
|
return n;
|
|
214
215
|
}
|
|
215
|
-
function
|
|
216
|
+
function N(n, r, a) {
|
|
216
217
|
let s = e(n, r), c = l(n, r), u = /* @__PURE__ */ new Map();
|
|
217
218
|
for (let e of [!0, !1]) {
|
|
218
219
|
let l = null;
|
|
219
220
|
switch (e) {
|
|
220
|
-
case a?.value:
|
|
221
|
-
l = i(e);
|
|
222
|
-
break;
|
|
223
221
|
case c:
|
|
224
|
-
l =
|
|
222
|
+
l = g;
|
|
223
|
+
break;
|
|
224
|
+
case a:
|
|
225
|
+
l = i(e);
|
|
225
226
|
break;
|
|
226
227
|
case s:
|
|
227
228
|
l = {
|
|
@@ -235,26 +236,26 @@ function M(n, r, a) {
|
|
|
235
236
|
}
|
|
236
237
|
return u;
|
|
237
238
|
}
|
|
238
|
-
function
|
|
239
|
-
let r = n?.value ? ["!==", "!="] : ["===", "=="];
|
|
239
|
+
function P(e, t) {
|
|
240
|
+
let n = t.settings.timeouts ? null : d(e, t), r = n?.value ? ["!==", "!="] : ["===", "=="];
|
|
240
241
|
if (!n || !r.includes(e.operator)) return null;
|
|
241
|
-
let i =
|
|
242
|
-
if (a === null || !
|
|
242
|
+
let i = J(n.loop, e.left), a = i ?? J(n.loop, e.right);
|
|
243
|
+
if (a === null || !B(n.loop, i ? e.right : e.left) || y(e, n, t)) return null;
|
|
243
244
|
let o = a === "up", s = i !== null;
|
|
244
245
|
return n.value ? o === s ? "<" : ">" : o === s ? ">=" : "<=";
|
|
245
246
|
}
|
|
246
|
-
function
|
|
247
|
+
function F(e, t) {
|
|
247
248
|
let { parent: r, key: i } = t.syntax.getContextSlot(e);
|
|
248
|
-
if (i !== "test" || r?.type !== "ConditionalExpression" || !
|
|
249
|
+
if (i !== "test" || r?.type !== "ConditionalExpression" || !S.has(e.operator) || !W(e.left) || !W(e.right)) return !1;
|
|
249
250
|
let [a, o, s, c] = [
|
|
250
251
|
e.left,
|
|
251
252
|
e.right,
|
|
252
253
|
r.consequent,
|
|
253
254
|
r.alternate
|
|
254
255
|
].map((e) => t.sourceCode.getText(n(e)));
|
|
255
|
-
return (a === s && o === c || a === c && o === s) &&
|
|
256
|
+
return (a === s && o === c || a === c && o === s) && X(e, t);
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
+
function I(e, t) {
|
|
258
259
|
let n = e.operator === "===" || e.operator === "!==";
|
|
259
260
|
for (let [r, i, a] of [[
|
|
260
261
|
e.left,
|
|
@@ -265,7 +266,7 @@ function F(e, t) {
|
|
|
265
266
|
e.left,
|
|
266
267
|
!0
|
|
267
268
|
]]) {
|
|
268
|
-
let e =
|
|
269
|
+
let e = p(i), o = typeof e == "number" || typeof e == "bigint" && !n && Number.isSafeInteger(Number(e)) ? t.syntax.getValueBound(r) : null;
|
|
269
270
|
if (o && !o.nullable) return {
|
|
270
271
|
limit: Number(e),
|
|
271
272
|
mirrored: a,
|
|
@@ -274,7 +275,7 @@ function F(e, t) {
|
|
|
274
275
|
}
|
|
275
276
|
return null;
|
|
276
277
|
}
|
|
277
|
-
function
|
|
278
|
+
function L(e, t) {
|
|
278
279
|
let { parent: n, key: r } = e;
|
|
279
280
|
switch (n?.type) {
|
|
280
281
|
case "VariableDeclarator": return r === "id";
|
|
@@ -288,16 +289,16 @@ function I(e, t) {
|
|
|
288
289
|
default: return !1;
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
|
-
function
|
|
292
|
+
function R(e, t) {
|
|
292
293
|
let n = /* @__PURE__ */ new Set();
|
|
293
294
|
if (!e) return n;
|
|
294
295
|
let r = e.limit + t, i = [];
|
|
295
296
|
r <= e.bound.lower && i.push("lt"), r < e.bound.lower && i.push("eq");
|
|
296
|
-
for (let t of i) n.add(e.mirrored ?
|
|
297
|
+
for (let t of i) n.add(e.mirrored ? k.get(t) : t);
|
|
297
298
|
return n;
|
|
298
299
|
}
|
|
299
|
-
function
|
|
300
|
-
let r =
|
|
300
|
+
function z(e, t, n) {
|
|
301
|
+
let r = q(t, n);
|
|
301
302
|
if (r === null || e.guard || !e.valueSkips.has(r)) return null;
|
|
302
303
|
let i = e.constantSkips.get(r);
|
|
303
304
|
return {
|
|
@@ -306,21 +307,21 @@ function R(e, t, n) {
|
|
|
306
307
|
heuristic: !0
|
|
307
308
|
};
|
|
308
309
|
}
|
|
309
|
-
function
|
|
310
|
+
function B(e, t) {
|
|
310
311
|
let n = r(t);
|
|
311
312
|
for (; n.type === "UnaryExpression";) n = r(n.argument);
|
|
312
313
|
let i = a(n);
|
|
313
|
-
if (i) return
|
|
314
|
+
if (i) return M(e, i).size === 0;
|
|
314
315
|
switch (n.type) {
|
|
315
|
-
case "BinaryExpression": return
|
|
316
|
+
case "BinaryExpression": return B(e, n.left) && B(e, n.right);
|
|
316
317
|
case "Literal": return !0;
|
|
317
318
|
default: return !1;
|
|
318
319
|
}
|
|
319
320
|
}
|
|
320
|
-
function
|
|
321
|
+
function V(e, t) {
|
|
321
322
|
let n = c(e);
|
|
322
323
|
if (!n) return null;
|
|
323
|
-
let { literal: r, step: i } = n, a =
|
|
324
|
+
let { literal: r, step: i } = n, a = v(r, i);
|
|
324
325
|
return a === null ? null : {
|
|
325
326
|
text: t.sourceCode.editText(e, [{
|
|
326
327
|
start: r.start,
|
|
@@ -330,54 +331,54 @@ function B(e, t) {
|
|
|
330
331
|
step: i
|
|
331
332
|
};
|
|
332
333
|
}
|
|
333
|
-
function
|
|
334
|
+
function H(e, t) {
|
|
334
335
|
let n = a(e);
|
|
335
|
-
return n === null ? u(e) === t[0] ? "other" : null : n.length > t.length || n.some((e, n) => e !== t[n]) ?
|
|
336
|
+
return n === null ? u(e) === t[0] ? "other" : null : n.length > t.length || n.some((e, n) => e !== t[n]) ? K(n, t) ? "other" : null : n.length < t.length ? "other" : "same";
|
|
336
337
|
}
|
|
337
|
-
function
|
|
338
|
-
let n =
|
|
339
|
-
return n === "same" ? e.type === "UpdateExpression" ? e.operator === "++" ? "up" : "down" :
|
|
338
|
+
function U(e, t) {
|
|
339
|
+
let n = H(e.type === "UpdateExpression" ? e.argument : e.left, t);
|
|
340
|
+
return n === "same" ? e.type === "UpdateExpression" ? e.operator === "++" ? "up" : "down" : Y(e.operator, e.right) : n;
|
|
340
341
|
}
|
|
341
|
-
function
|
|
342
|
+
function W(e) {
|
|
342
343
|
let t = n(e);
|
|
343
344
|
switch (t.type) {
|
|
344
|
-
case "MemberExpression": return !t.computed &&
|
|
345
|
-
case "UnaryExpression": return
|
|
345
|
+
case "MemberExpression": return !t.computed && W(t.object);
|
|
346
|
+
case "UnaryExpression": return h(t);
|
|
346
347
|
case "ThisExpression":
|
|
347
348
|
case "Identifier":
|
|
348
349
|
case "Literal": return !0;
|
|
349
350
|
default: return !1;
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
|
-
function W(e, t) {
|
|
353
|
-
let n = w.get(e.operator);
|
|
354
|
-
return n && g(t.hints.getType(e.left), t.hints.getType(e.right)) ? n : x.get(e.operator) ?? T;
|
|
355
|
-
}
|
|
356
353
|
function G(e, t) {
|
|
354
|
+
let n = T.get(e.operator);
|
|
355
|
+
return n && _(t.hints.getType(e.left), t.hints.getType(e.right)) ? n : S.get(e.operator) ?? E;
|
|
356
|
+
}
|
|
357
|
+
function K(e, t) {
|
|
357
358
|
let n = e.slice(0, -1);
|
|
358
359
|
return n.length === 0 || t.length <= n.length || n.some((e, n) => e !== t[n]) ? !1 : e.at(-1) === "length" || t.length === e.length && t.at(-1) === "length";
|
|
359
360
|
}
|
|
360
|
-
function
|
|
361
|
+
function q(e, t) {
|
|
361
362
|
let n = new Set([
|
|
362
363
|
"lt",
|
|
363
364
|
"eq",
|
|
364
365
|
"gt"
|
|
365
|
-
].filter((t) => !e.has(t)).map((e) =>
|
|
366
|
+
].filter((t) => !e.has(t)).map((e) => D.get(t).includes(e))), [r] = n;
|
|
366
367
|
return n.size === 1 ? r : null;
|
|
367
368
|
}
|
|
368
|
-
function
|
|
369
|
-
let n = a(t), r = n ?
|
|
369
|
+
function J(e, t) {
|
|
370
|
+
let n = a(t), r = n ? M(e, n) : /* @__PURE__ */ new Set(), [i] = r;
|
|
370
371
|
return r.size === 1 && (i === "up" || i === "down") ? i : null;
|
|
371
372
|
}
|
|
372
|
-
function
|
|
373
|
-
let n =
|
|
373
|
+
function Y(e, t) {
|
|
374
|
+
let n = p(r(t));
|
|
374
375
|
return typeof n != "number" || n <= 0 ? "other" : e === "+=" ? "up" : e === "-=" ? "down" : "other";
|
|
375
376
|
}
|
|
376
|
-
function
|
|
377
|
-
let [n, r] = [e.left, e.right].map((e) =>
|
|
378
|
-
return n === r &&
|
|
377
|
+
function X(e, t) {
|
|
378
|
+
let [n, r] = [e.left, e.right].map((e) => x(t.hints.getType(e)).type);
|
|
379
|
+
return n === r && O.has(n);
|
|
379
380
|
}
|
|
380
|
-
function
|
|
381
|
-
return typeof e.to == "boolean" ? e.to :
|
|
381
|
+
function Z(e) {
|
|
382
|
+
return typeof e.to == "boolean" ? e.to : D.get(e.to).includes(e.region);
|
|
382
383
|
}
|
|
383
|
-
export {
|
|
384
|
+
export { A as getComparisonPlan };
|
|
@@ -23,14 +23,14 @@ export interface ConditionConstants {
|
|
|
23
23
|
* other mutators own. A comparison keeps a constant only when
|
|
24
24
|
* comparison-operator neither emits it nor will run a mutant that subsumes it
|
|
25
25
|
* (see `getComparisonConstantSkip`). `true` and `false` are then emitted except
|
|
26
|
-
* the constant the types already give, the loop
|
|
27
|
-
*
|
|
28
|
-
* constant of a first exit test, and a
|
|
29
|
-
*
|
|
30
|
-
* rule, and so are the constants of the top
|
|
31
|
-
* of `&&` or `||` which logical-operator owns
|
|
32
|
-
* candidates. The plan is pure: the
|
|
33
|
-
* without running condition.
|
|
26
|
+
* the constant the types already give, a value that may keep the loop running
|
|
27
|
+
* forever (see `getEndlessValue`), a constant that a running directional mutant
|
|
28
|
+
* of a `??` test subsumes, the leave-now constant of a first exit test, and a
|
|
29
|
+
* constant that makes a no-op callback. The constants that are not emitted on
|
|
30
|
+
* such a node are returned with their rule, and so are the constants of the top
|
|
31
|
+
* of a `!` chain that is an operand of `&&` or `||` which logical-operator owns
|
|
32
|
+
* (O3); its other constants are not candidates. The plan is pure: the
|
|
33
|
+
* redundancy and ownership rules read it without running condition.
|
|
34
34
|
*
|
|
35
35
|
* @param node - Node of the runtime tree.
|
|
36
36
|
* @param context - Mutator context with the test of mutants that will run.
|
|
@@ -9,7 +9,7 @@ import { getLiteralMutator as s } from "./get-literal-mutator.js";
|
|
|
9
9
|
import { getOwnedConstants as c } from "./get-owned-constants.js";
|
|
10
10
|
import { getLeaveNowValue as l } from "./get-leave-now-value.js";
|
|
11
11
|
import { isAlwaysNullish as u } from "./is-always-nullish.js";
|
|
12
|
-
import {
|
|
12
|
+
import { getEndlessValue as d } from "./get-endless-value.js";
|
|
13
13
|
import { getLiteralValue as f } from "./get-literal-value.js";
|
|
14
14
|
import { getLiteralSkip as p } from "./get-literal-skip.js";
|
|
15
15
|
import { isAlwaysTruthy as m } from "./is-always-truthy.js";
|
|
@@ -83,9 +83,9 @@ function b(r, i) {
|
|
|
83
83
|
node: r
|
|
84
84
|
}, i)) ?? C(t, {
|
|
85
85
|
noOp: () => e(r, t, i),
|
|
86
|
-
running: k?.value,
|
|
87
86
|
subsumed: A,
|
|
88
87
|
leaveNow: j,
|
|
88
|
+
endless: k,
|
|
89
89
|
fixed: O
|
|
90
90
|
});
|
|
91
91
|
n ? h.skipped.push({
|
|
@@ -138,7 +138,7 @@ function C(e, t) {
|
|
|
138
138
|
reason: `the type hints make the condition always ${e}`,
|
|
139
139
|
rule: "typed-constant"
|
|
140
140
|
};
|
|
141
|
-
if (e === t.
|
|
141
|
+
if (e === t.endless) return i(e);
|
|
142
142
|
if (e === t.leaveNow) return h;
|
|
143
143
|
let n = t.subsumed.find((t) => t.value === e);
|
|
144
144
|
return n ? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObjectPropertyKind, ObjectExpression } from 'oxc-parser';
|
|
2
2
|
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
4
4
|
/**
|
|
5
5
|
* Decides whether the removal of a member of an object literal is skipped
|
|
6
6
|
* because the member sets an option of an `Intl` constructor to its default,
|
|
@@ -22,4 +22,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
22
22
|
* @param context - Mutator context.
|
|
23
23
|
* @returns Rule and reason of the skip, or null when the removal is emitted.
|
|
24
24
|
*/
|
|
25
|
-
export declare function getDefaultOptionSkip(property: ObjectPropertyKind, node: ObjectExpression, context: MutatorContext):
|
|
25
|
+
export declare function getDefaultOptionSkip(property: ObjectPropertyKind, node: ObjectExpression, context: MutatorContext): CoreNote | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Node } from 'oxc-parser';
|
|
2
|
+
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Finds the value of a node that may keep its loop running forever (catalog
|
|
5
|
+
* 2.2, TIMEOUT). In a loop test that is its running value (see
|
|
6
|
+
* `getRunningValue`), whatever else can end the loop. In an exit test it is its
|
|
7
|
+
* running value only while one of the loops that the test's `if` leaves (see
|
|
8
|
+
* `getExitedLoops`) has no other way out: no operand next to the node can end
|
|
9
|
+
* the loop on its own, as `b` can in `if (a || b) break`, and no `break`,
|
|
10
|
+
* `continue`, `return` or `throw` of the loop's update or body leaves it (see
|
|
11
|
+
* `isLoopExit`), apart from the consequent of the `if`, nested functions and
|
|
12
|
+
* values of instance fields, which run only when the class is instantiated.
|
|
13
|
+
* Calls, `await` and `yield` do not count: nearly every loop has them, and they
|
|
14
|
+
* rarely end it.
|
|
15
|
+
*
|
|
16
|
+
* @param node - Node of the runtime tree.
|
|
17
|
+
* @param context - Mutator context of the file.
|
|
18
|
+
* @returns The value that may keep the loop running forever, or null.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getEndlessValue(node: Node, context: MutatorContext): boolean | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getRunningValue as e } from "./get-running-value.js";
|
|
2
|
+
import { isFunction as t } from "../../syntax/is-function.js";
|
|
3
|
+
import { walkTree as n } from "../../tree/walk-tree.js";
|
|
4
|
+
import { isLoopExit as r } from "./is-loop-exit.js";
|
|
5
|
+
import { isNegation as i } from "./is-negation.js";
|
|
6
|
+
import { isAndOr as a } from "./is-and-or.js";
|
|
7
|
+
function o(t, n) {
|
|
8
|
+
let r = e(t, n);
|
|
9
|
+
if (!r) return null;
|
|
10
|
+
let { value: o } = r, c = !1, { parent: l, key: u } = n.syntax.getContextSlot(t);
|
|
11
|
+
for (; u !== "test";) i(l) ? o = !o : a(l) && l.operator === "&&" === o && (c = !0), {parent: l, key: u} = n.syntax.getContextSlot(l);
|
|
12
|
+
if (l?.type !== "IfStatement") return r.value;
|
|
13
|
+
let d = l;
|
|
14
|
+
return !c && n.syntax.getExitedLoops(d).some((e) => !s(e, d, n)) ? r.value : null;
|
|
15
|
+
}
|
|
16
|
+
function s(e, i, a) {
|
|
17
|
+
return [e.type === "ForStatement" ? e.update : null, e.body].some((o) => {
|
|
18
|
+
let s = !1;
|
|
19
|
+
return o && n(o, (n, o) => s || n === i.consequent || t(n) || c(o) || !a.syntax.isRuntimeNode(n) ? !1 : (s = r(n, e, a), !s)), s;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function c({ parent: e, key: t }) {
|
|
23
|
+
return t === "value" && (e?.type === "PropertyDefinition" || e?.type === "AccessorProperty") && !e.static;
|
|
24
|
+
}
|
|
25
|
+
export { o as getEndlessValue };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MutantSite, RunContext } from './create-run-context.js';
|
|
2
|
+
import { DirectionQuery } from './has-polar-mutant.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mutant that makes a candidate redundant, with what its skip rests on.
|
|
5
|
+
*/
|
|
6
|
+
interface ForcedTestJustifier {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the skip rests on the guess that the calls of the decision only
|
|
9
|
+
* read values.
|
|
10
|
+
*/
|
|
11
|
+
heuristic: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the mutant is the constant of the decision's owner (O19) rather
|
|
14
|
+
* than a mutant that moves the decision toward the value (R4, R5).
|
|
15
|
+
*/
|
|
16
|
+
owned: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The mutant.
|
|
19
|
+
*/
|
|
20
|
+
by: MutantSite;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Finds the mutant that makes redundant a candidate that acts like a decision
|
|
24
|
+
* forced to a truth value while the decision still runs, such as the removal of
|
|
25
|
+
* a then-branch or a copy of the other branch (catalog 5.2 O19, 5.3 R4 and R5).
|
|
26
|
+
* The constant of the decision's owner (see `getOwnerConstant`) skips every
|
|
27
|
+
* effect of the decision, so it counts only for a decision without effects (see
|
|
28
|
+
* `isEffectFree`). Otherwise a mutant that will run and moves the decision
|
|
29
|
+
* toward the value counts when it evaluates every part of the decision with an
|
|
30
|
+
* effect as the decision does (see `getTowardMutant`). A decision whose only
|
|
31
|
+
* effects are calls of well-known read-only methods (see `isReadOnly`) counts
|
|
32
|
+
* as one without effects too: the owner's constant then rests on that guess,
|
|
33
|
+
* and so does a mutant that moves the decision unless it evaluates every such
|
|
34
|
+
* call as the decision does.
|
|
35
|
+
*
|
|
36
|
+
* @param query - Candidate, decision and forced value.
|
|
37
|
+
* @param context - Mutator context with the test of mutants that will run.
|
|
38
|
+
* @param ownable - Whether the owner's constant may make the candidate
|
|
39
|
+
* redundant.
|
|
40
|
+
* @returns The mutant, whether it is the owner's constant and whether the skip
|
|
41
|
+
* rests on the guess, or null when the candidate is emitted.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getForcedTestJustifier(query: DirectionQuery, context: RunContext, ownable: boolean): ForcedTestJustifier | null;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isEffectFree as e } from "../../syntax/is-effect-free.js";
|
|
2
|
+
import { getOwnerConstant as t } from "./get-owner-constant.js";
|
|
3
|
+
import { getTowardMutant as n } from "./get-toward-mutant.js";
|
|
4
|
+
import { isReadOnly as r } from "./is-read-only.js";
|
|
5
|
+
function i(i, a, o) {
|
|
6
|
+
let { decision: s, value: c } = i, l = e(s), u = !l && r(s, a), d = o && (l || u) ? t(s, c, a) : null;
|
|
7
|
+
if (d) return {
|
|
8
|
+
heuristic: u,
|
|
9
|
+
owned: !0,
|
|
10
|
+
by: d
|
|
11
|
+
};
|
|
12
|
+
let f = n(i, a, !0);
|
|
13
|
+
if (f) return {
|
|
14
|
+
heuristic: !1,
|
|
15
|
+
owned: !1,
|
|
16
|
+
by: f
|
|
17
|
+
};
|
|
18
|
+
let p = u ? n(i, a) : null;
|
|
19
|
+
return p && {
|
|
20
|
+
heuristic: !0,
|
|
21
|
+
owned: !1,
|
|
22
|
+
by: p
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export { i as getForcedTestJustifier };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogicalExpression } from 'oxc-parser';
|
|
2
|
-
import {
|
|
2
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
3
3
|
import { RunContext } from './create-run-context.js';
|
|
4
4
|
/**
|
|
5
5
|
* Whether logical-operator gives a group its absorbing constant.
|
|
@@ -8,7 +8,7 @@ export interface GroupConstant {
|
|
|
8
8
|
/**
|
|
9
9
|
* Why the constant is not emitted on a node that could have it, or null.
|
|
10
10
|
*/
|
|
11
|
-
skip:
|
|
11
|
+
skip: CoreNote | null;
|
|
12
12
|
/**
|
|
13
13
|
* Whether the constant is emitted.
|
|
14
14
|
*/
|
|
@@ -20,10 +20,10 @@ export interface GroupConstant {
|
|
|
20
20
|
* root that is not an operand, through `!`, of another `&&` or `||`, unless a
|
|
21
21
|
* running mutant inside the group moves it only toward that constant. In
|
|
22
22
|
* boolean mode the constant is also skipped when fixed operands already give
|
|
23
|
-
* it, when it
|
|
24
|
-
* constant; in value mode the group must be
|
|
25
|
-
* the constant is skipped when it makes a
|
|
26
|
-
* comes with its rule.
|
|
23
|
+
* it, when it may keep the loop running forever (see `getEndlessValue`) or when
|
|
24
|
+
* it is a first exit test's leave-now constant; in value mode the group must be
|
|
25
|
+
* constant-eligible. In both modes the constant is skipped when it makes a
|
|
26
|
+
* no-op callback. A skipped constant comes with its rule.
|
|
27
27
|
*
|
|
28
28
|
* @param node - `&&` or `||` expression of the runtime tree.
|
|
29
29
|
* @param context - Mutator context with the test of mutants that will run.
|
|
@@ -4,7 +4,7 @@ import { getLoopRunningSkip as n } from "./get-loop-running-skip.js";
|
|
|
4
4
|
import { NO_OP_CALLBACK_SKIP as r } from "./no-op-callback-skip.js";
|
|
5
5
|
import { getLeaveNowValue as i } from "./get-leave-now-value.js";
|
|
6
6
|
import { isBooleanValued as a } from "./is-boolean-valued.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getEndlessValue as o } from "./get-endless-value.js";
|
|
8
8
|
import { hasPolarMutant as s } from "./has-polar-mutant.js";
|
|
9
9
|
import { getNegationTop as c } from "./get-negation-top.js";
|
|
10
10
|
import { LEAVE_NOW_SKIP as l } from "./leave-now-skip.js";
|
|
@@ -28,7 +28,7 @@ function p(p, m) {
|
|
|
28
28
|
if (d(p, m)) (m.syntax.isBooleanContext(p) || a(p, m)) && u(p, m) === g ? v = {
|
|
29
29
|
reason: `the group is always ${g ? "truthy" : "falsy"}`,
|
|
30
30
|
rule: "fixed-operand"
|
|
31
|
-
} : !m.settings.timeouts && o(p, m)
|
|
31
|
+
} : !m.settings.timeouts && o(p, m) === g ? v = n(g) : i(p, m) === g && (v = l);
|
|
32
32
|
else if (!e(p, m)) return {
|
|
33
33
|
emitted: !1,
|
|
34
34
|
skip: null
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } from 'oxc-parser';
|
|
2
2
|
import { LiteralChange } from '../../../types/syntax/literal-change.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
4
4
|
import { RunContext } from './create-run-context.js';
|
|
5
5
|
/**
|
|
6
6
|
* Change of a literal and the rules of its own mutator.
|
|
@@ -10,7 +10,7 @@ interface LiteralSkipQuery {
|
|
|
10
10
|
* Rules of the literal's own mutator, checked after the operand and error
|
|
11
11
|
* message rules; omitted when the mutator has none.
|
|
12
12
|
*/
|
|
13
|
-
getOwnSkip?():
|
|
13
|
+
getOwnSkip?(): CoreNote | null;
|
|
14
14
|
/**
|
|
15
15
|
* New value of the literal, or new text of a template with expressions.
|
|
16
16
|
*/
|
|
@@ -22,17 +22,17 @@ interface LiteralSkipQuery {
|
|
|
22
22
|
* operand of a comparison (shifted-literal, O4; see `getComparisonOperandSkip`)
|
|
23
23
|
* or of a boolean-mode `&&` or `||` (O3) or, whose change is invisible, of
|
|
24
24
|
* `void` (EQ), a string is an error message (NOISE), a boolean or number change
|
|
25
|
-
*
|
|
26
|
-
* the change copies the other branch of a branch pair
|
|
27
|
-
* callback (O12) or empties a `||` default (O16, R7).
|
|
28
|
-
* expressions, which changes only its text, is checked against
|
|
29
|
-
* and the branch copy. The rules of the literal's own mutator
|
|
30
|
-
* after the operand and error message rules.
|
|
25
|
+
* may keep a loop running forever (see `getEndlessValue`) unless the `timeouts`
|
|
26
|
+
* setting is on (TIMEOUT), the change copies the other branch of a branch pair
|
|
27
|
+
* (O19, R5), makes a no-op callback (O12) or empties a `||` default (O16, R7).
|
|
28
|
+
* A template with expressions, which changes only its text, is checked against
|
|
29
|
+
* the first four and the branch copy. The rules of the literal's own mutator
|
|
30
|
+
* are checked right after the operand and error message rules.
|
|
31
31
|
*
|
|
32
32
|
* @param node - Literal that a literal mutator would replace.
|
|
33
33
|
* @param query - Change of the literal and the rules of its own mutator.
|
|
34
34
|
* @param context - Mutator context with the test of mutants that will run.
|
|
35
35
|
* @returns Rule and reason of the skip, or null when no rule skips the change.
|
|
36
36
|
*/
|
|
37
|
-
export declare function getLiteralSkip(node: Node, query: LiteralSkipQuery, context: RunContext):
|
|
37
|
+
export declare function getLiteralSkip(node: Node, query: LiteralSkipQuery, context: RunContext): CoreNote | null;
|
|
38
38
|
export {};
|