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
|
@@ -6,7 +6,7 @@ import { getBranchCopySkip as i } from "./get-branch-copy-skip.js";
|
|
|
6
6
|
import { getLiteralMutator as a } from "./get-literal-mutator.js";
|
|
7
7
|
import { getShiftedLiteral as o } from "./get-shifted-literal.js";
|
|
8
8
|
import { getOrDefaultSkip as s } from "./get-or-default-skip.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getEndlessValue as c } from "./get-endless-value.js";
|
|
10
10
|
import { getNegationTop as l } from "./get-negation-top.js";
|
|
11
11
|
import { isVoidOperand as u } from "./is-void-operand.js";
|
|
12
12
|
function d(o, l, d) {
|
|
@@ -32,7 +32,7 @@ function d(o, l, d) {
|
|
|
32
32
|
if (v) return v;
|
|
33
33
|
if (!("value" in h)) return i(o, h, d);
|
|
34
34
|
let { value: y } = h;
|
|
35
|
-
return g !== "string-literal" && !d.settings.timeouts && c(o, d)
|
|
35
|
+
return g !== "string-literal" && !d.settings.timeouts && c(o, d) === !!y ? {
|
|
36
36
|
reason: "the new value may keep the loop running forever",
|
|
37
37
|
rule: "loop-running"
|
|
38
38
|
} : i(o, h, d) || (e(o, y, d) ? r : s(o, y, d));
|
|
@@ -28,14 +28,14 @@ export interface LogicalDrops {
|
|
|
28
28
|
/**
|
|
29
29
|
* Decides the drops of a `&&` or `||` (catalog 4.8, emissions 1 and 2): each
|
|
30
30
|
* operand is dropped unless it is a same-operator group, the drop is equivalent
|
|
31
|
-
* by the types or by fixed operands, or the
|
|
32
|
-
* mutant that subsumes it. In value mode a `||`
|
|
33
|
-
* gets the nullish swap instead of the drop of
|
|
34
|
-
* `||` differ, which they never do, under every
|
|
35
|
-
* left side is never falsy unless nullish (see
|
|
36
|
-
* swaps that are not emitted are returned with
|
|
37
|
-
* the polarity rule of other mutators reads it
|
|
38
|
-
* logical-operator.
|
|
31
|
+
* by the types (see `getCanonicalFalsyDefault`) or by fixed operands, or the
|
|
32
|
+
* polarity rule finds a running mutant that subsumes it. In value mode a `||`
|
|
33
|
+
* whose left side may be nullish gets the nullish swap instead of the drop of
|
|
34
|
+
* its right operand when `??` and `||` differ, which they never do, under every
|
|
35
|
+
* `nullishSwap` mode, when the left side is never falsy unless nullish (see
|
|
36
|
+
* `getNeverFalsyFact`). Drops and swaps that are not emitted are returned with
|
|
37
|
+
* their rule. The plan is pure: the polarity rule of other mutators reads it
|
|
38
|
+
* without running logical-operator.
|
|
39
39
|
*
|
|
40
40
|
* @param node - `&&` or `||` expression of the runtime tree.
|
|
41
41
|
* @param context - Mutator context with the test of mutants that will run.
|
|
@@ -1,123 +1,121 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getCanonicalFalsyDefault as e } from "./get-canonical-falsy-default.js";
|
|
2
|
+
import { unwrapParentheses as t } from "../../tree/unwrap-parentheses.js";
|
|
3
3
|
import { getNullishSwapSkip as n } from "./get-nullish-swap-skip.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function p(p, h, g) {
|
|
15
|
-
let { sourceCode: _, hints: v } = h, { operator: y, right: b, left: x } = p, S = y === "&&", C = l(p, h), w = h.syntax.isBooleanContext(p) || i(x, h) && i(b, h), T = w ? c(x, h) : null, E = w ? c(b, h) : null, D = v.getType(x), O = t(D) && !d(D) && r(f(D).type, b), k = {
|
|
4
|
+
import { isBooleanValued as r } from "./is-boolean-valued.js";
|
|
5
|
+
import { isAlwaysNullish as i } from "./is-always-nullish.js";
|
|
6
|
+
import { hasPolarMutant as a } from "./has-polar-mutant.js";
|
|
7
|
+
import { isAlwaysTruthy as o } from "./is-always-truthy.js";
|
|
8
|
+
import { getFixedTruth as s } from "./get-fixed-truth.js";
|
|
9
|
+
import { isBooleanMode as c } from "./is-boolean-mode.js";
|
|
10
|
+
import { mayBeBoolean as l } from "./may-be-boolean.js";
|
|
11
|
+
import { mayBeNullish as u } from "./may-be-nullish.js";
|
|
12
|
+
function d(d, p, m) {
|
|
13
|
+
let { sourceCode: h, hints: g } = p, { operator: _, right: v, left: y } = d, b = _ === "&&", x = c(d, p), S = p.syntax.isBooleanContext(d) || r(y, p) && r(v, p), C = S ? s(y, p) : null, w = S ? s(v, p) : null, T = g.getType(y), E = e(y, v, p), D = {
|
|
16
14
|
mutator: "logical-operator",
|
|
17
|
-
node:
|
|
18
|
-
},
|
|
19
|
-
reason: "the right operand is the only falsy value of the left operand's type, so the result is the same",
|
|
15
|
+
node: d
|
|
16
|
+
}, O = [], k = b ? "truthy" : "falsy", A = b ? "falsy" : "truthy", j = E && {
|
|
17
|
+
reason: E.because === null ? "the right operand is the only falsy value of the left operand's type, so the result is the same" : `the right operand is the only falsy value of the left operand, which is never NaN (${E.because}), so the result is the same`,
|
|
20
18
|
rule: "canonical-falsy-default"
|
|
21
19
|
};
|
|
22
|
-
function
|
|
23
|
-
return
|
|
24
|
-
reason: `the left operand is always ${
|
|
20
|
+
function M() {
|
|
21
|
+
return C === b ? {
|
|
22
|
+
reason: `the left operand is always ${k}, so dropping it changes nothing`,
|
|
25
23
|
rule: "fixed-operand"
|
|
26
|
-
} :
|
|
27
|
-
reason: `the right operand is always ${
|
|
24
|
+
} : w === !b ? {
|
|
25
|
+
reason: `the right operand is always ${A}, so the result is the same without the left operand`,
|
|
28
26
|
rule: "fixed-operand"
|
|
29
|
-
} : (
|
|
30
|
-
reason: `the type hints make the left operand always ${
|
|
27
|
+
} : (b ? o(T) : i(T)) ? {
|
|
28
|
+
reason: `the type hints make the left operand always ${b ? "truthy" : "nullish"}, so dropping it changes nothing`,
|
|
31
29
|
rule: "typed-constant"
|
|
32
|
-
} :
|
|
33
|
-
value:
|
|
34
|
-
decision:
|
|
35
|
-
candidate:
|
|
36
|
-
},
|
|
37
|
-
reason: `a mutant inside the left operand makes it ${
|
|
30
|
+
} : b && j ? j : a({
|
|
31
|
+
value: b,
|
|
32
|
+
decision: y,
|
|
33
|
+
candidate: D
|
|
34
|
+
}, p) ? {
|
|
35
|
+
reason: `a mutant inside the left operand makes it ${k} on some inputs`,
|
|
38
36
|
rule: "R2"
|
|
39
37
|
} : null;
|
|
40
38
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
43
|
-
reason: `the right operand is always ${
|
|
39
|
+
function N() {
|
|
40
|
+
return w === b ? {
|
|
41
|
+
reason: `the right operand is always ${k}, so dropping it changes nothing`,
|
|
44
42
|
rule: "fixed-operand"
|
|
45
|
-
} :
|
|
46
|
-
reason: `the left operand is always ${
|
|
43
|
+
} : C === !b ? {
|
|
44
|
+
reason: `the left operand is always ${A}, so the right operand never decides the result`,
|
|
47
45
|
rule: "fixed-operand"
|
|
48
|
-
} : (
|
|
49
|
-
reason: `the type hints make the left operand always ${
|
|
46
|
+
} : (b ? i(T) : o(T)) ? {
|
|
47
|
+
reason: `the type hints make the left operand always ${b ? "nullish" : "truthy"}, so the right operand never decides the result`,
|
|
50
48
|
rule: "typed-constant"
|
|
51
|
-
} : !
|
|
49
|
+
} : !b && j ? j : null;
|
|
52
50
|
}
|
|
53
|
-
function
|
|
54
|
-
return
|
|
55
|
-
value:
|
|
56
|
-
decision:
|
|
57
|
-
candidate:
|
|
58
|
-
},
|
|
59
|
-
value: !
|
|
60
|
-
decision:
|
|
61
|
-
candidate:
|
|
62
|
-
},
|
|
51
|
+
function P() {
|
|
52
|
+
return a({
|
|
53
|
+
value: b,
|
|
54
|
+
decision: v,
|
|
55
|
+
candidate: D
|
|
56
|
+
}, p) || !x && !l(g.getType(v)) && a({
|
|
57
|
+
value: !b,
|
|
58
|
+
decision: y,
|
|
59
|
+
candidate: D
|
|
60
|
+
}, p, !0) ? {
|
|
63
61
|
reason: "a mutant inside the expression gives the same result as this drop on some inputs",
|
|
64
62
|
rule: "R2"
|
|
65
63
|
} : null;
|
|
66
64
|
}
|
|
67
|
-
let
|
|
68
|
-
if (!
|
|
69
|
-
let e =
|
|
70
|
-
|
|
71
|
-
text:
|
|
65
|
+
let F = !1;
|
|
66
|
+
if (!f(y, _)) {
|
|
67
|
+
let e = M();
|
|
68
|
+
F = e === null, e && O.push({
|
|
69
|
+
text: h.getText(v),
|
|
72
70
|
skip: e,
|
|
73
|
-
node:
|
|
71
|
+
node: d
|
|
74
72
|
});
|
|
75
73
|
}
|
|
76
|
-
let
|
|
77
|
-
if (!
|
|
78
|
-
let e =
|
|
79
|
-
|
|
80
|
-
text:
|
|
74
|
+
let I = !1;
|
|
75
|
+
if (!f(v, _)) {
|
|
76
|
+
let e = N();
|
|
77
|
+
I = e === null, e && O.push({
|
|
78
|
+
text: h.getText(y),
|
|
81
79
|
skip: e,
|
|
82
|
-
node:
|
|
80
|
+
node: d
|
|
83
81
|
});
|
|
84
82
|
}
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
text:
|
|
88
|
-
skip:
|
|
89
|
-
node:
|
|
83
|
+
let L = I && !b && !x && u(T) && t(y).type !== "LogicalExpression", R = L ? n(d, p, m) : null, z = L && R === null;
|
|
84
|
+
R && O.push({
|
|
85
|
+
text: h.replaceOperator(d, "??"),
|
|
86
|
+
skip: R,
|
|
87
|
+
node: d
|
|
90
88
|
});
|
|
91
|
-
let
|
|
92
|
-
if (
|
|
89
|
+
let B = !1;
|
|
90
|
+
if (z) O.push({
|
|
93
91
|
skip: {
|
|
94
92
|
reason: "every test that kills the swap to ?? also kills this drop",
|
|
95
93
|
by: {
|
|
96
94
|
mutator: "logical-operator",
|
|
97
|
-
node:
|
|
95
|
+
node: d
|
|
98
96
|
},
|
|
99
97
|
rule: "swap-subsumes-drop"
|
|
100
98
|
},
|
|
101
|
-
text:
|
|
102
|
-
node:
|
|
99
|
+
text: h.getText(y),
|
|
100
|
+
node: d
|
|
103
101
|
});
|
|
104
|
-
else if (
|
|
105
|
-
let e =
|
|
106
|
-
|
|
107
|
-
text:
|
|
102
|
+
else if (I) {
|
|
103
|
+
let e = P();
|
|
104
|
+
B = e === null, e && O.push({
|
|
105
|
+
text: h.getText(y),
|
|
108
106
|
skip: e,
|
|
109
|
-
node:
|
|
107
|
+
node: d
|
|
110
108
|
});
|
|
111
109
|
}
|
|
112
110
|
return {
|
|
113
|
-
dropRight:
|
|
114
|
-
dropLeft:
|
|
115
|
-
skipped:
|
|
116
|
-
swap:
|
|
111
|
+
dropRight: B,
|
|
112
|
+
dropLeft: F,
|
|
113
|
+
skipped: O,
|
|
114
|
+
swap: z
|
|
117
115
|
};
|
|
118
116
|
}
|
|
119
|
-
function
|
|
120
|
-
let r = e
|
|
117
|
+
function f(e, n) {
|
|
118
|
+
let r = t(e);
|
|
121
119
|
return r.type === "LogicalExpression" && r.operator === n;
|
|
122
120
|
}
|
|
123
|
-
export {
|
|
121
|
+
export { d as getLogicalDrops };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
2
2
|
/**
|
|
3
3
|
* Builds the skip of a constant that gives a loop its running value, so the
|
|
4
4
|
* loop may never end.
|
|
@@ -6,4 +6,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
6
6
|
* @param value - Constant that keeps the loop running.
|
|
7
7
|
* @returns Rule and reason of the skip.
|
|
8
8
|
*/
|
|
9
|
-
export declare function getLoopRunningSkip(value: boolean):
|
|
9
|
+
export declare function getLoopRunningSkip(value: boolean): CoreNote;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogicalExpression } 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
|
* Finds why the swap between `??` and `||` of a logical expression is not
|
|
6
6
|
* emitted (catalog 4.8): under every `nullishSwap` mode it is equivalent when
|
|
@@ -13,4 +13,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
13
13
|
* @param nullishSwap - The `nullishSwap` option of logical-operator.
|
|
14
14
|
* @returns Rule and reason of the skip, or null when the swap is emitted.
|
|
15
15
|
*/
|
|
16
|
-
export declare function getNullishSwapSkip(node: LogicalExpression, context: MutatorContext, nullishSwap: 'distinguishing' | 'always'):
|
|
16
|
+
export declare function getNullishSwapSkip(node: LogicalExpression, context: MutatorContext, nullishSwap: 'distinguishing' | 'always'): CoreNote | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node } from 'oxc-parser';
|
|
2
|
-
import {
|
|
2
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
3
3
|
import { LiteralValue } from './get-literal-value.js';
|
|
4
4
|
import { RunContext } from './create-run-context.js';
|
|
5
5
|
/**
|
|
@@ -15,4 +15,4 @@ import { RunContext } from './create-run-context.js';
|
|
|
15
15
|
* @param context - Mutator context with the test of mutants that will run.
|
|
16
16
|
* @returns Rule and reason of the skip, or null when the mutant is emitted.
|
|
17
17
|
*/
|
|
18
|
-
export declare function getOrDefaultSkip(node: Node, value: LiteralValue, context: RunContext):
|
|
18
|
+
export declare function getOrDefaultSkip(node: Node, value: LiteralValue, context: RunContext): CoreNote | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } 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
|
* Finds the constants of a node that logical-operator owns (catalog 4.6, rule
|
|
6
6
|
* 2, O3): both in a boolean-mode operand, an operand of a `&&` or `||` in
|
|
@@ -14,4 +14,4 @@ import { SkipNote } from '../../../types/mutant/skip-note.js';
|
|
|
14
14
|
* @param context - Mutator context of the file.
|
|
15
15
|
* @returns The skip of each owned constant.
|
|
16
16
|
*/
|
|
17
|
-
export declare function getOwnedConstants(node: Node, context: MutatorContext): Map<boolean,
|
|
17
|
+
export declare function getOwnedConstants(node: Node, context: MutatorContext): Map<boolean, CoreNote>;
|
|
@@ -9,7 +9,9 @@ import { MutantSite } from './create-run-context.js';
|
|
|
9
9
|
* enabled and without ignore comments: condition's constant, a comparison's
|
|
10
10
|
* constant, a group constant, or the flip of a literal. A candidate with the
|
|
11
11
|
* behavior of that decision forced to the value is then the same mutant under
|
|
12
|
-
* another name and is skipped statically.
|
|
12
|
+
* another name and is skipped statically. The constant skips every effect of
|
|
13
|
+
* the decision, so a candidate that still evaluates the decision is that mutant
|
|
14
|
+
* only when the decision has no effect, which the caller checks.
|
|
13
15
|
*
|
|
14
16
|
* @param node - Decision: a test, a returned value or a node inside one.
|
|
15
17
|
* @param value - Truth value the candidate forces the decision to.
|
|
@@ -6,9 +6,9 @@ import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
|
6
6
|
export interface RunningValue {
|
|
7
7
|
/**
|
|
8
8
|
* Loop whose continuation the node decides; for an exit test that leaves
|
|
9
|
-
* several loops that run forever, the innermost one
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* several loops that run forever, the innermost one, whose body runs between
|
|
10
|
+
* two checks of the test unless something else leaves it. Whether the value
|
|
11
|
+
* keeps each of these loops running forever is left to `getEndlessValue`.
|
|
12
12
|
*/
|
|
13
13
|
loop: DoWhileStatement | WhileStatement | ForStatement;
|
|
14
14
|
/**
|
|
@@ -22,7 +22,8 @@ export interface RunningValue {
|
|
|
22
22
|
* the opposite of the parent's under `!`, and the parent's in an operand of a
|
|
23
23
|
* `&&` or `||` in boolean mode. A node has one exactly when it is in a loop
|
|
24
24
|
* condition (`LT`). A mutant that makes the node equal its running value
|
|
25
|
-
* everywhere keeps the loop running
|
|
25
|
+
* everywhere keeps the loop running unless something else ends it, such as
|
|
26
|
+
* another exit of the loop (see `getEndlessValue`).
|
|
26
27
|
*
|
|
27
28
|
* @param node - Node of the runtime tree.
|
|
28
29
|
* @param context - Mutator context of the file.
|
|
@@ -8,11 +8,19 @@ import { DirectionQuery } from './has-polar-mutant.js';
|
|
|
8
8
|
* or `||` or its group constant, a directional mutant of a `??`, and a literal
|
|
9
9
|
* flip, each giving the sought value. Such a mutant changes the decision only
|
|
10
10
|
* where forcing it changes it, and to the same value, so it subsumes the
|
|
11
|
-
* candidate.
|
|
11
|
+
* candidate. A candidate that still evaluates the whole decision, such as the
|
|
12
|
+
* removal of a then-branch, is subsumed only by a mutant that also evaluates
|
|
13
|
+
* every part of the decision with an effect (see `isEffectFree`) as the
|
|
14
|
+
* decision does: with `keepsEffects`, the walk passes over a constant that
|
|
15
|
+
* replaces such a part, a mutant that skips it or runs it on more inputs, and a
|
|
16
|
+
* mutant of an operand that decides whether it runs, and looks further.
|
|
12
17
|
*
|
|
13
18
|
* @param query - Candidate, decision and forced value.
|
|
14
19
|
* @param context - Mutator context with the test of mutants that will run.
|
|
20
|
+
* @param keepsEffects - Whether the mutant must evaluate every part of the
|
|
21
|
+
* decision with an effect as the decision does, for a candidate that keeps
|
|
22
|
+
* the whole decision.
|
|
15
23
|
* @returns The first such mutant in walk order, or null when the candidate is
|
|
16
24
|
* not redundant.
|
|
17
25
|
*/
|
|
18
|
-
export declare function getTowardMutant(query: DirectionQuery, context: RunContext): MutantSite | null;
|
|
26
|
+
export declare function getTowardMutant(query: DirectionQuery, context: RunContext, keepsEffects?: boolean): MutantSite | null;
|
|
@@ -2,65 +2,70 @@ import { getConditionConstants as e } from "./get-condition-constants.js";
|
|
|
2
2
|
import { unwrapParentheses as t } from "../../tree/unwrap-parentheses.js";
|
|
3
3
|
import { getNullishDirections as n } from "./get-nullish-directions.js";
|
|
4
4
|
import { unwrapExpression as r } from "../../tree/unwrap-expression.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
import { isEffectFree as i } from "../../syntax/is-effect-free.js";
|
|
6
|
+
import { getComparisonPlan as a } from "./get-comparison-plan.js";
|
|
7
|
+
import { getLiteralMutator as o } from "./get-literal-mutator.js";
|
|
8
|
+
import { getGroupConstant as s } from "./get-group-constant.js";
|
|
9
|
+
import { getLogicalDrops as c } from "./get-logical-drops.js";
|
|
10
|
+
import { getLiteralTruth as l } from "./get-literal-truth.js";
|
|
11
|
+
import { getLiteralFlip as u } from "./get-literal-flip.js";
|
|
12
|
+
import { isBooleanMode as d } from "./is-boolean-mode.js";
|
|
13
|
+
import { isComparison as f } from "./is-comparison.js";
|
|
14
|
+
import { getInnermost as p } from "./get-innermost.js";
|
|
15
|
+
import { isAndOr as m } from "./is-and-or.js";
|
|
16
|
+
function h(e, t, n = !1) {
|
|
17
|
+
return g(e.decision, e.value, {
|
|
18
|
+
keepsEffects: n,
|
|
17
19
|
context: t,
|
|
18
20
|
query: e
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
let { context:
|
|
23
|
+
function g(i, s, c) {
|
|
24
|
+
let { context: l, query: d } = c, { candidate: h } = d, g = t(i), b = r(i), x = (g === b ? [g] : [g, b]).find((t) => y(t, c) && e(t, l).values.includes(s) && l.runs({
|
|
23
25
|
mutator: "condition",
|
|
24
26
|
node: t
|
|
25
27
|
}, h));
|
|
26
|
-
if (
|
|
28
|
+
if (x) return {
|
|
27
29
|
mutator: "condition",
|
|
28
|
-
node:
|
|
30
|
+
node: x
|
|
29
31
|
};
|
|
30
|
-
let { node:
|
|
31
|
-
if (
|
|
32
|
-
if (
|
|
32
|
+
let { node: S, negations: C } = p(i), w = s !== (C % 2 == 1);
|
|
33
|
+
if (S.type === "ConditionalExpression") return v(S, w, c);
|
|
34
|
+
if (f(S)) {
|
|
33
35
|
let e = {
|
|
34
36
|
mutator: "comparison-operator",
|
|
35
|
-
node:
|
|
37
|
+
node: S
|
|
36
38
|
};
|
|
37
|
-
return
|
|
39
|
+
return l.runs(e, h) && a(S, l).entries.some((e) => e.value === w && (e.kind !== "constant" || y(S, c))) ? e : null;
|
|
38
40
|
}
|
|
39
|
-
if (
|
|
40
|
-
if (
|
|
41
|
-
if (
|
|
42
|
-
let
|
|
43
|
-
mutator:
|
|
44
|
-
node:
|
|
41
|
+
if (S.type === "LogicalExpression" && S.operator === "??") return n(S, h, l).find((e) => e.value === w && y(S.right, c))?.by ?? null;
|
|
42
|
+
if (m(S)) return _(S, w, c);
|
|
43
|
+
if (u(S, l) !== w) return null;
|
|
44
|
+
let T = {
|
|
45
|
+
mutator: o(S),
|
|
46
|
+
node: S
|
|
45
47
|
};
|
|
46
|
-
return
|
|
48
|
+
return l.runs(T, h) ? T : null;
|
|
47
49
|
}
|
|
48
|
-
function
|
|
49
|
-
let { context: r, query: i } = n, a = e.operator === "&&",
|
|
50
|
+
function _(e, t, n) {
|
|
51
|
+
let { context: r, query: i } = n, a = e.operator === "&&", o = {
|
|
50
52
|
mutator: "logical-operator",
|
|
51
53
|
node: e
|
|
52
54
|
};
|
|
53
|
-
if (r.runs(
|
|
54
|
-
if (a === t &&
|
|
55
|
-
let t =
|
|
56
|
-
if (t.dropLeft || t.dropRight) return
|
|
55
|
+
if (r.runs(o, i.candidate)) {
|
|
56
|
+
if (a === t && d(e, r)) {
|
|
57
|
+
let t = c(e, r, "distinguishing");
|
|
58
|
+
if (t.dropLeft && y(e, n) || t.dropRight && y(e.right, n)) return o;
|
|
57
59
|
}
|
|
58
|
-
if (a !== t &&
|
|
60
|
+
if (a !== t && y(e, n) && s(e, r).emitted) return o;
|
|
59
61
|
}
|
|
60
|
-
return
|
|
62
|
+
return (y(e.right, n) ? g(e.left, t, n) : null) ?? g(e.right, t, n);
|
|
61
63
|
}
|
|
62
|
-
function
|
|
63
|
-
let r =
|
|
64
|
-
return (r === t || i === !t ?
|
|
64
|
+
function v(e, t, n) {
|
|
65
|
+
let r = l(e.consequent, n.context), i = l(e.alternate, n.context), a = y(e.consequent, n) && y(e.alternate, n);
|
|
66
|
+
return (a && (r === t || i === !t) ? g(e.test, !0, n) : null) ?? (a && (i === t || r === !t) ? g(e.test, !1, n) : null) ?? g(e.consequent, t, n) ?? g(e.alternate, t, n);
|
|
67
|
+
}
|
|
68
|
+
function y(e, t) {
|
|
69
|
+
return !t.keepsEffects || i(e);
|
|
65
70
|
}
|
|
66
|
-
export {
|
|
71
|
+
export { h as getTowardMutant };
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { isFunction as e } from "../../syntax/is-function.js";
|
|
2
2
|
import { walkTree as t } from "../../tree/walk-tree.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"SwitchStatement",
|
|
8
|
-
"ForOfStatement",
|
|
9
|
-
"ForInStatement",
|
|
10
|
-
"WhileStatement",
|
|
11
|
-
"ForStatement"
|
|
12
|
-
]), a = /* @__PURE__ */ new Set([
|
|
3
|
+
import { isLoopExit as n } from "./is-loop-exit.js";
|
|
4
|
+
import { isNegation as r } from "./is-negation.js";
|
|
5
|
+
import { isAndOr as i } from "./is-and-or.js";
|
|
6
|
+
let a = /* @__PURE__ */ new Set([
|
|
13
7
|
"TaggedTemplateExpression",
|
|
14
8
|
"ImportExpression",
|
|
15
9
|
"AwaitExpression",
|
|
@@ -19,38 +13,24 @@ let i = /* @__PURE__ */ new Set([
|
|
|
19
13
|
"ThrowStatement",
|
|
20
14
|
"NewExpression"
|
|
21
15
|
]);
|
|
22
|
-
function o(
|
|
23
|
-
let { syntax:
|
|
24
|
-
for (; f !== "test" || d !==
|
|
25
|
-
if (
|
|
26
|
-
else if (
|
|
27
|
-
({parent: d, key: f} =
|
|
16
|
+
function o(n, a, o) {
|
|
17
|
+
let { syntax: c } = o, { value: l, loop: u } = a, { parent: d, key: f } = c.getContextSlot(n);
|
|
18
|
+
for (; f !== "test" || d !== u && d?.type !== "IfStatement";) {
|
|
19
|
+
if (r(d)) l = !l;
|
|
20
|
+
else if (i(d) && d.operator === "&&" === l) return !0;
|
|
21
|
+
({parent: d, key: f} = c.getContextSlot(d));
|
|
28
22
|
}
|
|
29
23
|
let p = d.type === "IfStatement" ? d.consequent : null;
|
|
30
24
|
return [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
u.test,
|
|
26
|
+
u.type === "ForStatement" ? u.update : null,
|
|
27
|
+
u.body
|
|
34
28
|
].some((n) => {
|
|
35
29
|
let r = !1;
|
|
36
|
-
return n && t(n, (t) => r || t === p || e(t) || !
|
|
30
|
+
return n && t(n, (t) => r || t === p || e(t) || !c.isRuntimeNode(t) ? !1 : (r = s(t, u, o), !r)), r;
|
|
37
31
|
});
|
|
38
32
|
}
|
|
39
|
-
function s(e, t,
|
|
40
|
-
|
|
41
|
-
return r ? !l(e, t, n).some(({ parent: e }) => e?.type === "LabeledStatement" && e.label.name === r.name) && (e.type === "BreakStatement" || !c(t, n).has(r.name)) : e.type === "BreakStatement" && l(e, t, n).every(({ parent: e }) => !i.has(e.type));
|
|
42
|
-
}
|
|
43
|
-
function c(e, t) {
|
|
44
|
-
let n = /* @__PURE__ */ new Set(), { parent: r } = t.syntax.getContextSlot(e);
|
|
45
|
-
for (; r?.type === "LabeledStatement";) n.add(r.label.name), {parent: r} = t.syntax.getContextSlot(r);
|
|
46
|
-
return n;
|
|
47
|
-
}
|
|
48
|
-
function l(e, t, n) {
|
|
49
|
-
let r = [], i = n.syntax.getContextSlot(e);
|
|
50
|
-
for (; i.parent !== t;) r.push(i), i = n.syntax.getContextSlot(i.parent);
|
|
51
|
-
return r;
|
|
52
|
-
}
|
|
53
|
-
function u(e, t, n) {
|
|
54
|
-
return e.type === "ContinueStatement" || e.type === "BreakStatement" ? s(e, t, n) : a.has(e.type);
|
|
33
|
+
function s(e, t, r) {
|
|
34
|
+
return a.has(e.type) || n(e, t, r);
|
|
55
35
|
}
|
|
56
36
|
export { o as hasOtherExit };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Node } from 'oxc-parser';
|
|
2
|
+
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
|
+
import { RunningValue } from './get-running-value.js';
|
|
4
|
+
/**
|
|
5
|
+
* Loop that decides with a test whether to run its body again.
|
|
6
|
+
*/
|
|
7
|
+
type TestedLoop = RunningValue['loop'];
|
|
8
|
+
/**
|
|
9
|
+
* Tells whether a statement of a loop leaves it: a `return`, a `throw` unless
|
|
10
|
+
* the block of a `try` with a `catch` inside the loop holds it, and a `break`
|
|
11
|
+
* or `continue` that leaves the loop (see `leavesByJump`). A jump in a
|
|
12
|
+
* `finally` block that cancels such a statement is not taken into account.
|
|
13
|
+
*
|
|
14
|
+
* @param node - Node inside the loop, outside nested functions.
|
|
15
|
+
* @param loop - Loop around the node.
|
|
16
|
+
* @param context - Mutator context of the file.
|
|
17
|
+
* @returns Whether the node leaves the loop.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isLoopExit(node: Node, loop: TestedLoop, context: MutatorContext): boolean;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
let e = /* @__PURE__ */ new Set([
|
|
2
|
+
"DoWhileStatement",
|
|
3
|
+
"SwitchStatement",
|
|
4
|
+
"ForOfStatement",
|
|
5
|
+
"ForInStatement",
|
|
6
|
+
"WhileStatement",
|
|
7
|
+
"ForStatement"
|
|
8
|
+
]);
|
|
9
|
+
function t(e, t, r) {
|
|
10
|
+
switch (e.type) {
|
|
11
|
+
case "ContinueStatement":
|
|
12
|
+
case "BreakStatement": return n(e, t, r);
|
|
13
|
+
case "ReturnStatement": return !0;
|
|
14
|
+
case "ThrowStatement": return i(e, t, r).every(({ parent: e, key: t }) => e?.type !== "TryStatement" || t !== "block" || e.handler === null);
|
|
15
|
+
default: return !1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function n(t, n, a) {
|
|
19
|
+
let { label: o } = t;
|
|
20
|
+
return o ? !i(t, n, a).some(({ parent: e }) => e?.type === "LabeledStatement" && e.label.name === o.name) && (t.type === "BreakStatement" || !r(n, a).has(o.name)) : t.type === "BreakStatement" && i(t, n, a).every(({ parent: t }) => !e.has(t.type));
|
|
21
|
+
}
|
|
22
|
+
function r(e, t) {
|
|
23
|
+
let n = /* @__PURE__ */ new Set(), { parent: r } = t.syntax.getContextSlot(e);
|
|
24
|
+
for (; r?.type === "LabeledStatement";) n.add(r.label.name), {parent: r} = t.syntax.getContextSlot(r);
|
|
25
|
+
return n;
|
|
26
|
+
}
|
|
27
|
+
function i(e, t, n) {
|
|
28
|
+
let r = [], i = n.syntax.getContextSlot(e);
|
|
29
|
+
for (; i.parent !== t;) r.push(i), i = n.syntax.getContextSlot(i.parent);
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
export { t as isLoopExit };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Node } from 'oxc-parser';
|
|
2
|
+
import { MutatorContext } from '../../../types/mutator/mutator-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Tells whether evaluating an expression only reads values, judged as
|
|
5
|
+
* `isEffectFree` judges it, except that a call counts as a read when its method
|
|
6
|
+
* only reads values and its receiver and arguments only read values too: a
|
|
7
|
+
* read-only method of a string, an array, a map, a set or a date, such as `has`
|
|
8
|
+
* or `includes`, or a static method of `Array`, `Number` or `Object` that only
|
|
9
|
+
* reads its arguments, such as `isArray`, also in an optional chain. A method
|
|
10
|
+
* that calls its first argument with each element, such as `some`, counts when
|
|
11
|
+
* that argument is an arrow function that is not async and has an expression
|
|
12
|
+
* body, whose parameters and body are judged the same way. `test` and `exec`
|
|
13
|
+
* count on a regular expression literal, which makes a new object on each
|
|
14
|
+
* evaluation, or on a name declared once with `let` or `const` and a literal
|
|
15
|
+
* without the `g` and `y` flags and never written, so that a run leaves
|
|
16
|
+
* `lastIndex` as it is, while the file does not read the legacy properties of
|
|
17
|
+
* `RegExp` (see `readsRegexStatics`). The methods are recognized by name, which
|
|
18
|
+
* is a guess: an arbitrary object may define a method of the same name that
|
|
19
|
+
* changes state. Any other call, such as one of a function of the project,
|
|
20
|
+
* counts as an effect.
|
|
21
|
+
*
|
|
22
|
+
* @param node - Expression to check.
|
|
23
|
+
* @param context - Mutator context of the file.
|
|
24
|
+
* @returns Whether the expression and every part of it only read values.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isReadOnly(node: Node, context: MutatorContext): boolean;
|