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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hash of a path that is neither a file nor a directory, such as a device, a
|
|
3
|
+
* pipe or a socket, whose content cannot be read without waiting for it to end.
|
|
4
|
+
* It differs from every hash and from the null of a missing file, and a verdict
|
|
5
|
+
* that depends on such a path is neither reused nor stored.
|
|
6
|
+
*/
|
|
7
|
+
export declare const UNKNOWN_HASH = "unknown";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variables that change from one shell or terminal to another
|
|
3
|
+
* without changing what tests do, and mootant's switch of spare test processes
|
|
4
|
+
* (`readPreforkSwitch`), which tests never see; left out of the hash of all
|
|
5
|
+
* variables, which stands for code that lists them.
|
|
6
|
+
*/
|
|
7
|
+
export declare const VOLATILE_VARIABLES: ReadonlySet<string>;
|
|
@@ -9,7 +9,7 @@ async function s(s, c, l) {
|
|
|
9
9
|
let d = e(u.entries, l), f = new Set([...d.values()].map((e) => e.inputs)), p = {
|
|
10
10
|
inputs: Object.fromEntries([...u.inputs].filter(([e]) => f.has(e))),
|
|
11
11
|
entries: Object.fromEntries(d),
|
|
12
|
-
version:
|
|
12
|
+
version: 8
|
|
13
13
|
}, m = `${s}.${process.pid}.tmp`;
|
|
14
14
|
try {
|
|
15
15
|
await r(n.dirname(s), { recursive: !0 }), await o(m, JSON.stringify(p)), await i(m, s);
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Loads a TypeScript configuration file and returns its default export: the
|
|
3
3
|
* `export default` of an ES module, or the `module.exports` of a CommonJS
|
|
4
4
|
* module. Node.js imports it directly when it can strip types (22.18 and
|
|
5
|
-
* later); older versions need the optional `jiti` package
|
|
5
|
+
* later); older versions need the optional `jiti` package, where version 1,
|
|
6
|
+
* without `createJiti`, counts as missing. A `.ts` file of a package whose
|
|
7
|
+
* `type` is not `module` loads with `jiti` too when it is installed: Node.js
|
|
8
|
+
* reads it as CommonJS, where `import` and `export` fail or, without a `type`
|
|
9
|
+
* field, draw a warning. A link counts as the file it points to, as in
|
|
10
|
+
* Node.js.
|
|
6
11
|
*
|
|
7
12
|
* @param file - Absolute path of the configuration file.
|
|
8
13
|
* @returns The default export of the file, or undefined when it has none.
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { listPackageFiles as e } from "../files/list-package-files.js";
|
|
2
|
+
import { readPackageType as t } from "../files/read-package-type.js";
|
|
3
|
+
import { importConfig as n } from "./import-config.js";
|
|
4
|
+
import { realpathSync as r } from "node:fs";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
async function a(a) {
|
|
7
|
+
let s = !!process.features.typescript;
|
|
8
|
+
if (s && !a.endsWith(".ts")) return n(a);
|
|
9
|
+
let c = r(a), l = s ? t(e(i.dirname(c), /* @__PURE__ */ new Map()).at(-1), /* @__PURE__ */ new Map()) : null;
|
|
10
|
+
if (l === "module") return n(a);
|
|
11
|
+
let u = {};
|
|
5
12
|
try {
|
|
6
|
-
|
|
7
|
-
} catch {
|
|
8
|
-
|
|
13
|
+
u = await import("jiti");
|
|
14
|
+
} catch {}
|
|
15
|
+
if (u.createJiti) {
|
|
16
|
+
let e = await u.createJiti(import.meta.url, { interopDefault: !1 }).import(c);
|
|
17
|
+
return e.__esModule === !0 ? e.default : e;
|
|
9
18
|
}
|
|
10
|
-
|
|
11
|
-
return
|
|
19
|
+
if (!s) throw Error("TypeScript configuration files need Node.js 22.18 or later, or the jiti package.");
|
|
20
|
+
return l === "commonjs" ? o(a) : n(a);
|
|
12
21
|
}
|
|
13
|
-
|
|
22
|
+
async function o(e) {
|
|
23
|
+
try {
|
|
24
|
+
return await n(e);
|
|
25
|
+
} catch (t) {
|
|
26
|
+
throw t instanceof SyntaxError && !("code" in t) ? Error(`${t.message}. Node.js reads the file as CommonJS because its package.json has "type": "commonjs"; to use import and export, install jiti or rename it to ${i.basename(e, ".ts")}.mts.`, { cause: t }) : t;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export { a as loadTypescriptConfig };
|
|
@@ -2,7 +2,7 @@ import { PresetSettings } from '../../types/config/preset-settings.js';
|
|
|
2
2
|
import { ActiveMutator } from '../../types/mutator/active-mutator.js';
|
|
3
3
|
import { RunConfig } from '../../types/config/run-config.js';
|
|
4
4
|
/**
|
|
5
|
-
* Mutators, settings, root and run settings of a run.
|
|
5
|
+
* Mutators, settings, root, configuration file and run settings of a run.
|
|
6
6
|
*/
|
|
7
7
|
interface RunSetup {
|
|
8
8
|
/**
|
|
@@ -17,6 +17,10 @@ interface RunSetup {
|
|
|
17
17
|
* Mutators turned on, in rank order.
|
|
18
18
|
*/
|
|
19
19
|
mutators: ActiveMutator[];
|
|
20
|
+
/**
|
|
21
|
+
* Absolute path of the configuration file, or null without one.
|
|
22
|
+
*/
|
|
23
|
+
file: string | null;
|
|
20
24
|
/**
|
|
21
25
|
* Presets the run extends, joined for reports.
|
|
22
26
|
*/
|
|
@@ -58,8 +62,8 @@ interface RunOptions {
|
|
|
58
62
|
* win.
|
|
59
63
|
*
|
|
60
64
|
* @param options - Configuration path, preset and working directory.
|
|
61
|
-
* @returns Active mutators, settings, known ids, presets, root
|
|
62
|
-
* of the run.
|
|
65
|
+
* @returns Active mutators, settings, known ids, presets, root, configuration
|
|
66
|
+
* file and run settings of the run.
|
|
63
67
|
* @throws Error - When the configuration or a plugin cannot be loaded or is
|
|
64
68
|
* invalid, or a preset or mutator id is unknown.
|
|
65
69
|
*/
|
|
@@ -5,11 +5,12 @@ import { RunConfig } from '../../types/config/run-config.js';
|
|
|
5
5
|
* configuration, which wins over the default. The defaults are those
|
|
6
6
|
* `RunConfig` documents: the runner's own concurrency, no threshold, a timeout
|
|
7
7
|
* factor of 3 with a constant of 250, a hit limit factor of 100 with a floor of
|
|
8
|
-
* 100000, the cache on, and incremental
|
|
8
|
+
* 100000, the cache on, and incremental mode, fast mode and parallel units
|
|
9
|
+
* off.
|
|
9
10
|
*
|
|
10
11
|
* @param options - Settings given on the command line, undefined when not
|
|
11
12
|
* given.
|
|
12
13
|
* @param run - Run settings of the configuration, or an empty object.
|
|
13
14
|
* @returns Settings of the run with the defaults filled in.
|
|
14
15
|
*/
|
|
15
|
-
export declare function resolveRunSettings(options: Pick<RunConfig, 'concurrency' | 'incremental' | 'threshold' | 'cache' | 'fast'>, run: RunConfig): RunSettings;
|
|
16
|
+
export declare function resolveRunSettings(options: Pick<RunConfig, 'parallelUnits' | 'concurrency' | 'incremental' | 'threshold' | 'cache' | 'fast'>, run: RunConfig): RunSettings;
|
|
@@ -10,6 +10,7 @@ function e(e, t) {
|
|
|
10
10
|
factor: t.timeout?.factor ?? 3
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
+
parallelUnits: e.parallelUnits ?? t.parallelUnits ?? !1,
|
|
13
14
|
incremental: e.incremental ?? t.incremental ?? !1,
|
|
14
15
|
concurrency: e.concurrency ?? t.concurrency ?? null,
|
|
15
16
|
threshold: e.threshold ?? t.threshold ?? null,
|
|
@@ -15,6 +15,7 @@ let i = [
|
|
|
15
15
|
"hitLimit",
|
|
16
16
|
"html",
|
|
17
17
|
"incremental",
|
|
18
|
+
"parallelUnits",
|
|
18
19
|
"paths",
|
|
19
20
|
"runner",
|
|
20
21
|
"threshold",
|
|
@@ -31,8 +32,8 @@ function s(e) {
|
|
|
31
32
|
let e = n(t, a);
|
|
32
33
|
return `"${t}" is not a run setting${e === null ? "" : ` (did you mean "${e}"?)`}`;
|
|
33
34
|
}
|
|
34
|
-
let {
|
|
35
|
-
return
|
|
35
|
+
let { parallelUnits: t, incremental: i, concurrency: o, threshold: s, runner: c, paths: u, cache: d, fast: f, html: p } = e;
|
|
36
|
+
return s !== void 0 && (typeof s != "number" || !(s >= 0) || !(s <= 100)) ? "\"threshold\" must be a number from 0 to 100" : o !== void 0 && (!Number.isSafeInteger(o) || o < 1) ? "\"concurrency\" must be a positive integer" : f !== void 0 && typeof f != "boolean" ? "\"fast\" must be true or false" : d !== void 0 && typeof d != "boolean" ? "\"cache\" must be true or false" : i !== void 0 && typeof i != "boolean" ? "\"incremental\" must be true or false" : t !== void 0 && typeof t != "boolean" ? "\"parallelUnits\" must be true or false" : p !== void 0 && typeof p != "boolean" && (typeof p != "string" || p === "") ? "\"html\" must be true, false or a path" : c !== void 0 && !r(c) && (typeof c != "string" || c === "") ? "\"runner\" must be a built-in adapter name or an adapter object" : u !== void 0 && (!Array.isArray(u) || u.some((e) => typeof e != "string" || e === "")) ? "\"paths\" must be a list of non-empty paths" : l(e, "timeout", ["constant", "factor"]) ?? l(e, "hitLimit", ["factor", "floor"]);
|
|
36
37
|
}
|
|
37
38
|
function c(a) {
|
|
38
39
|
if (a === void 0) return "it must have a default export";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gives the `package.json` of the installed package a file lies in: the one in
|
|
3
|
+
* the directory under the last `node_modules` of its path, `@scope/name`
|
|
4
|
+
* included, whose `main` and `exports` decide what an import of the package
|
|
5
|
+
* resolves to, also when a `package.json` closer to the file only decides its
|
|
6
|
+
* format.
|
|
7
|
+
*
|
|
8
|
+
* @param file - Absolute path.
|
|
9
|
+
* @returns Absolute path of the manifest, or null for a file that lies in no
|
|
10
|
+
* package under `node_modules`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPackageManifest(file: string): string | null;
|
|
@@ -3,13 +3,18 @@ import { ChangedLines } from '../../types/git/changed-lines.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Keeps the mutants on changed lines, for `--since`: only the files that
|
|
5
5
|
* changed, with their diagnostics, and in them the mutants and skipped
|
|
6
|
-
* candidates whose lines, from the first to the last, include a changed one.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* candidates whose lines, from the first to the last, include a changed one. A
|
|
7
|
+
* skipped candidate kept this way also keeps the mutants it is left to, on
|
|
8
|
+
* whatever line (see `findJustifiers`), so that a change skipped in favor of a
|
|
9
|
+
* mutant on an unchanged line is still tested, as a run of every mutant tests
|
|
10
|
+
* it. Every mutant of a file git does not track is kept. Lines are counted as
|
|
11
|
+
* git counts them, by line feeds only, so a lone carriage return or a line
|
|
9
12
|
* separator in a string does not shift them.
|
|
10
13
|
*
|
|
11
|
-
* @param files - Listed files.
|
|
14
|
+
* @param files - Listed files with their skipped candidates.
|
|
12
15
|
* @param changed - Changed lines by real absolute path.
|
|
13
|
-
* @
|
|
16
|
+
* @param skipped - Whether the skipped candidates are listed; when not, they
|
|
17
|
+
* only select the mutants they are left to and are dropped.
|
|
18
|
+
* @returns The changed files with the mutants and skipped candidates kept.
|
|
14
19
|
*/
|
|
15
|
-
export declare function selectChangedMutants(files: FileMutants[], changed: ChangedLines['files']): FileMutants[];
|
|
20
|
+
export declare function selectChangedMutants(files: FileMutants[], changed: ChangedLines['files'], skipped: boolean): FileMutants[];
|
|
@@ -1,22 +1,47 @@
|
|
|
1
1
|
import { getSourcePosition as e } from "../text/get-source-position.js";
|
|
2
|
-
|
|
2
|
+
import { getMutantSite as t } from "../generate/get-mutant-site.js";
|
|
3
|
+
function n(t, n, i) {
|
|
3
4
|
return t.flatMap((t) => {
|
|
4
|
-
let
|
|
5
|
-
if (
|
|
6
|
-
let { source:
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
let a = n.get(t.absolute);
|
|
6
|
+
if (a === void 0) return [];
|
|
7
|
+
let { source: o } = t;
|
|
8
|
+
if (a === "all" || o === null) return [i ? t : {
|
|
9
|
+
...t,
|
|
10
|
+
skipped: []
|
|
11
|
+
}];
|
|
12
|
+
let s = a, c = [0];
|
|
13
|
+
for (let e = o.indexOf("\n"); e !== -1; e = o.indexOf("\n", e + 1)) c.push(e + 1);
|
|
14
|
+
function l(t) {
|
|
15
|
+
let n = e(c, t.start).line, r = e(c, t.end).line;
|
|
16
|
+
for (let e = n; e <= r; e++) if (s.has(e)) return !0;
|
|
13
17
|
return !1;
|
|
14
18
|
}
|
|
19
|
+
let u = t.skipped.filter(l), d = r(t, u);
|
|
15
20
|
return [{
|
|
16
21
|
...t,
|
|
17
|
-
mutants: t.mutants.filter(
|
|
18
|
-
skipped:
|
|
22
|
+
mutants: t.mutants.filter((e) => l(e) || d.has(e)),
|
|
23
|
+
skipped: i ? u : []
|
|
19
24
|
}];
|
|
20
25
|
});
|
|
21
26
|
}
|
|
22
|
-
|
|
27
|
+
function r(e, n) {
|
|
28
|
+
let r = new Map(e.mutants.map((e) => [e.id, e])), a = /* @__PURE__ */ new Map();
|
|
29
|
+
for (let n of [...e.mutants, ...e.skipped]) {
|
|
30
|
+
let e = i(n.mutator, t(n));
|
|
31
|
+
a.set(e, [...a.get(e) ?? [], n]);
|
|
32
|
+
}
|
|
33
|
+
let o = /* @__PURE__ */ new Set(), s = new Set(n), c = [...n];
|
|
34
|
+
for (; c.length > 0;) {
|
|
35
|
+
let { by: e } = c.pop();
|
|
36
|
+
if (e !== null && e.id !== null) o.add(r.get(e.id));
|
|
37
|
+
else if (e !== null) {
|
|
38
|
+
let t = a.get(i(e.mutator, e.start));
|
|
39
|
+
if (t) for (let e of t) "id" in e ? o.add(e) : s.has(e) || (s.add(e), c.push(e));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return o;
|
|
43
|
+
}
|
|
44
|
+
function i(e, t) {
|
|
45
|
+
return `${t} ${e}`;
|
|
46
|
+
}
|
|
47
|
+
export { n as selectChangedMutants };
|
|
@@ -16,11 +16,14 @@ interface SolitaryOutcome {
|
|
|
16
16
|
/**
|
|
17
17
|
* Drops coarse candidates, such as a removed statement, when a finer candidate
|
|
18
18
|
* lies inside one of their solitary ranges: a test that kills the finer mutant
|
|
19
|
-
*
|
|
20
|
-
* unless its mutator opts out with `countsForSolitary: false`, it is a
|
|
21
|
-
* of the same mutator on the same range, it
|
|
22
|
-
*
|
|
23
|
-
*
|
|
19
|
+
* is likely to observe the effect the coarse mutant erases. A finer candidate
|
|
20
|
+
* counts unless its mutator opts out with `countsForSolitary: false`, it is a
|
|
21
|
+
* variant of the same mutator on the same range, it is the empty string that
|
|
22
|
+
* string-literal writes over a whole element that array-element removes (see
|
|
23
|
+
* `isEmptiedElement`), it was dropped itself, or it is ignored while the coarse
|
|
24
|
+
* candidate will run. Candidates are placed, ordered and told apart by their
|
|
25
|
+
* targets (see `getTarget`), so the removal of an element lies where its whole
|
|
26
|
+
* literal does. Coarse candidates are decided innermost first.
|
|
24
27
|
*
|
|
25
28
|
* @param candidates - Candidates of one file in canonical order.
|
|
26
29
|
* @returns The candidates that are kept, in canonical order, and the dropped
|
|
@@ -1,48 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { compareTargets as e } from "./compare-targets.js";
|
|
2
|
+
import { getTarget as t } from "./get-target.js";
|
|
3
|
+
const n = /^(?:''|""|``)$/u;
|
|
4
|
+
function r(t) {
|
|
5
|
+
let n = /* @__PURE__ */ new Map(), r = t.toSorted(e), a = r.filter((e) => e.solitary !== null).toSorted(c);
|
|
6
|
+
for (let e of a) for (let t of e.solitary) {
|
|
7
|
+
let a = i({
|
|
8
|
+
candidates: r,
|
|
9
|
+
candidate: e,
|
|
10
|
+
dropped: n,
|
|
11
|
+
range: t
|
|
10
12
|
});
|
|
11
13
|
if (a !== null) {
|
|
12
|
-
|
|
14
|
+
n.set(e, a);
|
|
13
15
|
break;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
return {
|
|
17
|
-
kept:
|
|
18
|
-
dropped:
|
|
19
|
+
kept: t.filter((e) => !n.has(e)),
|
|
20
|
+
dropped: n
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
let { candidates:
|
|
23
|
-
for (let e =
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
23
|
+
function i(e) {
|
|
24
|
+
let { candidates: n, candidate: r, dropped: i, range: c } = e;
|
|
25
|
+
for (let e = o(n, c.start); e < n.length && t(n[e]).start < c.end; e++) {
|
|
26
|
+
let o = n[e];
|
|
27
|
+
if (o !== r && t(o).end <= c.end && !i.has(o) && !s(o, r, c) && a(o, r)) return o;
|
|
26
28
|
}
|
|
27
29
|
return null;
|
|
28
30
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
+
function a(e, n) {
|
|
32
|
+
if (e.registered.mutator.meta.countsForSolitary === !1) return !1;
|
|
33
|
+
let r = t(e), i = t(n);
|
|
34
|
+
return e.registered === n.registered && r.start === i.start && r.end === i.end ? !1 : n.ignoreRule !== null || e.ignoreRule === null;
|
|
31
35
|
}
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
for (;
|
|
35
|
-
let
|
|
36
|
-
e[
|
|
36
|
+
function o(e, n) {
|
|
37
|
+
let r = 0, i = e.length;
|
|
38
|
+
for (; r < i;) {
|
|
39
|
+
let a = Math.floor((r + i) / 2);
|
|
40
|
+
t(e[a]).start < n ? r = a + 1 : i = a;
|
|
37
41
|
}
|
|
38
|
-
return
|
|
42
|
+
return r;
|
|
39
43
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
44
|
+
function s(e, t, r) {
|
|
45
|
+
return t.registered.id === "array-element" && e.registered.id === "string-literal" && n.test(e.text) && e.start === r.start && e.end === r.end;
|
|
42
46
|
}
|
|
43
|
-
function
|
|
47
|
+
function c(t, n) {
|
|
48
|
+
return l(t) - l(n) || t.solitary[0].start - n.solitary[0].start || e(t, n);
|
|
49
|
+
}
|
|
50
|
+
function l(e) {
|
|
44
51
|
let t = 0;
|
|
45
52
|
for (let n of e.solitary) t += n.end - n.start;
|
|
46
53
|
return t;
|
|
47
54
|
}
|
|
48
|
-
export {
|
|
55
|
+
export { r as applySolitaryRule };
|
|
@@ -105,10 +105,11 @@ interface CandidateCollection {
|
|
|
105
105
|
* creates its visitors once, in rank order; then every dispatched node is
|
|
106
106
|
* passed, in pre-order, to the visitors registered for its type. Each returned
|
|
107
107
|
* replacement is validated and becomes a candidate with its kind, scope path,
|
|
108
|
-
* solitary ranges and ignore rule
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
108
|
+
* solitary ranges and ignore rule, which ignore directives decide where it is
|
|
109
|
+
* placed (see `getMutantSite`). A throwing `create` or visitor and an invalid
|
|
110
|
+
* replacement become mutator errors and cost only that mutator, visit or
|
|
111
|
+
* replacement. A replacement that would move code its framework compiler reads
|
|
112
|
+
* where it stands, such as a Svelte rune call or a Vue compiler macro, is
|
|
112
113
|
* dropped. A replacement that only changes a literal in the delay of a known
|
|
113
114
|
* timer call, such as `1000` turned into `1001`, is skipped as noise, even when
|
|
114
115
|
* its visitor skipped it for another rule; a replacement there that touches a
|
|
@@ -118,13 +119,30 @@ interface CandidateCollection {
|
|
|
118
119
|
* only it knows which link it removes. A replacement that a visitor marks as
|
|
119
120
|
* skipped is never validated and never becomes a candidate; on request it is
|
|
120
121
|
* collected with its rule, like dropped and invalid replacements, so that
|
|
121
|
-
* skipped replacements never change the candidates.
|
|
122
|
+
* skipped replacements never change the candidates. Its rule is checked in
|
|
123
|
+
* every run: it is one of the skip rules of the mutator's plugin, else a
|
|
124
|
+
* built-in rule (see `findSkipRule`); a skip with any other rule is a mutator
|
|
125
|
+
* error, and its replacement is dropped. Rules of the collection itself, such
|
|
126
|
+
* as a timer delay, are built-in rules whatever the mutator. In a template only
|
|
122
127
|
* expressions are replaced: a replacement of a statement, a declaration or a
|
|
123
128
|
* node of the synthetic module around the template code is dropped without a
|
|
124
129
|
* trace, and every candidate has the scope `<template>`. A replacement in a Vue
|
|
125
130
|
* template is fitted into the attribute value or the interpolation around it,
|
|
126
131
|
* or skipped when it cannot be.
|
|
127
132
|
*
|
|
133
|
+
* A replacement with an empty text for an element of an array literal or a
|
|
134
|
+
* member of an object literal removes that element (see `findListRemoval`). Its
|
|
135
|
+
* candidate replaces only the element with the comma next to it (see
|
|
136
|
+
* `getListRemovalRange`), with the element as its focus, and is hosted with the
|
|
137
|
+
* other removals of its literal. A removal that is not narrowed replaces the
|
|
138
|
+
* whole literal instead, which takes a copy of the literal per removal; when a
|
|
139
|
+
* literal has more than eight such removals, none of them becomes a candidate,
|
|
140
|
+
* and each is skipped in the narrowed shape, without a copy. Every check that
|
|
141
|
+
* looks at the replaced node, such as the template filter, compiler pins and
|
|
142
|
+
* loop advances, looks at the literal of a removal, as it does for the whole
|
|
143
|
+
* literal. In a Vue template, a removal that would join the text around it into
|
|
144
|
+
* the delimiter of the template code is skipped.
|
|
145
|
+
*
|
|
128
146
|
* @param input - Mutators, parsed file, runtime tree, ignore rules and shared
|
|
129
147
|
* context services.
|
|
130
148
|
* @returns Candidates in emission order, mutator errors and skipped
|