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,53 @@
|
|
|
1
|
+
import { unwrapExpression as e } from "../../tree/unwrap-expression.js";
|
|
2
|
+
import { walkTree as t } from "../../tree/walk-tree.js";
|
|
3
|
+
let n = /* @__PURE__ */ new Set([
|
|
4
|
+
"TaggedTemplateExpression",
|
|
5
|
+
"AssignmentExpression",
|
|
6
|
+
"FunctionExpression",
|
|
7
|
+
"ImportExpression",
|
|
8
|
+
"UpdateExpression",
|
|
9
|
+
"AwaitExpression",
|
|
10
|
+
"YieldExpression",
|
|
11
|
+
"ClassExpression",
|
|
12
|
+
"NewExpression",
|
|
13
|
+
"SpreadElement"
|
|
14
|
+
]), r = /* @__PURE__ */ new Set(/* @__PURE__ */ "toLocaleLowerCase.toLocaleUpperCase.hasOwnProperty.localeCompare.isSafeInteger.codePointAt.lastIndexOf.toLowerCase.toUpperCase.charCodeAt.startsWith.isInteger.normalize.substring.trimStart.endsWith.includes.isFinite.padStart.getTime.indexOf.isArray.trimEnd.entries.charAt.concat.hasOwn.padEnd.repeat.values.isNaN.slice.join.keys.trim.has.at".split(".")), i = /* @__PURE__ */ new Set([
|
|
15
|
+
"findLastIndex",
|
|
16
|
+
"findIndex",
|
|
17
|
+
"findLast",
|
|
18
|
+
"filter",
|
|
19
|
+
"every",
|
|
20
|
+
"find",
|
|
21
|
+
"some",
|
|
22
|
+
"map"
|
|
23
|
+
]), a = /* @__PURE__ */ new Set(["exec", "test"]);
|
|
24
|
+
function o(e, n) {
|
|
25
|
+
let r = /* @__PURE__ */ new Set(), i = !0;
|
|
26
|
+
return t(e, (e) => (i && !l(e, r, n) && (i = !1), i)), i;
|
|
27
|
+
}
|
|
28
|
+
function s(t, n) {
|
|
29
|
+
let { sourceCode: r, syntax: i } = n;
|
|
30
|
+
if (i.readsRegexStatics()) return !1;
|
|
31
|
+
let a = e(t);
|
|
32
|
+
if (a.type === "Literal" && "regex" in a) return !0;
|
|
33
|
+
let o = r.getBinding(a), s = o?.kind !== "var" && o?.writes.length === 0 ? o.declaration : null, c = s?.type === "VariableDeclarator" && s.id.type === "Identifier" && s.init ? e(s.init) : null;
|
|
34
|
+
return c?.type === "Literal" && "regex" in c && !/[gy]/u.test(c.regex.flags);
|
|
35
|
+
}
|
|
36
|
+
function c(t, n, o) {
|
|
37
|
+
let c = e(t.callee);
|
|
38
|
+
if (c.type !== "MemberExpression" || c.computed || c.property.type !== "Identifier") return !1;
|
|
39
|
+
let { name: l } = c.property;
|
|
40
|
+
if (a.has(l)) return s(c.object, o);
|
|
41
|
+
if (!i.has(l)) return r.has(l);
|
|
42
|
+
let [u] = t.arguments, d = u ? e(u) : null;
|
|
43
|
+
return d?.type !== "ArrowFunctionExpression" || !d.expression || d.async ? !1 : (n.add(d), !0);
|
|
44
|
+
}
|
|
45
|
+
function l(e, t, r) {
|
|
46
|
+
switch (e.type) {
|
|
47
|
+
case "ArrowFunctionExpression": return t.has(e);
|
|
48
|
+
case "UnaryExpression": return e.operator !== "delete";
|
|
49
|
+
case "CallExpression": return c(e, t, r);
|
|
50
|
+
default: return !n.has(e.type);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export { o as isReadOnly };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
2
2
|
/**
|
|
3
3
|
* Skip of the leave-now constant of a first exit test, which is the loop's
|
|
4
4
|
* never-run mutant (catalog O13).
|
|
5
5
|
*/
|
|
6
|
-
export declare const LEAVE_NOW_SKIP:
|
|
6
|
+
export declare const LEAVE_NOW_SKIP: CoreNote;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreNote } from '../../../types/mutant/core-note.js';
|
|
2
2
|
/**
|
|
3
3
|
* Skip of a mutant that makes a callback a no-op, which is method-call's
|
|
4
4
|
* removal of the call (catalog O12).
|
|
5
5
|
*/
|
|
6
|
-
export declare const NO_OP_CALLBACK_SKIP:
|
|
6
|
+
export declare const NO_OP_CALLBACK_SKIP: CoreNote;
|
|
@@ -15,9 +15,10 @@ interface StatementRemovalOptions {
|
|
|
15
15
|
* labeled `break` and `yield` statements are removed too. The removal is
|
|
16
16
|
* solitary (2.6), except for a plain assignment; it is skipped for the body of
|
|
17
17
|
* a label, for the whole then-branch of an `if` whose test its owner forces to
|
|
18
|
-
* `false` (O19) or a mutant moves toward `false`
|
|
19
|
-
*
|
|
20
|
-
* for a
|
|
18
|
+
* `false` while the test has no effect (O19), or a mutant moves toward `false`
|
|
19
|
+
* while keeping every effect of the test (R4), for a statement that advances a
|
|
20
|
+
* loop while timeouts are off, and for a statement that only waits for a
|
|
21
|
+
* promise timer. Skipped mutants follow as skipped replacements.
|
|
21
22
|
*/
|
|
22
23
|
export declare let statementRemoval: Mutator<StatementRemovalOptions>;
|
|
23
24
|
export {};
|
|
@@ -1,64 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getForcedTestJustifier as e } from "./shared/get-forced-test-justifier.js";
|
|
2
|
+
import { isPlainReturnValue as t } from "./shared/is-plain-return-value.js";
|
|
3
3
|
import { createRunContext as n } from "./shared/create-run-context.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
let s = /* @__PURE__ */ new Set([
|
|
4
|
+
import { isTailPosition as r } from "./shared/is-tail-position.js";
|
|
5
|
+
import { isEffectFree as i } from "../syntax/is-effect-free.js";
|
|
6
|
+
import { isTimerWait as a } from "./shared/is-timer-wait.js";
|
|
7
|
+
let o = /* @__PURE__ */ new Set([
|
|
9
8
|
"AssignmentExpression",
|
|
10
9
|
"UpdateExpression",
|
|
11
10
|
"AwaitExpression",
|
|
12
11
|
"NewExpression"
|
|
13
|
-
]),
|
|
12
|
+
]), s = /* @__PURE__ */ new Set([
|
|
14
13
|
"DoWhileStatement",
|
|
15
14
|
"ForInStatement",
|
|
16
15
|
"ForOfStatement",
|
|
17
16
|
"WhileStatement",
|
|
18
17
|
"ForStatement"
|
|
19
|
-
]),
|
|
20
|
-
create(
|
|
21
|
-
let { jumps: n } =
|
|
18
|
+
]), c = {
|
|
19
|
+
create(e) {
|
|
20
|
+
let { jumps: n } = e.options;
|
|
22
21
|
return {
|
|
23
|
-
BreakStatement(
|
|
24
|
-
let i =
|
|
25
|
-
return i ?
|
|
26
|
-
context:
|
|
27
|
-
skip:
|
|
22
|
+
BreakStatement(t, r) {
|
|
23
|
+
let i = t.label ? null : f(t, e);
|
|
24
|
+
return i ? v(t, r, {
|
|
25
|
+
context: e,
|
|
26
|
+
skip: m(i, e) ? {
|
|
28
27
|
reason: "falling through the case reaches only a break",
|
|
29
28
|
rule: "fall-through-break"
|
|
30
29
|
} : null
|
|
31
|
-
}) : n ?
|
|
30
|
+
}) : n ? v(t, r, {
|
|
32
31
|
skip: null,
|
|
33
|
-
context:
|
|
32
|
+
context: e
|
|
34
33
|
}) : [];
|
|
35
34
|
},
|
|
36
|
-
ReturnStatement(n,
|
|
37
|
-
let a = n.argument ?
|
|
38
|
-
return a && !
|
|
39
|
-
context:
|
|
40
|
-
skip:
|
|
35
|
+
ReturnStatement(n, i) {
|
|
36
|
+
let a = n.argument ? e.syntax.unwrapExpression(n.argument) : null;
|
|
37
|
+
return a && !t(a, e) ? [] : v(n, i, {
|
|
38
|
+
context: e,
|
|
39
|
+
skip: r(n, e) ? g(a, e) : null
|
|
41
40
|
});
|
|
42
41
|
},
|
|
43
|
-
ContinueStatement(
|
|
44
|
-
return n ?
|
|
45
|
-
context:
|
|
46
|
-
skip:
|
|
42
|
+
ContinueStatement(t, r) {
|
|
43
|
+
return n ? v(t, r, {
|
|
44
|
+
context: e,
|
|
45
|
+
skip: h(t, e) ? {
|
|
47
46
|
reason: "the continue ends the body of its loop",
|
|
48
47
|
rule: "loop-end"
|
|
49
48
|
} : null
|
|
50
49
|
}) : [];
|
|
51
50
|
},
|
|
52
|
-
ExpressionStatement(
|
|
53
|
-
return
|
|
54
|
-
skip:
|
|
55
|
-
context:
|
|
51
|
+
ExpressionStatement(t, n) {
|
|
52
|
+
return u(t, e) ? v(t, n, {
|
|
53
|
+
skip: p(t, e),
|
|
54
|
+
context: e
|
|
56
55
|
}) : [];
|
|
57
56
|
},
|
|
58
|
-
ThrowStatement(
|
|
59
|
-
return
|
|
57
|
+
ThrowStatement(t, n) {
|
|
58
|
+
return v(t, n, {
|
|
60
59
|
skip: null,
|
|
61
|
-
context:
|
|
60
|
+
context: e
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
};
|
|
@@ -68,30 +67,27 @@ let s = /* @__PURE__ */ new Set([
|
|
|
68
67
|
defaultOptions: { jumps: !1 }
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
|
-
function
|
|
72
|
-
let { sourceCode:
|
|
73
|
-
if (
|
|
74
|
-
let
|
|
75
|
-
|
|
76
|
-
reason: `removing the whole then-branch forces the test to false, as ${l.mutator} does`,
|
|
77
|
-
rule: "O19",
|
|
78
|
-
by: l
|
|
79
|
-
};
|
|
80
|
-
let u = r({
|
|
70
|
+
function l(t, r) {
|
|
71
|
+
let { sourceCode: i, syntax: a } = r, { parent: o } = i.getSlot(t);
|
|
72
|
+
if (o?.type === "BlockStatement" && o.body.length === 1 && ({parent: o} = i.getSlot(o)), o?.type !== "IfStatement" || o.alternate) return null;
|
|
73
|
+
let s = e({
|
|
74
|
+
decision: a.unwrapParentheses(o.test),
|
|
81
75
|
candidate: {
|
|
82
|
-
mutator:
|
|
83
|
-
node:
|
|
76
|
+
mutator: r.id,
|
|
77
|
+
node: t
|
|
84
78
|
},
|
|
85
|
-
decision: c,
|
|
86
79
|
value: !1
|
|
87
|
-
}, n(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
}, n(r), !0);
|
|
81
|
+
if (!s) return null;
|
|
82
|
+
let { heuristic: c, owned: l, by: u } = s;
|
|
83
|
+
return {
|
|
84
|
+
reason: l ? `removing the whole then-branch forces the test to false, as ${u.mutator} does` : `removing the whole then-branch forces the test to false, as ${u.mutator} does on some inputs`,
|
|
85
|
+
...c && { heuristic: c },
|
|
86
|
+
rule: l ? "O19" : "R4",
|
|
87
|
+
by: u
|
|
88
|
+
};
|
|
93
89
|
}
|
|
94
|
-
function
|
|
90
|
+
function u(e, t) {
|
|
95
91
|
let { syntax: n } = t, r = n.unwrapExpression(e.expression);
|
|
96
92
|
switch (r.type) {
|
|
97
93
|
case "ChainExpression":
|
|
@@ -99,21 +95,21 @@ function d(e, t) {
|
|
|
99
95
|
let e = r.type === "ChainExpression" ? r.expression : r;
|
|
100
96
|
return e.type === "CallExpression" && e.callee.type !== "Super";
|
|
101
97
|
}
|
|
102
|
-
case "UnaryExpression": return r.operator === "delete" || r.operator === "void" &&
|
|
98
|
+
case "UnaryExpression": return r.operator === "delete" || r.operator === "void" && b(n.unwrapExpression(r.argument));
|
|
103
99
|
case "YieldExpression": return t.options.jumps;
|
|
104
|
-
default: return
|
|
100
|
+
default: return o.has(r.type);
|
|
105
101
|
}
|
|
106
102
|
}
|
|
107
|
-
function
|
|
103
|
+
function d(e, t, n) {
|
|
108
104
|
return t?.type === "LabeledStatement" ? {
|
|
109
105
|
reason: "Mootant cannot switch a mutant on in the body of a label",
|
|
110
106
|
rule: "invalid-target"
|
|
111
|
-
} :
|
|
107
|
+
} : l(e, n) || (!n.settings.timeouts && n.syntax.advancesLoop(e) ? {
|
|
112
108
|
reason: "it removes the statement that advances a loop, so it may keep the loop running forever",
|
|
113
109
|
rule: "loop-advance"
|
|
114
110
|
} : null);
|
|
115
111
|
}
|
|
116
|
-
function
|
|
112
|
+
function f(e, t) {
|
|
117
113
|
let { sourceCode: n } = t, r = e, { parent: i } = n.getSlot(e);
|
|
118
114
|
if (i?.type === "BlockStatement" && i.body.at(-1) === e) {
|
|
119
115
|
let { parent: e } = n.getSlot(i);
|
|
@@ -121,35 +117,35 @@ function p(e, t) {
|
|
|
121
117
|
}
|
|
122
118
|
return i?.type === "SwitchCase" && i.consequent.at(-1) === r ? i : null;
|
|
123
119
|
}
|
|
124
|
-
function
|
|
120
|
+
function p(e, t) {
|
|
125
121
|
let { syntax: n } = t, r = n.unwrapExpression(e.expression);
|
|
126
|
-
return r.type !== "AwaitExpression" || !
|
|
122
|
+
return r.type !== "AwaitExpression" || !a(r, t) ? null : n.unwrapExpression(r.argument).arguments.every(i) ? {
|
|
127
123
|
reason: "the statement only waits for a timer delay",
|
|
128
124
|
rule: "timer-delay"
|
|
129
125
|
} : null;
|
|
130
126
|
}
|
|
131
|
-
function
|
|
127
|
+
function m(e, t) {
|
|
132
128
|
let { cases: n } = t.sourceCode.getParent(e), r = n.slice(n.indexOf(e) + 1).find((e) => e.consequent.length > 0);
|
|
133
129
|
if (!r) return !0;
|
|
134
130
|
let i = r.consequent[0], a = i.type === "BlockStatement" && r.consequent.length === 1 ? i.body[0] : i;
|
|
135
131
|
return a?.type === "BreakStatement" && a.label === null;
|
|
136
132
|
}
|
|
137
|
-
function
|
|
133
|
+
function h(e, t) {
|
|
138
134
|
let { sourceCode: n } = t, { parent: r } = n.getSlot(e);
|
|
139
|
-
if (r?.type === "BlockStatement" && r.body.at(-1) === e && ({parent: r} = n.getSlot(r)), !
|
|
135
|
+
if (r?.type === "BlockStatement" && r.body.at(-1) === e && ({parent: r} = n.getSlot(r)), !s.has(r?.type)) return !1;
|
|
140
136
|
let { parent: i } = n.getSlot(r);
|
|
141
137
|
return !e.label || i?.type === "LabeledStatement" && i.label.name === e.label.name;
|
|
142
138
|
}
|
|
143
|
-
function
|
|
139
|
+
function g(e, t) {
|
|
144
140
|
return e?.type === "Literal" && e.value === !1 ? {
|
|
145
141
|
reason: "removing a tail return false only turns false into undefined",
|
|
146
142
|
rule: "tail-return-false"
|
|
147
|
-
} :
|
|
143
|
+
} : _(e, t) ? {
|
|
148
144
|
reason: "removing a tail return of no value, undefined or null turns at most null into undefined",
|
|
149
145
|
rule: "tail-return"
|
|
150
146
|
} : null;
|
|
151
147
|
}
|
|
152
|
-
function
|
|
148
|
+
function _(e, t) {
|
|
153
149
|
if (!e) return !0;
|
|
154
150
|
if (e.type === "Literal") return e.value === null;
|
|
155
151
|
if (e.type === "UnaryExpression") {
|
|
@@ -158,23 +154,23 @@ function v(e, t) {
|
|
|
158
154
|
}
|
|
159
155
|
return e.type === "Identifier";
|
|
160
156
|
}
|
|
161
|
-
function
|
|
162
|
-
let { context: r } = n, i =
|
|
157
|
+
function v(e, t, n) {
|
|
158
|
+
let { context: r } = n, i = y(e, r) ? {
|
|
163
159
|
text: ";",
|
|
164
160
|
node: e
|
|
165
161
|
} : {
|
|
166
162
|
solitary: [e],
|
|
167
163
|
text: ";",
|
|
168
164
|
node: e
|
|
169
|
-
}, a = n.skip ??
|
|
165
|
+
}, a = n.skip ?? d(e, t, r);
|
|
170
166
|
return a && (i.skip = a), [i];
|
|
171
167
|
}
|
|
172
|
-
function
|
|
168
|
+
function y(e, t) {
|
|
173
169
|
if (e.type !== "ExpressionStatement") return !1;
|
|
174
170
|
let n = t.syntax.unwrapExpression(e.expression);
|
|
175
171
|
return n.type === "AssignmentExpression" && n.operator === "=";
|
|
176
172
|
}
|
|
177
|
-
function
|
|
173
|
+
function b(e) {
|
|
178
174
|
switch (e.type) {
|
|
179
175
|
case "ChainExpression": return e.expression.type === "CallExpression";
|
|
180
176
|
case "AwaitExpression":
|
|
@@ -183,4 +179,4 @@ function x(e) {
|
|
|
183
179
|
default: return !1;
|
|
184
180
|
}
|
|
185
181
|
}
|
|
186
|
-
export {
|
|
182
|
+
export { c as statementRemoval };
|
|
@@ -3,6 +3,14 @@ import { Mutator } from '../../types/mutator/mutator.js';
|
|
|
3
3
|
* Options of the string-literal mutator.
|
|
4
4
|
*/
|
|
5
5
|
interface StringLiteralOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether quoted JSX attribute values are mutated, apart from those of
|
|
8
|
+
* `className`, `class`, `style` and `data-testid`, those of attributes whose
|
|
9
|
+
* meaning braces would change, such as `disabled` and `onclick` (see
|
|
10
|
+
* `isBraceSensitiveAttribute`), and those with a backslash, a control
|
|
11
|
+
* character or a character reference.
|
|
12
|
+
*/
|
|
13
|
+
jsxAttributes: boolean;
|
|
6
14
|
/**
|
|
7
15
|
* Whether strings in `case` labels are mutated.
|
|
8
16
|
*/
|
|
@@ -15,11 +23,13 @@ interface StringLiteralOptions {
|
|
|
15
23
|
* glued together are rarely a value of their own; other expressions are kept,
|
|
16
24
|
* and so are those of a tagged template, which a string cannot replace. Keys,
|
|
17
25
|
* comparison, boolean-mode and `void` operands, `Symbol` descriptions, error
|
|
18
|
-
* messages, lookup keys whose call is only tested, JSX attribute
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
26
|
+
* messages, lookup keys whose call is only tested, quoted JSX attribute values
|
|
27
|
+
* (with the `jsxAttributes` option, only those of `className`, `class`, `style`
|
|
28
|
+
* and `data-testid` and those whose meaning braces would change), the pattern
|
|
29
|
+
* and flags of `RegExp` calls the regex mutators read, bare string statements,
|
|
30
|
+
* tagged templates, templates without static text and (unless the `caseTests`
|
|
31
|
+
* option is set) case labels are skipped, and so are mutants that another
|
|
32
|
+
* mutant owns or subsumes (branch pairs, no-op callbacks, emptied `||`
|
|
23
33
|
* defaults). A skipped change follows as a skipped replacement; a template
|
|
24
34
|
* without static text has nothing to change.
|
|
25
35
|
*/
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { isBraceSensitiveAttribute as e } from "../syntax/is-brace-sensitive-attribute.js";
|
|
2
|
+
import { isPlainAttributeString as t } from "../text/is-plain-attribute-string.js";
|
|
3
|
+
import { readRegexArgument as n } from "../regex/read-regex-argument.js";
|
|
4
|
+
import { createRunContext as r } from "./shared/create-run-context.js";
|
|
5
|
+
import { isLookupPosition as i } from "./shared/is-lookup-position.js";
|
|
6
|
+
import { getLiteralSkip as a } from "./shared/get-literal-skip.js";
|
|
7
|
+
import { readRegexCall as o } from "../regex/read-regex-call.js";
|
|
8
|
+
import { isReadChain as s } from "../syntax/is-read-chain.js";
|
|
9
|
+
const c = "mootant";
|
|
10
|
+
let l = /* @__PURE__ */ new Map([
|
|
11
|
+
["data-testid", "test id"],
|
|
12
|
+
["className", "class"],
|
|
13
|
+
["class", "class"],
|
|
14
|
+
["style", "style"]
|
|
15
|
+
]), u = /* @__PURE__ */ new Set([
|
|
9
16
|
"hasOwnProperty",
|
|
10
17
|
"getAttribute",
|
|
11
18
|
"hasAttribute",
|
|
@@ -18,31 +25,31 @@ let s = /* @__PURE__ */ new Set([
|
|
|
18
25
|
"getItem",
|
|
19
26
|
"has",
|
|
20
27
|
"get"
|
|
21
|
-
]),
|
|
28
|
+
]), d = {
|
|
22
29
|
create(e) {
|
|
23
30
|
let { sourceCode: t } = e;
|
|
24
31
|
return {
|
|
25
32
|
TemplateLiteral(n) {
|
|
26
|
-
let { expressions: r, quasis: i } = n,
|
|
33
|
+
let { expressions: r, quasis: i } = n, a = i.some((e) => e.value.cooked !== "");
|
|
27
34
|
if (r.length === 0) {
|
|
28
|
-
let t =
|
|
29
|
-
return
|
|
35
|
+
let t = a ? "" : c;
|
|
36
|
+
return g(n, {
|
|
30
37
|
text: `\`${t}\``,
|
|
31
38
|
value: t
|
|
32
39
|
}, e);
|
|
33
40
|
}
|
|
34
|
-
return
|
|
41
|
+
return a ? r.every(s) && t.getSlot(n).key !== "quasi" ? g(n, {
|
|
35
42
|
value: null,
|
|
36
43
|
text: "''"
|
|
37
|
-
}, e) :
|
|
44
|
+
}, e) : g(n, {
|
|
38
45
|
text: `\`${r.map((e) => `\${${t.getText(e)}}`).join("")}\``,
|
|
39
46
|
value: null
|
|
40
47
|
}, e) : [];
|
|
41
48
|
},
|
|
42
49
|
Literal(n) {
|
|
43
50
|
if (typeof n.value != "string") return [];
|
|
44
|
-
let r = t.text[n.start], i = n.value === "" ?
|
|
45
|
-
return
|
|
51
|
+
let r = t.text[n.start], i = n.value === "" ? c : "";
|
|
52
|
+
return g(n, {
|
|
46
53
|
text: `${r}${i}${r}`,
|
|
47
54
|
value: i
|
|
48
55
|
}, e);
|
|
@@ -51,12 +58,15 @@ let s = /* @__PURE__ */ new Set([
|
|
|
51
58
|
},
|
|
52
59
|
meta: {
|
|
53
60
|
description: "Empties a string or the static text of a template literal, or fills an empty one.",
|
|
54
|
-
defaultOptions: {
|
|
61
|
+
defaultOptions: {
|
|
62
|
+
jsxAttributes: !1,
|
|
63
|
+
caseTests: !1
|
|
64
|
+
}
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
|
-
function
|
|
58
|
-
let { sourceCode:
|
|
59
|
-
if (
|
|
67
|
+
function f(e, t, n) {
|
|
68
|
+
let { sourceCode: i, options: o, syntax: s } = n, { parent: c, key: l } = s.getContextSlot(e), { value: u, text: d } = t;
|
|
69
|
+
if (i.getSlot(e).key === "quasi") return {
|
|
60
70
|
reason: "the text of a tagged template belongs to its tag",
|
|
61
71
|
rule: "tagged-template"
|
|
62
72
|
};
|
|
@@ -72,56 +82,75 @@ function l(e, n, i) {
|
|
|
72
82
|
reason: "a bare string statement, such as a directive, is not mutated",
|
|
73
83
|
rule: "bare-string"
|
|
74
84
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
if (c?.type === "CallExpression" && p(c.callee, i)) return {
|
|
85
|
+
let f = c?.type === "JSXAttribute" ? p(c, e, n) : null;
|
|
86
|
+
if (f) return f;
|
|
87
|
+
if (c?.type === "CallExpression" && _(c.callee, n)) return {
|
|
80
88
|
reason: "it only changes the description of a symbol",
|
|
81
89
|
rule: "symbol-description"
|
|
82
90
|
};
|
|
83
|
-
let
|
|
84
|
-
if (
|
|
85
|
-
let
|
|
86
|
-
if (
|
|
87
|
-
function
|
|
88
|
-
return
|
|
91
|
+
let g = m(e, n);
|
|
92
|
+
if (g) return g;
|
|
93
|
+
let v = r(n);
|
|
94
|
+
if (u === null) return a(e, { change: { text: d } }, v);
|
|
95
|
+
function y() {
|
|
96
|
+
return u === "" && h(e, n) ? {
|
|
89
97
|
reason: "an empty lookup key only makes a tested lookup constant, as another mutator does",
|
|
90
98
|
rule: "O8"
|
|
91
99
|
} : null;
|
|
92
100
|
}
|
|
93
|
-
return
|
|
94
|
-
change: { value:
|
|
95
|
-
getOwnSkip:
|
|
96
|
-
},
|
|
101
|
+
return a(e, {
|
|
102
|
+
change: { value: u },
|
|
103
|
+
getOwnSkip: y
|
|
104
|
+
}, v);
|
|
105
|
+
}
|
|
106
|
+
function p(n, r, i) {
|
|
107
|
+
if (!i.options.jsxAttributes) return {
|
|
108
|
+
reason: "it only changes the quoted value of a JSX attribute",
|
|
109
|
+
rule: "jsx-attribute"
|
|
110
|
+
};
|
|
111
|
+
let { name: a } = n, o = a.type === "JSXIdentifier" ? l.get(a.name) : void 0;
|
|
112
|
+
if (o !== void 0) return {
|
|
113
|
+
reason: `it only changes the ${o} of an element`,
|
|
114
|
+
rule: "jsx-attribute",
|
|
115
|
+
heuristic: !0
|
|
116
|
+
};
|
|
117
|
+
let s = i.sourceCode.getParent(n);
|
|
118
|
+
return e(n, s) ? {
|
|
119
|
+
reason: "Mootant cannot switch a mutant on for a quoted JSX attribute value that a compiler such as Solid's reads another way once it is in braces",
|
|
120
|
+
rule: "invalid-target",
|
|
121
|
+
heuristic: !0
|
|
122
|
+
} : t(i.sourceCode.getText(r)) ? null : {
|
|
123
|
+
reason: "Mootant cannot switch a mutant on for a quoted JSX attribute value with a backslash, a control character such as a line break, or a character reference",
|
|
124
|
+
rule: "invalid-target"
|
|
125
|
+
};
|
|
97
126
|
}
|
|
98
|
-
function
|
|
99
|
-
let { parent:
|
|
127
|
+
function m(e, t) {
|
|
128
|
+
let { parent: i, index: a, key: c } = t.syntax.getContextSlot(e), l = c === "arguments" && i ? o(i, t) : null;
|
|
100
129
|
if (l === null) return null;
|
|
101
|
-
if (
|
|
130
|
+
if (a === 0) return e.type === "TemplateLiteral" && !e.expressions.every(s) ? null : {
|
|
102
131
|
reason: "an empty RegExp pattern matches everything, which acts like a test of the match forced to true",
|
|
103
132
|
rule: "regex-argument"
|
|
104
133
|
};
|
|
105
|
-
let u =
|
|
134
|
+
let u = n(l, t.sourceCode.text), d = {
|
|
106
135
|
mutator: "regex-flag",
|
|
107
136
|
node: l.flagsNode
|
|
108
137
|
};
|
|
109
|
-
return u && !u.dynamic && t
|
|
138
|
+
return u && !u.dynamic && r(t).runs(d, {
|
|
110
139
|
mutator: "string-literal",
|
|
111
|
-
node:
|
|
140
|
+
node: e
|
|
112
141
|
}) ? {
|
|
113
142
|
reason: "regex-flag changes the flags of RegExp",
|
|
114
143
|
rule: "regex-argument"
|
|
115
144
|
} : null;
|
|
116
145
|
}
|
|
117
|
-
function
|
|
118
|
-
let { syntax:
|
|
119
|
-
if (
|
|
120
|
-
let o =
|
|
121
|
-
return (a === 0 &&
|
|
146
|
+
function h(e, t) {
|
|
147
|
+
let { syntax: n } = t, { parent: r, index: a } = n.getContextSlot(e);
|
|
148
|
+
if (r?.type !== "CallExpression") return !1;
|
|
149
|
+
let o = n.getMemberPath(r.callee), s = n.unwrapExpression(r.callee);
|
|
150
|
+
return (a === 0 && s.type === "MemberExpression" && !s.computed && u.has(s.property.name) || a === 1 && o?.join(".") === "Object.hasOwn") && i(r, t);
|
|
122
151
|
}
|
|
123
|
-
function
|
|
124
|
-
let { text: r } = t, i =
|
|
152
|
+
function g(e, t, n) {
|
|
153
|
+
let { text: r } = t, i = f(e, t, n);
|
|
125
154
|
return [i ? {
|
|
126
155
|
text: r,
|
|
127
156
|
skip: i,
|
|
@@ -131,8 +160,8 @@ function f(e, t, n) {
|
|
|
131
160
|
node: e
|
|
132
161
|
}];
|
|
133
162
|
}
|
|
134
|
-
function
|
|
163
|
+
function _(e, t) {
|
|
135
164
|
let n = t.syntax.unwrapExpression(e);
|
|
136
165
|
return n.type === "Identifier" && n.name === "Symbol";
|
|
137
166
|
}
|
|
138
|
-
export {
|
|
167
|
+
export { d as stringLiteral };
|
|
@@ -5,13 +5,15 @@ import { Plugin } from '../../types/config/plugin.js';
|
|
|
5
5
|
* plugins under their full ids. Mutators are ranked in canonical order: core
|
|
6
6
|
* mutators by name, then the plugins by namespace and the mutators of each
|
|
7
7
|
* plugin by name, so the order of object keys in plugin files never matters.
|
|
8
|
+
* Every mutator of a namespaced plugin gets the skip rules of its plugin, keyed
|
|
9
|
+
* by name, each with its full id; a built-in mutator gets none.
|
|
8
10
|
*
|
|
9
11
|
* @param core - Plugin of the built-in mutators and presets, without a
|
|
10
12
|
* namespace.
|
|
11
13
|
* @param plugins - Other plugins keyed by the namespace that prefixes their
|
|
12
14
|
* ids.
|
|
13
15
|
* @returns Mutators in rank order and presets, keyed by full id.
|
|
14
|
-
* @throws Error - When a namespace, mutator name
|
|
15
|
-
* kebab-case.
|
|
16
|
+
* @throws Error - When a namespace, mutator name, preset name or skip rule name
|
|
17
|
+
* is not kebab-case.
|
|
16
18
|
*/
|
|
17
19
|
export declare function createMutatorRegistry(core: Plugin, plugins: Record<string, Plugin>): MutatorRegistry;
|
|
@@ -13,13 +13,23 @@ function n(n, i) {
|
|
|
13
13
|
return a;
|
|
14
14
|
}
|
|
15
15
|
function r(n, r, i) {
|
|
16
|
-
let a = i === null ? "the core plugin" : `plugin "${i}"`, o = i === null ? "" : `${i}
|
|
17
|
-
for (let
|
|
18
|
-
if (!t(
|
|
16
|
+
let a = i === null ? "the core plugin" : `plugin "${i}"`, o = i === null ? "" : `${i}/`, s = /* @__PURE__ */ new Map(), c = r.skipRules ?? {};
|
|
17
|
+
for (let n of Object.keys(c).toSorted(e)) {
|
|
18
|
+
if (!t(n)) throw Error(`Skip rule name "${n}" in ${a} is not kebab-case.`);
|
|
19
|
+
let { heuristic: e, category: r } = c[n];
|
|
20
|
+
s.set(n, {
|
|
21
|
+
id: `${o}${n}`,
|
|
22
|
+
heuristic: e,
|
|
23
|
+
category: r
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
for (let c of Object.keys(r.mutators).toSorted(e)) {
|
|
27
|
+
if (!t(c)) throw Error(`Mutator name "${c}" in ${a} is not kebab-case.`);
|
|
19
28
|
let e = {
|
|
20
|
-
|
|
29
|
+
...i !== null && { skipRules: s },
|
|
30
|
+
mutator: r.mutators[c],
|
|
21
31
|
rank: n.mutators.size,
|
|
22
|
-
id: `${o}${
|
|
32
|
+
id: `${o}${c}`
|
|
23
33
|
};
|
|
24
34
|
n.mutators.set(e.id, e);
|
|
25
35
|
}
|
|
@@ -2,9 +2,9 @@ import { Plugin } from '../../types/config/plugin.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks the shape of a plugin loaded at runtime: an object with a `mutators`
|
|
4
4
|
* object of mutators, each with a `create` function and a `meta` object with a
|
|
5
|
-
* description,
|
|
6
|
-
*
|
|
7
|
-
* registered.
|
|
5
|
+
* description, optional skip rules with a category and a heuristic flag, and
|
|
6
|
+
* optional presets with a description, mutator settings, `extends` and
|
|
7
|
+
* settings. Names and ids are checked when the plugin is registered.
|
|
8
8
|
*
|
|
9
9
|
* @param value - Default export of a plugin package, or a plugin object.
|
|
10
10
|
* @param namespace - Namespace the plugin is loaded under.
|