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,71 @@
|
|
|
1
|
+
import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
2
|
+
import { DryRunResult } from '../../types/adapter/dry-run-result.js';
|
|
3
|
+
import { CacheInputs } from '../../types/adapter/cache-inputs.js';
|
|
4
|
+
import { ProjectTree } from '../../types/cache/project-tree.js';
|
|
5
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
6
|
+
import { Diagnostic } from '../../types/mutant/diagnostic.js';
|
|
7
|
+
import { RunCache } from '../../types/cache/run-cache.js';
|
|
8
|
+
/**
|
|
9
|
+
* What a saved dry run is built from.
|
|
10
|
+
*/
|
|
11
|
+
interface SnapshotInput {
|
|
12
|
+
/**
|
|
13
|
+
* Outcome of the dry phase: the final dry run, the messages of the files
|
|
14
|
+
* whose mutants get no verdict, by display path, its diagnostics and its runs
|
|
15
|
+
* of the test runner.
|
|
16
|
+
*/
|
|
17
|
+
phase: {
|
|
18
|
+
errors: ReadonlyMap<string, string>;
|
|
19
|
+
diagnostics: Diagnostic[];
|
|
20
|
+
dry: DryRunResult;
|
|
21
|
+
runs: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Environment variables of the main process as the run started, before the
|
|
25
|
+
* test runner could set any, such as `NODE_ENV`.
|
|
26
|
+
*/
|
|
27
|
+
environment: NodeJS.ProcessEnv;
|
|
28
|
+
/**
|
|
29
|
+
* Everything under the project root before the test runner started
|
|
30
|
+
* (`hashProjectTree`), or null when a directory or link could not be read.
|
|
31
|
+
*/
|
|
32
|
+
tree: ProjectTree | null;
|
|
33
|
+
/**
|
|
34
|
+
* Live session of the run.
|
|
35
|
+
*/
|
|
36
|
+
session: AdapterSession;
|
|
37
|
+
/**
|
|
38
|
+
* What the session said every verdict depends on, as `prepareRunCache` asked
|
|
39
|
+
* it once.
|
|
40
|
+
*/
|
|
41
|
+
inputs: CacheInputs;
|
|
42
|
+
/**
|
|
43
|
+
* Test files and setup files of the session.
|
|
44
|
+
*/
|
|
45
|
+
testFiles: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Cache of the run after it was saved.
|
|
48
|
+
*/
|
|
49
|
+
cache: RunCache;
|
|
50
|
+
/**
|
|
51
|
+
* Key of the run (`getDrySnapshotKey`).
|
|
52
|
+
*/
|
|
53
|
+
key: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Builds the saved dry run of a run whose cache was saved (`DrySnapshot`), with
|
|
57
|
+
* the hashes the cache keys took in after the dry run, and each environment
|
|
58
|
+
* variable that test code read in the dry run or in a unit whose evidence the
|
|
59
|
+
* cache reused or stored. A run gets none when a test file of the dry run has
|
|
60
|
+
* no key: the adapter cannot tell what it depended on, or one of its
|
|
61
|
+
* dependencies changed during the run or has unknown content (`UNKNOWN_HASH`),
|
|
62
|
+
* so the saved files never name such a file. Nor does a run whose dry phase ran
|
|
63
|
+
* the tests more than once, as after a test file that failed and passed when it
|
|
64
|
+
* ran again, since a fresh dry run may not repeat what it kept, and nor does
|
|
65
|
+
* one with a directory or link of the project it could not read.
|
|
66
|
+
*
|
|
67
|
+
* @param input - Dry phase, session, cache, environment, tree and key.
|
|
68
|
+
* @returns The saved dry run, or null when the run cannot be replayed.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createDrySnapshot(input: SnapshotInput): DrySnapshot | null;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { listVariableHashes as e } from "./list-variable-hashes.js";
|
|
2
|
+
import { compareCodeUnits as t } from "../compare-code-units.js";
|
|
3
|
+
function n(n) {
|
|
4
|
+
let { session: r, phase: i, cache: a, tree: o } = n;
|
|
5
|
+
if (o === null || a.dependencies.size !== i.dry.files.length || i.runs !== 1) return null;
|
|
6
|
+
let s = /* @__PURE__ */ new Set([...a.environment, ...[...a.dependencies.values()].flat()]);
|
|
7
|
+
return {
|
|
8
|
+
variables: e([...i.dry.files.flatMap((e) => e.environment ?? []), ...[...a.inputs.values(), ...a.pending.values()].flatMap((e) => e.environment.map(([e]) => e))], n.environment),
|
|
9
|
+
session: {
|
|
10
|
+
diagnostics: [...r.diagnostics ?? []],
|
|
11
|
+
version: r.version ?? null,
|
|
12
|
+
workers: r.workers ?? null,
|
|
13
|
+
inputs: n.inputs
|
|
14
|
+
},
|
|
15
|
+
files: [...s].toSorted(t).map((e) => [e, a.hashes.get(e) ?? null]),
|
|
16
|
+
phase: {
|
|
17
|
+
diagnostics: i.diagnostics,
|
|
18
|
+
errors: [...i.errors],
|
|
19
|
+
dry: i.dry
|
|
20
|
+
},
|
|
21
|
+
testFiles: n.testFiles,
|
|
22
|
+
version: 8,
|
|
23
|
+
tree: o.hash,
|
|
24
|
+
key: n.key
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export { n as createDrySnapshot };
|
|
@@ -58,6 +58,21 @@ interface RunCacheInput {
|
|
|
58
58
|
* Entries and inputs read from the cache file.
|
|
59
59
|
*/
|
|
60
60
|
stored: StoredCache;
|
|
61
|
+
/**
|
|
62
|
+
* Whether isolated timeouts by the hit limit are stored and reused: the count
|
|
63
|
+
* of site evaluations does not depend on the load of the machine, so such a
|
|
64
|
+
* timeout is as repeatable as a kill among runs that switch the same files
|
|
65
|
+
* (`switched`). False in fast mode, whose dry run tries each test twice and
|
|
66
|
+
* so gives other limits.
|
|
67
|
+
*/
|
|
68
|
+
timeouts: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Digest of the files the run switched. The hit counts of a unit and its
|
|
71
|
+
* limits cover only their sites, so the keys of a timeout by the hit limit
|
|
72
|
+
* take it in: a run that switches other files, as a run of only some mutants
|
|
73
|
+
* does, never reuses it.
|
|
74
|
+
*/
|
|
75
|
+
switched: string;
|
|
61
76
|
/**
|
|
62
77
|
* Project root; slots name test files relative to it.
|
|
63
78
|
*/
|
|
@@ -81,8 +96,11 @@ interface RunCacheInput {
|
|
|
81
96
|
* than the dry run of its test file, such as a module only the mutant loads or
|
|
82
97
|
* an environment variable only it reads: evidence stores those inputs, and is
|
|
83
98
|
* valid only while each of them is unchanged too. Evidence of a run whose
|
|
84
|
-
* inputs are unknown is not stored. Kills by a crash
|
|
85
|
-
* machine and are never stored, and neither
|
|
99
|
+
* inputs are unknown is not stored. Kills by a crash and timeouts by the timer
|
|
100
|
+
* or a hang depend on the load of the machine and are never stored, and neither
|
|
101
|
+
* are errors; an isolated timeout by the hit limit does not and is stored and
|
|
102
|
+
* reused outside fast mode (`timeouts`), by runs that switch the same files
|
|
103
|
+
* (`switched`), whose sites its hit counts cover.
|
|
86
104
|
*
|
|
87
105
|
* @param input - Stored entries, test file keys, source hashes, mutant regions,
|
|
88
106
|
* the mode and the dry run.
|
|
@@ -44,53 +44,62 @@ function a(a) {
|
|
|
44
44
|
return e.key === t.key || a.incremental && t.incremental !== null && e.incremental === t.incremental;
|
|
45
45
|
}
|
|
46
46
|
function C(e) {
|
|
47
|
+
return {
|
|
48
|
+
...e,
|
|
49
|
+
incremental: e.incremental === null ? null : r([e.incremental, a.switched]),
|
|
50
|
+
key: r([e.key, a.switched])
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function w(e) {
|
|
47
54
|
if (e === null) return null;
|
|
48
|
-
let t = u.entries.get(e.slot);
|
|
49
|
-
return t === void 0 || !S(t,
|
|
55
|
+
let t = u.entries.get(e.slot), n = t?.status === "Timeout" ? C(e) : e;
|
|
56
|
+
return t === void 0 || t.status === "Timeout" && !a.timeouts || !S(t, n) || t.test !== null && !c.tests.has(t.test) || t.inputs !== null && !b(e.file, u.inputs.get(t.inputs)) ? null : (t.inputs !== null && _.set(t.inputs, u.inputs.get(t.inputs)), t.key !== n.key && h.add(e.mutant), m.set(e.slot, {
|
|
50
57
|
...t,
|
|
51
58
|
used: p
|
|
52
59
|
}), v.set(e.slot, e.file), t.status === "Survived" ? "survived" : {
|
|
53
60
|
file: c.testFiles.get(e.file).file,
|
|
54
61
|
message: t.message,
|
|
62
|
+
status: t.status,
|
|
55
63
|
cause: t.cause,
|
|
56
|
-
test: t.test
|
|
57
|
-
status: "Killed"
|
|
64
|
+
test: t.test
|
|
58
65
|
});
|
|
59
66
|
}
|
|
60
|
-
function
|
|
61
|
-
let { verdict: i, inputs: o } = r;
|
|
62
|
-
if (e === null || !o ||
|
|
63
|
-
let
|
|
64
|
-
environment: [...new Set(o.environment)].filter((e) => !
|
|
65
|
-
files: [...new Set(o.dependencies)].filter((e) => !
|
|
67
|
+
function T(e, n, r) {
|
|
68
|
+
let { verdict: i, inputs: o } = r, s = i === "survived" || i.status === "Killed" && i.cause !== "crash" || a.timeouts && n.path === "isolated" && i.status === "Timeout" && i.cause === "hit-limit";
|
|
69
|
+
if (e === null || !o || !s) return;
|
|
70
|
+
let c = new Set(a.dependencies.get(e.file)), l = new Set(a.reads.get(e.file)), u = {
|
|
71
|
+
environment: [...new Set(o.environment)].filter((e) => !l.has(e)).toSorted(t).map((t) => [t, y(e.file, t)]),
|
|
72
|
+
files: [...new Set(o.dependencies)].filter((e) => !c.has(e)).toSorted(t)
|
|
66
73
|
};
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
u.files.length > 0 || u.environment.length > 0 ? g.set(e.slot, u) : g.delete(e.slot), v.set(e.slot, e.file);
|
|
75
|
+
let { incremental: d, key: f } = i !== "survived" && i.status === "Timeout" ? C(e) : e;
|
|
76
|
+
m.set(e.slot, i === "survived" ? {
|
|
69
77
|
status: "Survived",
|
|
70
78
|
path: n.path,
|
|
71
|
-
key: e.key,
|
|
72
79
|
message: null,
|
|
73
80
|
inputs: null,
|
|
74
81
|
first: !1,
|
|
82
|
+
incremental: d,
|
|
75
83
|
cause: null,
|
|
76
84
|
test: null,
|
|
77
|
-
used: p
|
|
85
|
+
used: p,
|
|
86
|
+
key: f
|
|
78
87
|
} : {
|
|
79
|
-
|
|
88
|
+
status: i.status === "Timeout" ? "Timeout" : "Killed",
|
|
80
89
|
message: i.message,
|
|
81
90
|
cause: i.cause,
|
|
82
91
|
first: n.first,
|
|
83
92
|
test: i.test,
|
|
84
93
|
path: n.path,
|
|
85
|
-
key: e.key,
|
|
86
|
-
status: "Killed",
|
|
87
94
|
inputs: null,
|
|
88
|
-
|
|
95
|
+
incremental: d,
|
|
96
|
+
used: p,
|
|
97
|
+
key: f
|
|
89
98
|
});
|
|
90
99
|
}
|
|
91
100
|
return {
|
|
92
101
|
lookupBatch: (t, n) => {
|
|
93
|
-
let r = x(t, e(c.tests.get(n)), n), i =
|
|
102
|
+
let r = x(t, e(c.tests.get(n)), n), i = w(r);
|
|
94
103
|
return i === null || i === "survived" ? i : {
|
|
95
104
|
first: u.entries.get(r.slot).first,
|
|
96
105
|
verdict: i
|
|
@@ -102,18 +111,18 @@ function a(a) {
|
|
|
102
111
|
},
|
|
103
112
|
recordBatch: (t, n, r) => {
|
|
104
113
|
let i = e(c.tests.get(n)), a = t.coveredBy[0] === n;
|
|
105
|
-
|
|
114
|
+
T(x(t, i, n), {
|
|
106
115
|
path: "batch",
|
|
107
116
|
first: a
|
|
108
117
|
}, r);
|
|
109
118
|
},
|
|
110
119
|
recordUnit: (e, t, n) => {
|
|
111
|
-
|
|
120
|
+
T(x(e, t, null), {
|
|
112
121
|
path: "isolated",
|
|
113
122
|
first: !1
|
|
114
123
|
}, n);
|
|
115
124
|
},
|
|
116
|
-
lookupUnit: (e, t) =>
|
|
125
|
+
lookupUnit: (e, t) => w(x(e, t, null)),
|
|
117
126
|
dependencies: a.dependencies,
|
|
118
127
|
environment: a.environment,
|
|
119
128
|
regional: h,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
2
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
3
|
+
/**
|
|
4
|
+
* Stands in for the session of the test runner in a run that replays a saved
|
|
5
|
+
* dry run: it lists the test files and tells the cache inputs, version, workers
|
|
6
|
+
* and warnings of the session that saved it, and refuses to run anything, so a
|
|
7
|
+
* run that needs the test runner starts over with it (`createDryReuseMiss`).
|
|
8
|
+
*
|
|
9
|
+
* @param snapshot - Saved dry run of an earlier run that still holds.
|
|
10
|
+
* @returns Session without a test runner.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSnapshotSession(snapshot: DrySnapshot): AdapterSession;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createDryReuseMiss as e } from "./create-dry-reuse-miss.js";
|
|
2
|
+
function t(t) {
|
|
3
|
+
let { session: n } = t;
|
|
4
|
+
function r() {
|
|
5
|
+
return Promise.reject(e("some mutants have no cached verdict"));
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
listTestFiles: () => Promise.resolve([...t.testFiles]),
|
|
9
|
+
cacheInputs: () => Promise.resolve(n.inputs),
|
|
10
|
+
...n.version !== null && { version: n.version },
|
|
11
|
+
...n.workers !== null && { workers: n.workers },
|
|
12
|
+
diagnostics: n.diagnostics,
|
|
13
|
+
close: () => Promise.resolve(),
|
|
14
|
+
runIsolated: r,
|
|
15
|
+
runBatch: r,
|
|
16
|
+
dryRun: r
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export { t as createSnapshotSession };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gives the id of mootant's own code that the cache keys take in: the hash the
|
|
3
|
+
* build wrote (`BUILD_HASH`), or, when mootant runs from its sources, a random
|
|
4
|
+
* id made once per process, so a later process, whose sources may differ, never
|
|
5
|
+
* reuses verdicts of this one.
|
|
6
|
+
*
|
|
7
|
+
* @param file - Path of the module, a `.ts` file in the sources; this module's
|
|
8
|
+
* path when omitted.
|
|
9
|
+
* @returns Hash of the build, or the id of the sources in this process.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getBuildId(file?: string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ActiveMutator } from '../../types/mutator/active-mutator.js';
|
|
2
|
+
import { SwitchedFile } from '../../types/adapter/switched-file.js';
|
|
3
|
+
import { TestAdapter } from '../../types/adapter/test-adapter.js';
|
|
4
|
+
import { LimitSettings } from '../../types/run/run-state.js';
|
|
5
|
+
/**
|
|
6
|
+
* Builds the key of a saved dry run (`DrySnapshot`) over what the dry run was
|
|
7
|
+
* asked to do and how the run reads it: the versions of mootant, its build, the
|
|
8
|
+
* cache, the instrumenter and the runtime; the adapter; the version of Node.js
|
|
9
|
+
* with the platform; the project root and the configuration file, whose text
|
|
10
|
+
* the hash of the project tree takes in, so a run of another configuration in
|
|
11
|
+
* the same root never replays it; the working directory, which configuration
|
|
12
|
+
* and tests may read; what the test runner starts with: the concurrency, which
|
|
13
|
+
* a global setup may read, the number of cores a default one comes from, and
|
|
14
|
+
* whether units run in parallel; the try limits; the preset and its mutators;
|
|
15
|
+
* the switched files given to the dry run with their texts, which name every
|
|
16
|
+
* hosted mutant; and the files it relates tests to.
|
|
17
|
+
*
|
|
18
|
+
* @param input - Settings, adapter and files of the dry run.
|
|
19
|
+
* @param input.setup - Preset, active mutators, preset settings and the
|
|
20
|
+
* configuration file.
|
|
21
|
+
* @param input.context - Concurrency and parallel units the test runner starts
|
|
22
|
+
* with (`AdapterContext`).
|
|
23
|
+
* @param input.switched - Switched files given to the dry run, in order.
|
|
24
|
+
* @param input.related - Absolute paths of the files the dry run relates tests
|
|
25
|
+
* to, in order.
|
|
26
|
+
* @param input.limits - How try limits grow from the dry run.
|
|
27
|
+
* @param input.adapter - Adapter of the run.
|
|
28
|
+
* @param input.root - Project root.
|
|
29
|
+
* @returns SHA-256 in hex.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDrySnapshotKey(input: {
|
|
32
|
+
setup: {
|
|
33
|
+
mutators: ActiveMutator[];
|
|
34
|
+
file: string | null;
|
|
35
|
+
settings: unknown;
|
|
36
|
+
preset: string;
|
|
37
|
+
};
|
|
38
|
+
context: {
|
|
39
|
+
concurrency: number | null;
|
|
40
|
+
parallelUnits: boolean;
|
|
41
|
+
};
|
|
42
|
+
switched: readonly SwitchedFile[];
|
|
43
|
+
related: readonly string[];
|
|
44
|
+
limits: LimitSettings;
|
|
45
|
+
adapter: TestAdapter;
|
|
46
|
+
root: string;
|
|
47
|
+
}): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getPortablePath as e } from "./get-portable-path.js";
|
|
2
|
+
import { createDigest as t } from "./create-digest.js";
|
|
3
|
+
import { version as n } from "../../package.js";
|
|
4
|
+
import { getBuildId as r } from "./get-build-id.js";
|
|
5
|
+
import { availableParallelism as i } from "node:os";
|
|
6
|
+
import { createHash as a } from "node:crypto";
|
|
7
|
+
function o(o) {
|
|
8
|
+
let { context: s, setup: c, root: l } = o;
|
|
9
|
+
return t([
|
|
10
|
+
8,
|
|
11
|
+
n,
|
|
12
|
+
r(),
|
|
13
|
+
2,
|
|
14
|
+
2,
|
|
15
|
+
[o.adapter.name, o.adapter.version ?? null],
|
|
16
|
+
[
|
|
17
|
+
process.version,
|
|
18
|
+
process.platform,
|
|
19
|
+
process.arch
|
|
20
|
+
],
|
|
21
|
+
l,
|
|
22
|
+
c.file === null ? null : e(c.file, l),
|
|
23
|
+
process.cwd(),
|
|
24
|
+
[
|
|
25
|
+
s.concurrency,
|
|
26
|
+
i(),
|
|
27
|
+
s.parallelUnits
|
|
28
|
+
],
|
|
29
|
+
o.limits,
|
|
30
|
+
[
|
|
31
|
+
c.mutators.map((e) => [e.id, e.options]),
|
|
32
|
+
c.settings,
|
|
33
|
+
c.preset
|
|
34
|
+
],
|
|
35
|
+
o.switched.map((t) => [
|
|
36
|
+
e(t.file, l),
|
|
37
|
+
a("sha256").update(t.switched).digest("hex"),
|
|
38
|
+
a("sha256").update(t.original).digest("hex")
|
|
39
|
+
]),
|
|
40
|
+
o.related.map((t) => e(t, l))
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
export { o as getDrySnapshotKey };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the path of the saved dry run of a project (`DrySnapshot`), next to
|
|
3
|
+
* the cache file.
|
|
4
|
+
*
|
|
5
|
+
* @param root - Project root.
|
|
6
|
+
* @returns Absolute path, such as
|
|
7
|
+
* `<root>/node_modules/.cache/mootant/dry-v8.json`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDrySnapshotPath(root: string): string;
|
|
@@ -25,6 +25,11 @@ interface EnvironmentInput {
|
|
|
25
25
|
* Hashes of the files by absolute path, null for a missing one.
|
|
26
26
|
*/
|
|
27
27
|
hashes: ReadonlyMap<string, string | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether isolated units of one test file run at the same time, false when
|
|
30
|
+
* omitted.
|
|
31
|
+
*/
|
|
32
|
+
parallelUnits?: boolean;
|
|
28
33
|
/**
|
|
29
34
|
* How try limits grow from the dry run.
|
|
30
35
|
*/
|
|
@@ -39,10 +44,9 @@ interface EnvironmentInput {
|
|
|
39
44
|
*/
|
|
40
45
|
files: string[];
|
|
41
46
|
/**
|
|
42
|
-
*
|
|
43
|
-
* not reuse verdicts of the previous build.
|
|
47
|
+
* Id of mootant's own code (`getBuildId`).
|
|
44
48
|
*/
|
|
45
|
-
build:
|
|
49
|
+
build: string;
|
|
46
50
|
/**
|
|
47
51
|
* Project root; paths are hashed relative to it.
|
|
48
52
|
*/
|
|
@@ -54,7 +58,8 @@ interface EnvironmentInput {
|
|
|
54
58
|
* runner, the hashes of the files every verdict depends on, the settings of the
|
|
55
59
|
* test runner, the try limits, the preset and its mutators, and the major
|
|
56
60
|
* version of Node.js with the platform. Concurrency and fast mode are not part
|
|
57
|
-
* of it.
|
|
61
|
+
* of it. Parallel units are part of it only when on, since their verdicts may
|
|
62
|
+
* differ where tests rely on a test file never running twice at once.
|
|
58
63
|
*
|
|
59
64
|
* @param input - Versions, files, hashes and settings of the run.
|
|
60
65
|
* @returns SHA-256 in hex.
|
|
@@ -7,11 +7,11 @@ function r(r) {
|
|
|
7
7
|
root: a
|
|
8
8
|
});
|
|
9
9
|
return t([
|
|
10
|
-
|
|
10
|
+
8,
|
|
11
11
|
n,
|
|
12
12
|
r.build,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
2,
|
|
14
|
+
2,
|
|
15
15
|
r.runner,
|
|
16
16
|
o,
|
|
17
17
|
r.settings ?? null,
|
|
@@ -19,7 +19,8 @@ function r(r) {
|
|
|
19
19
|
r.mutators,
|
|
20
20
|
process.versions.node.split(".", 1)[0],
|
|
21
21
|
process.platform,
|
|
22
|
-
process.arch
|
|
22
|
+
process.arch,
|
|
23
|
+
...r.parallelUnits === !0 ? ["parallel-units"] : []
|
|
23
24
|
]);
|
|
24
25
|
}
|
|
25
26
|
export { r as getEnvironmentKey };
|
|
@@ -7,7 +7,8 @@ import { DryFile } from '../../types/adapter/dry-file.js';
|
|
|
7
7
|
* is not set included. Incremental keys leave out the files mutants are listed
|
|
8
8
|
* from, for which the region of a mutant stands (see `getMutantRegions`). Test
|
|
9
9
|
* files without dependencies get no key, so their verdicts are neither reused
|
|
10
|
-
* nor stored.
|
|
10
|
+
* nor stored. Each file is made portable once for all test files, which share
|
|
11
|
+
* most of what they load, such as the files of a test environment like jsdom.
|
|
11
12
|
*
|
|
12
13
|
* @param input - Test files of the dry run, file hashes and environment.
|
|
13
14
|
* @param input.files - Test files of the dry run.
|
|
@@ -4,21 +4,22 @@ import { getPortablePath as n } from "./get-portable-path.js";
|
|
|
4
4
|
import { listFileHashes as r } from "./list-file-hashes.js";
|
|
5
5
|
import { createDigest as i } from "./create-digest.js";
|
|
6
6
|
function a(a) {
|
|
7
|
-
let { environment: o, variables: s, mutated: c, hashes: l, root: u } = a, d = /* @__PURE__ */ new Map();
|
|
8
|
-
for (let
|
|
9
|
-
if (!Array.isArray(
|
|
10
|
-
let a = r([
|
|
7
|
+
let { environment: o, variables: s, mutated: c, hashes: l, root: u } = a, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
8
|
+
for (let p of a.files) {
|
|
9
|
+
if (!Array.isArray(p.dependencies)) continue;
|
|
10
|
+
let a = r([p.file, ...p.dependencies.filter((e) => !c.has(e))], {
|
|
11
11
|
hashes: l,
|
|
12
|
+
paths: d,
|
|
12
13
|
root: u
|
|
13
|
-
}),
|
|
14
|
-
|
|
14
|
+
}), m = Object.hasOwn(s, p.project) ? s[p.project] : {}, h = [...new Set(p.environment)].toSorted(t).map((e) => [e, Object.hasOwn(m, e) ? m[e] : null]);
|
|
15
|
+
f.set(e(p), i([
|
|
15
16
|
o,
|
|
16
|
-
n(
|
|
17
|
-
|
|
17
|
+
n(p.file, u),
|
|
18
|
+
p.project,
|
|
18
19
|
a,
|
|
19
|
-
|
|
20
|
+
h
|
|
20
21
|
]));
|
|
21
22
|
}
|
|
22
|
-
return
|
|
23
|
+
return f;
|
|
23
24
|
}
|
|
24
25
|
export { a as getTestFileKeys };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hashes the contents of files, each file once, a few at a time
|
|
3
|
-
* hashed by the names in it, those of
|
|
4
|
-
* or replacing a file with a directory
|
|
5
|
-
* directory in it does not.
|
|
2
|
+
* Hashes the contents of files, each file once, a few at a time, a large one as
|
|
3
|
+
* a stream (`STREAM_SIZE`); a directory is hashed by the names in it, those of
|
|
4
|
+
* directories marked, so adding, removing or replacing a file with a directory
|
|
5
|
+
* changes it, while a change inside a directory in it does not. A path that is
|
|
6
|
+
* neither a file nor a directory, such as a device, a pipe or a socket, is
|
|
7
|
+
* never read, as reading `/dev/stdin` or a pipe would wait for its writer and
|
|
8
|
+
* `/dev/zero` never ends: its content is unknown, which differs from a missing
|
|
9
|
+
* file.
|
|
6
10
|
*
|
|
7
11
|
* @param paths - Absolute paths, duplicates allowed.
|
|
8
|
-
* @returns SHA-256 of each file in hex by path,
|
|
9
|
-
*
|
|
12
|
+
* @returns SHA-256 of each file in hex by path, `UNKNOWN_HASH` for a path that
|
|
13
|
+
* is neither a file nor a directory, or null for a file that cannot be read,
|
|
14
|
+
* such as a missing one.
|
|
10
15
|
*/
|
|
11
16
|
export declare function hashFiles(paths: Iterable<string>): Promise<Map<string, string | null>>;
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import { compareCodeUnits as e } from "../compare-code-units.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { UNKNOWN_HASH as t } from "./unknown-hash.js";
|
|
3
|
+
import { runInChunks as n } from "./run-in-chunks.js";
|
|
4
|
+
import { createReadStream as r } from "node:fs";
|
|
5
|
+
import { createHash as i } from "node:crypto";
|
|
6
|
+
import { readFile as a, readdir as o, stat as s } from "node:fs/promises";
|
|
7
|
+
async function c(e) {
|
|
8
|
+
let t = /* @__PURE__ */ new Map();
|
|
9
|
+
return await n([...new Set(e)], 32, async (e) => {
|
|
10
|
+
t.set(e, await l(e));
|
|
11
|
+
}), t;
|
|
11
12
|
}
|
|
12
|
-
async function
|
|
13
|
+
async function l(n) {
|
|
13
14
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
let c = await s(n);
|
|
16
|
+
if (c.isFile() && c.size <= 16777216) return i("sha256").update(await a(n)).digest("hex");
|
|
17
|
+
if (c.isFile()) {
|
|
18
|
+
let e = i("sha256");
|
|
19
|
+
for await (let t of r(n)) e.update(t);
|
|
20
|
+
return e.digest("hex");
|
|
21
|
+
}
|
|
22
|
+
if (!c.isDirectory()) return t;
|
|
23
|
+
let l = (await o(n, { withFileTypes: !0 })).map((e) => e.isDirectory() ? `${e.name}/` : e.name).toSorted(e);
|
|
24
|
+
return i("sha256").update(`directory\0${l.join("\0")}`).digest("hex");
|
|
20
25
|
} catch {
|
|
21
26
|
return null;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
|
-
export {
|
|
29
|
+
export { c as hashFiles };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ProjectTree } from '../../types/cache/project-tree.js';
|
|
2
|
+
/**
|
|
3
|
+
* Hashes everything under the project root with its contents, so that adding,
|
|
4
|
+
* removing, renaming or changing any file, directory or symbolic link changes
|
|
5
|
+
* the hash: a new test file, a test file the dry run did not run that now
|
|
6
|
+
* imports a mutated file, or a file that now shadows a module a test imports.
|
|
7
|
+
* Directories in `SKIPPED` and the given outputs of mootant are left out. A
|
|
8
|
+
* symbolic link counts by its target, never followed, and a path that is
|
|
9
|
+
* neither a file nor a directory by its name, as `hashFiles` cannot read it. A
|
|
10
|
+
* directory that cannot be listed may still hold files a test loads by their
|
|
11
|
+
* paths, so the tree then has no hash. The entries go into the hash one at a
|
|
12
|
+
* time, so a large tree never makes one long text, and come back by path, so a
|
|
13
|
+
* later tree can name what changed.
|
|
14
|
+
*
|
|
15
|
+
* @param root - Directory whose contents are hashed: the project root.
|
|
16
|
+
* @param outputs - Absolute paths mootant writes into the project during or
|
|
17
|
+
* after a run, such as the HTML report and the work directory, which are left
|
|
18
|
+
* out.
|
|
19
|
+
* @returns The hash with the entry of every path, or null when a directory
|
|
20
|
+
* cannot be listed or a link cannot be read.
|
|
21
|
+
*/
|
|
22
|
+
export declare function hashProjectTree(root: string, outputs: readonly string[]): Promise<ProjectTree | null>;
|