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,69 @@
|
|
|
1
|
+
import { compareCodeUnits as e } from "../compare-code-units.js";
|
|
2
|
+
import { getPortablePath as t } from "./get-portable-path.js";
|
|
3
|
+
import { runInChunks as n } from "./run-in-chunks.js";
|
|
4
|
+
import { hashFiles as r } from "./hash-files.js";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
import { createHash as a } from "node:crypto";
|
|
7
|
+
import { readdir as o, readlink as s } from "node:fs/promises";
|
|
8
|
+
const c = /* @__PURE__ */ new Set([
|
|
9
|
+
"node_modules",
|
|
10
|
+
".pnpm-store",
|
|
11
|
+
".mootant",
|
|
12
|
+
".git"
|
|
13
|
+
]);
|
|
14
|
+
async function l(o, s) {
|
|
15
|
+
let l = new Set(s), f = [], p = 0, m = [], h = [];
|
|
16
|
+
async function g(e) {
|
|
17
|
+
let r = [];
|
|
18
|
+
await n(e, 32, async (e) => {
|
|
19
|
+
let n = await u(e);
|
|
20
|
+
if (n === null) p += 1;
|
|
21
|
+
else {
|
|
22
|
+
f.push([
|
|
23
|
+
t(e, o),
|
|
24
|
+
"directory",
|
|
25
|
+
null
|
|
26
|
+
]);
|
|
27
|
+
for (let t of n) {
|
|
28
|
+
let n = i.join(e, t.name);
|
|
29
|
+
l.has(n) || (t.isSymbolicLink() ? h.push(n) : t.isDirectory() ? c.has(t.name) || r.push(n) : m.push(n));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}), r.length > 0 && await g(r);
|
|
33
|
+
}
|
|
34
|
+
if (await g([o]), await n(h, 32, async (e) => {
|
|
35
|
+
let n = await d(e);
|
|
36
|
+
n === null && (p += 1), f.push([
|
|
37
|
+
t(e, o),
|
|
38
|
+
"link",
|
|
39
|
+
n
|
|
40
|
+
]);
|
|
41
|
+
}), p > 0) return null;
|
|
42
|
+
let _ = await r(m);
|
|
43
|
+
for (let e of m) f.push([
|
|
44
|
+
t(e, o),
|
|
45
|
+
"file",
|
|
46
|
+
_.get(e)
|
|
47
|
+
]);
|
|
48
|
+
let v = f.toSorted(([t], [n]) => e(t, n)), y = a("sha256");
|
|
49
|
+
for (let e of v) y.update(`${JSON.stringify(e)}\n`);
|
|
50
|
+
return {
|
|
51
|
+
entries: new Map(v.map(([e, t, n]) => [e, JSON.stringify([t, n])])),
|
|
52
|
+
hash: y.digest("hex")
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function u(e) {
|
|
56
|
+
try {
|
|
57
|
+
return await o(e, { withFileTypes: !0 });
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function d(e) {
|
|
63
|
+
try {
|
|
64
|
+
return await s(e);
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export { l as hashProjectTree };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells whether a thrown value is the error that ends a replay of a saved dry
|
|
3
|
+
* run (`createDryReuseMiss`).
|
|
4
|
+
*
|
|
5
|
+
* @param error - Thrown value.
|
|
6
|
+
* @returns Whether the value is an object named `DryReuseMiss`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isDryReuseMiss(error: unknown): error is Error;
|
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
* @param input - Hashes of the files and the project root.
|
|
7
7
|
* @param input.hashes - Hashes of the files by absolute path, null for a
|
|
8
8
|
* missing one.
|
|
9
|
+
* @param input.paths - Portable paths by absolute path, which calls that list
|
|
10
|
+
* the same files share: a path found there is taken, and one computed is
|
|
11
|
+
* added. None when omitted.
|
|
9
12
|
* @param input.root - Project root; paths are listed relative to it.
|
|
10
13
|
* @returns Portable path and hash of each file, or null for a file without a
|
|
11
14
|
* hash.
|
|
12
15
|
*/
|
|
13
16
|
export declare function listFileHashes(files: Iterable<string>, input: {
|
|
14
17
|
hashes: ReadonlyMap<string, string | null>;
|
|
18
|
+
paths?: Map<string, string>;
|
|
15
19
|
root: string;
|
|
16
20
|
}): [string, string | null][];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { compareCodeUnits as e } from "../compare-code-units.js";
|
|
2
2
|
import { getPortablePath as t } from "./get-portable-path.js";
|
|
3
3
|
function n(n, r) {
|
|
4
|
-
let {
|
|
5
|
-
return [...new Set(n)].map((e) =>
|
|
4
|
+
let { paths: i = /* @__PURE__ */ new Map(), hashes: a, root: o } = r;
|
|
5
|
+
return [...new Set(n)].map((e) => {
|
|
6
|
+
let n = i.get(e);
|
|
7
|
+
return n === void 0 && (n = t(e, o), i.set(e, n)), [n, a.get(e) ?? null];
|
|
8
|
+
}).toSorted(([t], [n]) => e(t, n));
|
|
6
9
|
}
|
|
7
10
|
export { n as listFileHashes };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists the files that tell what a package manager installed, in the root and
|
|
3
|
+
* in every directory above it, where Node looks for packages, as in a workspace
|
|
4
|
+
* that installs above the root with or without a lockfile. They follow what is
|
|
5
|
+
* installed when the lockfile does not, as after a switch of branches without
|
|
6
|
+
* an install. Every name is listed, missing files included, so one that appears
|
|
7
|
+
* changes the hashes as a changed one does.
|
|
8
|
+
*
|
|
9
|
+
* @param root - Project root.
|
|
10
|
+
* @returns Absolute paths, missing files included, from the root up.
|
|
11
|
+
*/
|
|
12
|
+
export declare function listInstallStates(root: string): string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import e from "node:path";
|
|
2
|
+
const t = [
|
|
3
|
+
"node_modules/.package-lock.json",
|
|
4
|
+
"node_modules/.pnpm/lock.yaml",
|
|
5
|
+
"node_modules/.yarn-state.yml",
|
|
6
|
+
"node_modules/.yarn-integrity",
|
|
7
|
+
".pnp.data.json",
|
|
8
|
+
".pnp.cjs"
|
|
9
|
+
];
|
|
10
|
+
function n(n) {
|
|
11
|
+
let r = [], i = n;
|
|
12
|
+
for (;;) {
|
|
13
|
+
for (let n of t) r.push(e.join(i, n));
|
|
14
|
+
let n = e.dirname(i);
|
|
15
|
+
if (n === i) return r;
|
|
16
|
+
i = n;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export { n as listInstallStates };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hashes environment variables of the main process for a saved dry run
|
|
3
|
+
* (`DrySnapshot.variables`): each variable that test code read, by name, set or
|
|
4
|
+
* not, and under `*` every variable but those that change from one shell to
|
|
5
|
+
* another (`VOLATILE_VARIABLES`), so that adding, removing or changing any of
|
|
6
|
+
* them changes it. The configuration of the test runner and its own code read
|
|
7
|
+
* variables in the main process, where nothing tracks which, and what they read
|
|
8
|
+
* goes into the settings and the variables a replay takes from the saved run.
|
|
9
|
+
*
|
|
10
|
+
* @param names - Names test code read; `*` is added if missing.
|
|
11
|
+
* @param environment - Environment variables of the main process.
|
|
12
|
+
* @returns Name and SHA-256 in hex of each value, or null when unset, sorted by
|
|
13
|
+
* name.
|
|
14
|
+
*/
|
|
15
|
+
export declare function listVariableHashes(names: Iterable<string>, environment: NodeJS.ProcessEnv): [string, string | null][];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VOLATILE_VARIABLES as e } from "./volatile-variables.js";
|
|
2
|
+
import { compareCodeUnits as t } from "../compare-code-units.js";
|
|
3
|
+
import { createDigest as n } from "./create-digest.js";
|
|
4
|
+
import { createHash as r } from "node:crypto";
|
|
5
|
+
function i(e, n) {
|
|
6
|
+
return [.../* @__PURE__ */ new Set([...e, "*"])].toSorted(t).map((e) => [e, e === "*" ? a(n) : o(n[e])]);
|
|
7
|
+
}
|
|
8
|
+
function a(r) {
|
|
9
|
+
return n(Object.entries(r).filter(([t, n]) => n !== void 0 && !e.has(t)).toSorted(([e], [n]) => t(e, n)));
|
|
10
|
+
}
|
|
11
|
+
function o(e) {
|
|
12
|
+
return e === void 0 ? null : r("sha256").update(e).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
export { i as listVariableHashes };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
2
2
|
import { ActiveMutator } from '../../types/mutator/active-mutator.js';
|
|
3
3
|
import { DryRunResult } from '../../types/adapter/dry-run-result.js';
|
|
4
|
+
import { CacheInputs } from '../../types/adapter/cache-inputs.js';
|
|
4
5
|
import { TestAdapter } from '../../types/adapter/test-adapter.js';
|
|
5
6
|
import { FileMutants } from '../../types/mutant/file-mutants.js';
|
|
6
7
|
import { StoredCache } from '../../types/cache/stored-cache.js';
|
|
8
|
+
import { Diagnostic } from '../../types/mutant/diagnostic.js';
|
|
7
9
|
import { DryAnalysis } from '../../types/run/dry-analysis.js';
|
|
8
10
|
import { LimitSettings } from '../../types/run/run-state.js';
|
|
9
11
|
import { RunCache } from '../../types/cache/run-cache.js';
|
|
@@ -29,10 +31,23 @@ interface PrepareInput {
|
|
|
29
31
|
* Entries and inputs of the cache file, read while the dry run went on.
|
|
30
32
|
*/
|
|
31
33
|
stored: Promise<StoredCache>;
|
|
34
|
+
/**
|
|
35
|
+
* Absolute paths of the files the dry run switched, those it dropped as
|
|
36
|
+
* broken left out: the hit counts of a unit cover only their sites, so a
|
|
37
|
+
* timeout by the hit limit holds only for runs that switch the same files.
|
|
38
|
+
*/
|
|
39
|
+
switched: readonly string[];
|
|
32
40
|
/**
|
|
33
41
|
* Live test runner after the dry run.
|
|
34
42
|
*/
|
|
35
43
|
session: AdapterSession;
|
|
44
|
+
/**
|
|
45
|
+
* Whether isolated units of one test file run at the same time; such runs
|
|
46
|
+
* never reuse the verdicts of other runs, nor other runs theirs, since tests
|
|
47
|
+
* that rely on a test file never running twice at once may give other
|
|
48
|
+
* verdicts. False when omitted.
|
|
49
|
+
*/
|
|
50
|
+
parallelUnits?: boolean;
|
|
36
51
|
/**
|
|
37
52
|
* Coverage and tests of the dry run.
|
|
38
53
|
*/
|
|
@@ -58,6 +73,11 @@ interface PrepareInput {
|
|
|
58
73
|
* listed.
|
|
59
74
|
*/
|
|
60
75
|
started: number;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the run is in fast mode, which neither stores nor reuses timeouts
|
|
78
|
+
* by the hit limit (`RunCacheInput.timeouts`).
|
|
79
|
+
*/
|
|
80
|
+
fast: boolean;
|
|
61
81
|
/**
|
|
62
82
|
* Project root.
|
|
63
83
|
*/
|
|
@@ -67,26 +87,54 @@ interface PrepareInput {
|
|
|
67
87
|
*/
|
|
68
88
|
now: number;
|
|
69
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Cache of a run, or what left the run without one.
|
|
92
|
+
*/
|
|
93
|
+
interface PreparedCache {
|
|
94
|
+
/**
|
|
95
|
+
* A `cache-skipped` warning that names a file which changed during the run or
|
|
96
|
+
* has unknown content, or null.
|
|
97
|
+
*/
|
|
98
|
+
warning: Diagnostic | null;
|
|
99
|
+
/**
|
|
100
|
+
* What the session said every verdict depends on (`cacheInputs`), asked once,
|
|
101
|
+
* or null when the adapter cannot tell.
|
|
102
|
+
*/
|
|
103
|
+
inputs: CacheInputs | null;
|
|
104
|
+
/**
|
|
105
|
+
* Cache of the run, or null.
|
|
106
|
+
*/
|
|
107
|
+
cache: RunCache | null;
|
|
108
|
+
}
|
|
70
109
|
/**
|
|
71
110
|
* Prepares the cache of a run after its dry run: asks the adapter what every
|
|
72
111
|
* verdict depends on, hashes those files together with the `.env` files, the
|
|
73
|
-
* lockfile
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* file
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
112
|
+
* lockfile with the files that tell what was installed (`listInstallStates`),
|
|
113
|
+
* `package.json` and the `tsconfig` and `jsconfig` files of the root, every
|
|
114
|
+
* file a test file depended on and every file stored entries read beyond that,
|
|
115
|
+
* each file once, then builds the environment key and the key of every test
|
|
116
|
+
* file, which takes in the environment variables it read, and the key of every
|
|
117
|
+
* test file over what it reads outside the files mutants are listed from, for
|
|
118
|
+
* the incremental keys. Files modified since the run started may have changed
|
|
119
|
+
* after the test runner read them, so their hash may not be what verdicts came
|
|
120
|
+
* from: a test file that depends on one gets no key, and no test file gets one
|
|
121
|
+
* when a file of the environment changed. The same goes for a path whose
|
|
122
|
+
* content is unknown, such as a device or a pipe (`UNKNOWN_HASH`), whatever its
|
|
123
|
+
* time. Files the test code of the dry run changed itself (`DryFile.modified`),
|
|
124
|
+
* files of the environment among them, are hashed as they are now, which is
|
|
125
|
+
* what the next run starts from; `saveRunCache` checks that their contents
|
|
126
|
+
* stayed so. A test runner that read such a file before the test code wrote it,
|
|
127
|
+
* as Vitest loads the `.env` files of its mode when it starts, may have run
|
|
128
|
+
* with an earlier text than the keys show, whether the test code or the user
|
|
129
|
+
* changed it. A run with parallel units has an environment key of its own.
|
|
130
|
+
* Outside fast mode, the cache keeps timeouts by the hit limit too.
|
|
85
131
|
*
|
|
86
132
|
* @param input - Session, dry run, settings and the stored entries.
|
|
87
|
-
* @returns Cache of the run,
|
|
88
|
-
*
|
|
89
|
-
* file
|
|
133
|
+
* @returns Cache of the run, with what the session said verdicts depend on. No
|
|
134
|
+
* cache when the adapter cannot tell what verdicts depend on or no test file
|
|
135
|
+
* has a key; when a file of the environment, or a dependency while no test
|
|
136
|
+
* file has a key, changed during the run or has unknown content, with a
|
|
137
|
+
* `cache-skipped` warning that names the first such file.
|
|
90
138
|
*/
|
|
91
|
-
export declare function prepareRunCache(input: PrepareInput): Promise<
|
|
139
|
+
export declare function prepareRunCache(input: PrepareInput): Promise<PreparedCache>;
|
|
92
140
|
export {};
|
|
@@ -1,71 +1,118 @@
|
|
|
1
1
|
import { getTestFileKey as e } from "../run/get-test-file-key.js";
|
|
2
2
|
import { getEnvironmentKey as t } from "./get-environment-key.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import s from "
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
import { listInstallStates as n } from "./list-install-states.js";
|
|
4
|
+
import { compareCodeUnits as r } from "../compare-code-units.js";
|
|
5
|
+
import { getDisplayPath as i } from "../run/get-display-path.js";
|
|
6
|
+
import { findChangedFiles as a } from "./find-changed-files.js";
|
|
7
|
+
import { getTestFileKeys as o } from "./get-test-file-keys.js";
|
|
8
|
+
import { getPortablePath as s } from "./get-portable-path.js";
|
|
9
|
+
import { createRunCache as c } from "./create-run-cache.js";
|
|
10
|
+
import { findLockfile as l } from "./find-lockfile.js";
|
|
11
|
+
import { createDigest as u } from "./create-digest.js";
|
|
12
|
+
import "./unknown-hash.js";
|
|
13
|
+
import { getBuildId as d } from "./get-build-id.js";
|
|
14
|
+
import { hashFiles as f } from "./hash-files.js";
|
|
15
|
+
import p from "node:path";
|
|
16
|
+
import { createHash as m } from "node:crypto";
|
|
17
|
+
import { readdir as h } from "node:fs/promises";
|
|
18
|
+
async function g(g) {
|
|
19
|
+
let { session: _, setup: v, root: y, dry: b } = g;
|
|
20
|
+
if (_.cacheInputs === void 0) return {
|
|
21
|
+
warning: null,
|
|
22
|
+
inputs: null,
|
|
23
|
+
cache: null
|
|
24
|
+
};
|
|
25
|
+
let x = await _.cacheInputs(), S = l(y), C = [
|
|
26
|
+
...x.files,
|
|
27
|
+
...S === null ? [] : [S],
|
|
28
|
+
...n(y),
|
|
29
|
+
p.join(y, "package.json"),
|
|
30
|
+
...(await h(y)).filter((e) => /^(?:\.env|(?:jsconfig|tsconfig).*\.json$)/u.test(e)).map((e) => p.join(y, e))
|
|
31
|
+
], w = new Map(b.files.flatMap((t) => Array.isArray(t.dependencies) ? [[e(t), [t.file, ...t.dependencies]]] : [])), T = [...C, ...[...w.values()].flat()], E = new Set(b.files.flatMap((e) => e.modified ?? [])), D = await a(T, g.started);
|
|
32
|
+
for (let e of E) D.delete(e);
|
|
33
|
+
let O = await g.stored, k = await f([...T, ...[...O.inputs.values()].flatMap((e) => e.files.map(([e]) => p.resolve(y, e)))]);
|
|
34
|
+
function A(e) {
|
|
35
|
+
return D.has(e) || k.get(e) === "unknown";
|
|
36
|
+
}
|
|
37
|
+
function j(e) {
|
|
38
|
+
let t = i(e, y), n = t === "" ? "the root of the project" : t;
|
|
39
|
+
return {
|
|
40
|
+
warning: {
|
|
41
|
+
message: k.get(e) === "unknown" ? `Verdicts were neither reused nor cached because ${n} is a device, a pipe or a socket, so mootant cannot tell whether it changed.` : `Verdicts were neither reused nor cached because ${n} has a modification time at or after the start of the run, so it may have changed while the run went on.`,
|
|
42
|
+
code: "cache-skipped",
|
|
43
|
+
severity: "warning",
|
|
44
|
+
column: null,
|
|
45
|
+
file: null,
|
|
46
|
+
line: null
|
|
47
|
+
},
|
|
48
|
+
cache: null,
|
|
49
|
+
inputs: x
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
let M = C.find((e) => A(e));
|
|
53
|
+
if (M !== void 0) return j(M);
|
|
54
|
+
let N = x.environment ?? {}, P = t({
|
|
23
55
|
mutators: {
|
|
24
|
-
mutators:
|
|
25
|
-
settings:
|
|
26
|
-
preset:
|
|
56
|
+
mutators: v.mutators.map((e) => [e.id, e.options]),
|
|
57
|
+
settings: v.settings,
|
|
58
|
+
preset: v.preset
|
|
27
59
|
},
|
|
28
60
|
runner: {
|
|
29
|
-
version:
|
|
30
|
-
runner:
|
|
31
|
-
adapter:
|
|
61
|
+
version: g.adapter.version ?? null,
|
|
62
|
+
runner: _.version ?? null,
|
|
63
|
+
adapter: g.adapter.name
|
|
32
64
|
},
|
|
33
|
-
|
|
34
|
-
settings:
|
|
35
|
-
limits:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
65
|
+
parallelUnits: g.parallelUnits === !0,
|
|
66
|
+
settings: x.settings,
|
|
67
|
+
limits: g.limits,
|
|
68
|
+
build: d(),
|
|
69
|
+
hashes: k,
|
|
70
|
+
files: C,
|
|
71
|
+
root: y
|
|
72
|
+
}), F = b.files.filter((t) => (w.get(e(t)) ?? []).every((e) => !A(e))), I = o({
|
|
40
73
|
mutated: /* @__PURE__ */ new Set(),
|
|
41
|
-
files:
|
|
42
|
-
environment:
|
|
43
|
-
variables:
|
|
44
|
-
hashes:
|
|
45
|
-
root:
|
|
46
|
-
});
|
|
47
|
-
return O.size === 0 ? null : i({
|
|
48
|
-
sources: new Map(d.files.flatMap((e) => e.source === null ? [] : [[e.file, c("sha256").update(e.source).digest("hex")]])),
|
|
49
|
-
outsideKeys: r({
|
|
50
|
-
mutated: new Set(d.files.map((e) => e.absolute)),
|
|
51
|
-
files: D,
|
|
52
|
-
environment: E,
|
|
53
|
-
variables: T,
|
|
54
|
-
hashes: w,
|
|
55
|
-
root: m
|
|
56
|
-
}),
|
|
57
|
-
reads: new Map(h.files.map((t) => [e(t), t.environment ?? []])),
|
|
58
|
-
dependencies: new Map([...y].filter(([e]) => O.has(e))),
|
|
59
|
-
regions: new Map(d.files.flatMap((e) => [...e.regions ?? []])),
|
|
60
|
-
incremental: d.incremental,
|
|
61
|
-
analysis: d.analysis,
|
|
62
|
-
environment: v,
|
|
63
|
-
now: d.now,
|
|
64
|
-
variables: T,
|
|
65
|
-
fileKeys: O,
|
|
66
|
-
stored: C,
|
|
67
|
-
hashes: w,
|
|
68
|
-
root: m
|
|
74
|
+
files: F,
|
|
75
|
+
environment: P,
|
|
76
|
+
variables: N,
|
|
77
|
+
hashes: k,
|
|
78
|
+
root: y
|
|
69
79
|
});
|
|
80
|
+
if (I.size === 0) {
|
|
81
|
+
let e = [...w.values()].flat().find((e) => A(e));
|
|
82
|
+
return e === void 0 ? {
|
|
83
|
+
warning: null,
|
|
84
|
+
cache: null,
|
|
85
|
+
inputs: x
|
|
86
|
+
} : j(e);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
warning: null,
|
|
90
|
+
inputs: x,
|
|
91
|
+
cache: c({
|
|
92
|
+
sources: new Map(g.files.flatMap((e) => e.source === null ? [] : [[e.file, m("sha256").update(e.source).digest("hex")]])),
|
|
93
|
+
outsideKeys: o({
|
|
94
|
+
mutated: new Set(g.files.map((e) => e.absolute)),
|
|
95
|
+
files: F,
|
|
96
|
+
environment: P,
|
|
97
|
+
variables: N,
|
|
98
|
+
hashes: k,
|
|
99
|
+
root: y
|
|
100
|
+
}),
|
|
101
|
+
switched: u(g.switched.map((e) => s(e, y)).toSorted(r)),
|
|
102
|
+
reads: new Map(b.files.map((t) => [e(t), t.environment ?? []])),
|
|
103
|
+
dependencies: new Map([...w].filter(([e]) => I.has(e))),
|
|
104
|
+
regions: new Map(g.files.flatMap((e) => [...e.regions ?? []])),
|
|
105
|
+
incremental: g.incremental,
|
|
106
|
+
analysis: g.analysis,
|
|
107
|
+
timeouts: !g.fast,
|
|
108
|
+
environment: C,
|
|
109
|
+
now: g.now,
|
|
110
|
+
variables: N,
|
|
111
|
+
fileKeys: I,
|
|
112
|
+
stored: O,
|
|
113
|
+
hashes: k,
|
|
114
|
+
root: y
|
|
115
|
+
})
|
|
116
|
+
};
|
|
70
117
|
}
|
|
71
|
-
export {
|
|
118
|
+
export { g as prepareRunCache };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the saved dry run of a project (`DrySnapshot`). A missing or unreadable
|
|
4
|
+
* file, invalid JSON, another version or a value without the parts of a saved
|
|
5
|
+
* dry run gives none: it only ever makes a run faster.
|
|
6
|
+
*
|
|
7
|
+
* @param file - Absolute path of the file (`getDrySnapshotPath`).
|
|
8
|
+
* @returns The saved dry run, or null.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readDrySnapshot(file: string): Promise<DrySnapshot | null>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isRecord as e } from "../plugins/is-record.js";
|
|
2
|
+
import { readFile as t } from "node:fs/promises";
|
|
3
|
+
async function n(e) {
|
|
4
|
+
let n;
|
|
5
|
+
try {
|
|
6
|
+
n = JSON.parse(await t(e, "utf8"));
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return r(n) ? n : null;
|
|
11
|
+
}
|
|
12
|
+
function r(t) {
|
|
13
|
+
return e(t) && t.version === 8 && typeof t.key == "string" && typeof t.tree == "string" && Array.isArray(t.files) && Array.isArray(t.variables) && Array.isArray(t.testFiles) && e(t.session) && e(t.phase) && e(t.phase.dry);
|
|
14
|
+
}
|
|
15
|
+
export { n as readDrySnapshot };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isRecord as e } from "../plugins/is-record.js";
|
|
2
2
|
import { readFile as t } from "node:fs/promises";
|
|
3
|
-
const n = /* @__PURE__ */ new Set([
|
|
3
|
+
const n = /* @__PURE__ */ new Set([
|
|
4
|
+
"Survived",
|
|
5
|
+
"Timeout",
|
|
6
|
+
"Killed"
|
|
7
|
+
]), r = /* @__PURE__ */ new Set(["isolated", "batch"]);
|
|
4
8
|
async function i(n) {
|
|
5
9
|
let r = {
|
|
6
10
|
entries: /* @__PURE__ */ new Map(),
|
|
@@ -11,7 +15,7 @@ async function i(n) {
|
|
|
11
15
|
} catch {
|
|
12
16
|
return r;
|
|
13
17
|
}
|
|
14
|
-
if (!e(i) || i.version !==
|
|
18
|
+
if (!e(i) || i.version !== 8 || !e(i.entries) || !e(i.inputs)) return r;
|
|
15
19
|
let o = Object.entries(i.inputs);
|
|
16
20
|
for (let [e, t] of o) s(t) && r.inputs.set(e, t);
|
|
17
21
|
let c = Object.entries(i.entries);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ProjectTree } from '../../types/cache/project-tree.js';
|
|
2
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
3
|
+
/**
|
|
4
|
+
* Saves the dry run of a run for later runs (`DrySnapshot`), or removes the
|
|
5
|
+
* saved one when the run cannot be replayed. Before saving, the files of the
|
|
6
|
+
* saved dry run and everything under the project root are hashed again: when
|
|
7
|
+
* any of them changed during the run, such as a test file added while mutants
|
|
8
|
+
* ran, which the dry run never saw, nothing is saved and the saved one is
|
|
9
|
+
* removed too, and the first path that changed is named, against the tree the
|
|
10
|
+
* run hashed before the test runner started. A tree that can no longer be read
|
|
11
|
+
* is not saved either, with nothing to name. The file is written to a temporary
|
|
12
|
+
* file and renamed, so a reader never sees half of it. Failures are ignored, as
|
|
13
|
+
* a saved dry run only ever makes a run faster.
|
|
14
|
+
*
|
|
15
|
+
* @param input - What to save, and where.
|
|
16
|
+
* @param input.snapshot - Saved dry run of the run (`createDrySnapshot`), or
|
|
17
|
+
* null when the run cannot be replayed.
|
|
18
|
+
* @param input.tree - Project tree the run hashed before the test runner
|
|
19
|
+
* started, or null when it could not be read.
|
|
20
|
+
* @param input.outputs - Absolute paths mootant writes into the project during
|
|
21
|
+
* or after a run, such as the HTML report and the work directory, which are
|
|
22
|
+
* left out.
|
|
23
|
+
* @param input.file - Absolute path of the file (`getDrySnapshotPath`).
|
|
24
|
+
* @param input.root - Project root.
|
|
25
|
+
* @returns Null, or the end of a sentence that names a path that changed during
|
|
26
|
+
* the run, such as `logs was added during the run`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function saveDrySnapshot(input: {
|
|
29
|
+
snapshot: DrySnapshot | null;
|
|
30
|
+
outputs: readonly string[];
|
|
31
|
+
tree: ProjectTree | null;
|
|
32
|
+
file: string;
|
|
33
|
+
root: string;
|
|
34
|
+
}): Promise<string | null>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getDisplayPath as e } from "../run/get-display-path.js";
|
|
2
|
+
import { compareCodeUnits as t } from "../compare-code-units.js";
|
|
3
|
+
import { hashProjectTree as n } from "./hash-project-tree.js";
|
|
4
|
+
import { hashFiles as r } from "./hash-files.js";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
import { mkdir as a, rename as o, rm as s, writeFile as c } from "node:fs/promises";
|
|
7
|
+
async function l(t) {
|
|
8
|
+
let { snapshot: i, tree: a, file: o, root: s } = t;
|
|
9
|
+
if (i === null || a === null) return await f(o), null;
|
|
10
|
+
let c = await r(i.files.map(([e]) => e)), l = i.files.find(([e, t]) => c.get(e) !== t);
|
|
11
|
+
if (l !== void 0) return await f(o), `${e(l[0], s)} changed during the run`;
|
|
12
|
+
let p = await n(s, t.outputs);
|
|
13
|
+
return p?.hash === a.hash ? (await d(i, o), null) : (await f(o), p === null ? null : u(a, p));
|
|
14
|
+
}
|
|
15
|
+
function u(e, n) {
|
|
16
|
+
let r = [.../* @__PURE__ */ new Set([...e.entries.keys(), ...n.entries.keys()])].toSorted(t).find((t) => e.entries.get(t) !== n.entries.get(t));
|
|
17
|
+
return e.entries.has(r) ? n.entries.has(r) ? `${r} changed during the run` : `${r} was removed during the run` : `${r} was added during the run`;
|
|
18
|
+
}
|
|
19
|
+
async function d(e, t) {
|
|
20
|
+
let n = `${t}.${process.pid}.tmp`;
|
|
21
|
+
try {
|
|
22
|
+
await a(i.dirname(t), { recursive: !0 }), await c(n, JSON.stringify(e)), await o(n, t);
|
|
23
|
+
} catch {
|
|
24
|
+
await f(n), await f(t);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function f(e) {
|
|
28
|
+
try {
|
|
29
|
+
await s(e, { force: !0 });
|
|
30
|
+
} catch {}
|
|
31
|
+
}
|
|
32
|
+
export { l as saveDrySnapshot };
|
|
@@ -5,13 +5,14 @@ import { RunCache } from '../../types/cache/run-cache.js';
|
|
|
5
5
|
* diagnostics or a file of the environment changed while it went on; evidence
|
|
6
6
|
* from a test file whose dependencies changed while the run went on is left
|
|
7
7
|
* out, since it may come from the old texts, and so is evidence whose run read
|
|
8
|
-
* a file beyond them that changed
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* they
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* a file beyond them that changed or whose content is unknown, such as a device
|
|
9
|
+
* or a pipe (`UNKNOWN_HASH`). A file modified during the run that was hashed
|
|
10
|
+
* for the keys counts as changed only when its content differs now, so tests
|
|
11
|
+
* that write back what they read, or add and remove files of a directory they
|
|
12
|
+
* list, keep their evidence; a file beyond the dependencies modified during the
|
|
13
|
+
* run has no earlier hash and counts as changed. The files evidence read beyond
|
|
14
|
+
* the dependencies of its test file are hashed now, and evidence that shares
|
|
15
|
+
* such inputs names one stored copy of them.
|
|
15
16
|
*
|
|
16
17
|
* @param input - Cache of the run, where to save it and what happened.
|
|
17
18
|
* @param input.cache - Lookups, entries and watched files of the run.
|
|
@@ -3,6 +3,7 @@ import { findChangedFiles as t } from "./find-changed-files.js";
|
|
|
3
3
|
import { getPortablePath as n } from "./get-portable-path.js";
|
|
4
4
|
import { writeRunCache as r } from "./write-run-cache.js";
|
|
5
5
|
import { createDigest as i } from "./create-digest.js";
|
|
6
|
+
import "./unknown-hash.js";
|
|
6
7
|
import { hashFiles as a } from "./hash-files.js";
|
|
7
8
|
async function o(o) {
|
|
8
9
|
let { started: s, cache: c, file: l, root: u } = o;
|
|
@@ -28,7 +29,7 @@ async function o(o) {
|
|
|
28
29
|
for (let [e, t] of c.dependencies) t.some((e) => p.has(e)) && c.forget(e);
|
|
29
30
|
let g = await a(f), _ = new Map(c.inputs);
|
|
30
31
|
for (let [e, t] of c.pending) {
|
|
31
|
-
if (t.files.some((e) => p.has(e))) {
|
|
32
|
+
if (t.files.some((e) => p.has(e) || g.get(e) === "unknown")) {
|
|
32
33
|
c.entries.delete(e);
|
|
33
34
|
continue;
|
|
34
35
|
}
|