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
|
@@ -1,40 +1,48 @@
|
|
|
1
1
|
import { installMutantRuntime as e } from "../../core/runtime/install-mutant-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
import { enableCompileCache as t } from "../shared/enable-compile-cache.js";
|
|
3
|
+
import { watchWorkerClose as n } from "./worker/watch-worker-close.js";
|
|
4
|
+
import { trackMetaDefines as r } from "./worker/track-meta-defines.js";
|
|
5
|
+
import { listDependencies as i } from "./worker/list-dependencies.js";
|
|
6
|
+
import { getErrorMessage as a } from "../shared/get-error-message.js";
|
|
7
|
+
import { VITEST_VARIABLES as o } from "./worker/vitest-variables.js";
|
|
8
|
+
import { interceptStrays as s } from "./worker/intercept-strays.js";
|
|
9
|
+
import { readWorkerPlan as c } from "./worker/read-worker-plan.js";
|
|
10
|
+
import { raceTryTimeout as l } from "./worker/race-try-timeout.js";
|
|
11
|
+
import { writeOutRecord as u } from "./worker/write-out-record.js";
|
|
12
|
+
import { installTryHook as d } from "./worker/install-try-hook.js";
|
|
13
|
+
import { writeHeartbeat as f } from "./worker/write-heartbeat.js";
|
|
14
|
+
import { findHookError as p } from "./worker/find-hook-error.js";
|
|
15
|
+
import { getHookBudget as m } from "./worker/get-hook-budget.js";
|
|
16
|
+
import { VALUE_PREFIXES as h } from "./worker/value-prefixes.js";
|
|
17
|
+
import { readTryFacts as g } from "./worker/read-try-facts.js";
|
|
18
|
+
import { captureClock as _ } from "../shared/capture-clock.js";
|
|
19
|
+
import { trackInputs as v } from "../shared/track-inputs.js";
|
|
20
|
+
import { getFileHash as y } from "./worker/get-file-hash.js";
|
|
21
|
+
import { waitForTurn as b } from "./worker/wait-for-turn.js";
|
|
22
|
+
import { trackValues as x } from "./worker/track-values.js";
|
|
23
|
+
import { encodeStray as S } from "./worker/encode-stray.js";
|
|
24
|
+
import { orderTests as C } from "./worker/order-tests.js";
|
|
25
|
+
import { claimUnit as w } from "./worker/claim-unit.js";
|
|
26
|
+
import { listTests as T } from "./worker/list-tests.js";
|
|
27
|
+
import * as E from "node:module";
|
|
28
|
+
import { closeSync as D, openSync as O, rmSync as k, writeFileSync as A } from "node:fs";
|
|
29
|
+
import j from "node:path";
|
|
30
|
+
import { createHash as M } from "node:crypto";
|
|
31
|
+
import { builtinEnvironments as N } from "vitest/runtime";
|
|
32
|
+
import { TestRunner as P } from "vitest";
|
|
33
|
+
const F = 2 ** 31 - 1;
|
|
34
|
+
let I = _(), L = Date.now.bind(Date);
|
|
35
|
+
var R = class extends P {
|
|
30
36
|
coverSink = { add: (e) => {
|
|
31
37
|
for (let t of this.activeCovers) t.add(e);
|
|
32
38
|
} };
|
|
33
39
|
runtime = e();
|
|
34
40
|
records = /* @__PURE__ */ new Map();
|
|
41
|
+
scripted;
|
|
35
42
|
hookBudgets = /* @__PURE__ */ new Map();
|
|
36
43
|
planned = /* @__PURE__ */ new Map();
|
|
37
44
|
loadCovers = /* @__PURE__ */ new Set();
|
|
45
|
+
loadStrays = [];
|
|
38
46
|
inside = {
|
|
39
47
|
hits: 0,
|
|
40
48
|
from: 0
|
|
@@ -44,8 +52,8 @@ var M = class extends O {
|
|
|
44
52
|
beatDescriptor = null;
|
|
45
53
|
inputs = null;
|
|
46
54
|
killed = /* @__PURE__ */ new Set();
|
|
55
|
+
values = /* @__PURE__ */ new Set();
|
|
47
56
|
runnable = null;
|
|
48
|
-
loadStrays = [];
|
|
49
57
|
activeCovers = [];
|
|
50
58
|
lastMutant = null;
|
|
51
59
|
hookError = null;
|
|
@@ -65,6 +73,7 @@ var M = class extends O {
|
|
|
65
73
|
outsideHits = 0;
|
|
66
74
|
bailed = !1;
|
|
67
75
|
beatLength = 0;
|
|
76
|
+
strayCount = 0;
|
|
68
77
|
unitIndex = 0;
|
|
69
78
|
outName = "";
|
|
70
79
|
sequence = 0;
|
|
@@ -74,41 +83,49 @@ var M = class extends O {
|
|
|
74
83
|
file = "";
|
|
75
84
|
constructor(e) {
|
|
76
85
|
super(e), this.options = this.injectValue("mootant");
|
|
77
|
-
let { directory:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
let { directory: r, repeat: i, mode: o } = this.options;
|
|
87
|
+
t(E, r), this.scripted = this.options.defines?.[e.name ?? ""] ?? {}, x(Reflect.get(this, "workerState"), {
|
|
88
|
+
snapshotEnvironment: e.snapshotEnvironment,
|
|
89
|
+
scripted: this.scripted,
|
|
90
|
+
defines: e.defines
|
|
91
|
+
}, (e) => {
|
|
92
|
+
this.values.add(e);
|
|
93
|
+
}), this.sequential = o === "batch" || o === "dry" && i, o === "dry" && (this.config.includeTaskLocation = !0), this.beatFile = j.join(r, "beat", `${process.pid}.json`), D(O(j.join(r, "worker", String(process.pid)), "w")), s(Reflect.get(this, "workerState"), (e, t) => {
|
|
94
|
+
this.onStray(e, t);
|
|
95
|
+
});
|
|
96
|
+
let c = this.onCleanupWorkerContext;
|
|
97
|
+
if (c !== void 0) {
|
|
98
|
+
let e = Reflect.get(this, "workerState"), t = n(Reflect.get(e.ctx, "traces"));
|
|
82
99
|
this.onCleanupWorkerContext = (e) => {
|
|
83
|
-
this.endsInTeardown = !0,
|
|
84
|
-
e !== null && (this.hookError ??=
|
|
85
|
-
})),
|
|
100
|
+
this.endsInTeardown = !0, t !== null && (this.endsOnClose = !0, t((e) => {
|
|
101
|
+
e !== null && (this.hookError ??= a(e.error)), this.finishUnit();
|
|
102
|
+
})), c(() => this.tearDown(e));
|
|
86
103
|
};
|
|
87
104
|
}
|
|
88
105
|
}
|
|
89
106
|
async onBeforeCollect(e) {
|
|
90
107
|
let { runtime: t, options: n } = this, r = e[0];
|
|
91
|
-
this.file = r, this.started =
|
|
92
|
-
let i =
|
|
108
|
+
this.file = r, this.started = I.now(), this.booted = L(), t.hitLimit = Infinity, t.coverage = null, t.reached = !1, t.active = null, t.hits = 0;
|
|
109
|
+
let i = y(r, this.config.name ?? ""), a = j.join(n.directory, "out");
|
|
93
110
|
if (n.mode === "dry") {
|
|
94
|
-
t.coverage = this.loadCovers, this.outName = `${i}-${process.pid}`, this.out =
|
|
111
|
+
t.coverage = this.loadCovers, this.outName = `${i}-${process.pid}`, this.out = O(j.join(a, `${this.outName}.jsonl`), "a"), this.beat(n.timeouts.file, null), this.startTracking(!0);
|
|
95
112
|
return;
|
|
96
113
|
}
|
|
97
|
-
let
|
|
98
|
-
if (
|
|
114
|
+
let o = c(n.directory, i), s = o === null ? null : w(n.directory, i, o.units.length);
|
|
115
|
+
if (s === null) {
|
|
99
116
|
this.runnable = /* @__PURE__ */ new Set();
|
|
100
117
|
return;
|
|
101
118
|
}
|
|
102
|
-
await
|
|
103
|
-
index:
|
|
119
|
+
(n.parallel !== !0 || n.mode !== "isolated") && await b(n.directory, {
|
|
120
|
+
index: s,
|
|
104
121
|
hash: i
|
|
105
|
-
},
|
|
122
|
+
}, I), this.started = I.now(), this.unitIndex = o.indexes[s], this.outName = `${i}-${s}`, this.out = O(j.join(a, `${this.outName}.jsonl`), "a");
|
|
106
123
|
let l = this.config.hookTimeout > 0 ? this.config.hookTimeout : Infinity;
|
|
107
124
|
if (n.mode === "isolated") {
|
|
108
|
-
let e =
|
|
125
|
+
let e = o.units[s];
|
|
109
126
|
t.active = e.mutant, t.hitLimit = e.limits.hitLimit, this.budget = e.limits.timeout, this.config.hookTimeout = Math.min(l, e.limits.timeout);
|
|
110
127
|
} else {
|
|
111
|
-
let e =
|
|
128
|
+
let e = o.units[s];
|
|
112
129
|
this.batch = e;
|
|
113
130
|
for (let t of e.tests) this.planned.set(t.id, t);
|
|
114
131
|
t.hitLimit = e.limits.load.hitLimit, this.budget = e.limits.total, this.config.hookTimeout = Math.min(l, e.tests.reduce((e, t) => Math.max(e, t.timeout), e.limits.load.timeout));
|
|
@@ -116,19 +133,19 @@ var M = class extends O {
|
|
|
116
133
|
this.beat(this.budget, null), this.startTracking(!1);
|
|
117
134
|
}
|
|
118
135
|
onCollected(e) {
|
|
119
|
-
this.loadDuration =
|
|
136
|
+
this.loadDuration = I.now() - this.started;
|
|
120
137
|
let { options: t } = this;
|
|
121
138
|
for (let n of e) {
|
|
122
139
|
if (t.mode === "dry") {
|
|
123
140
|
let { hookTimeout: e } = this.config;
|
|
124
|
-
for (let t of
|
|
125
|
-
this.outsideBudget = t.timeouts.file +
|
|
141
|
+
for (let t of T(n)) this.hookBudgets.set(t.id, m(t, e));
|
|
142
|
+
this.outsideBudget = t.timeouts.file + m(n, e), this.beat(this.outsideBudget, null);
|
|
126
143
|
}
|
|
127
|
-
this.concurrent =
|
|
144
|
+
this.concurrent = C(n, this.sequential) || this.concurrent, d(n, (e, t) => this.aroundTry(e, t)), n.result?.state === "fail" && (this.loadError ??= a(n.result.errors?.[0]));
|
|
128
145
|
}
|
|
129
146
|
if (this.batch === null || this.runnable !== null) return;
|
|
130
|
-
let n = e.flatMap((e) =>
|
|
131
|
-
this.runnable = new Set(n.slice(0,
|
|
147
|
+
let n = e.flatMap((e) => T(e)), r = n.findLastIndex((e) => this.planned.has(e.id));
|
|
148
|
+
this.runnable = new Set(n.slice(0, r + 1).map((e) => e.id));
|
|
132
149
|
}
|
|
133
150
|
async onBeforeRunTask(e) {
|
|
134
151
|
if (this.finishEnded(), await super.onBeforeRunTask(e), e.mode !== "run" || e.type !== "test") return;
|
|
@@ -147,15 +164,17 @@ var M = class extends O {
|
|
|
147
164
|
test: e
|
|
148
165
|
});
|
|
149
166
|
}
|
|
150
|
-
onStray(e) {
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
|
|
167
|
+
onStray(e, t) {
|
|
168
|
+
let n = S(e, t, this.strayCount);
|
|
169
|
+
this.strayCount += 1;
|
|
170
|
+
let r = this.listActive();
|
|
171
|
+
if (r.length > 0) for (let e of r) e.strays.push(n);
|
|
172
|
+
else this.options.mode === "batch" && this.lastTest !== null && this.out !== null ? u(this.out, {
|
|
154
173
|
mutant: this.lastMutant,
|
|
155
174
|
test: this.lastTest,
|
|
156
175
|
kind: "late",
|
|
157
|
-
|
|
158
|
-
}) : this.loadStrays.push(
|
|
176
|
+
stray: n
|
|
177
|
+
}) : this.loadStrays.push(n);
|
|
159
178
|
}
|
|
160
179
|
async onAfterRunSuite(e) {
|
|
161
180
|
if (this.finishEnded(), e.file === e && this.inputs !== null) {
|
|
@@ -167,21 +186,21 @@ var M = class extends O {
|
|
|
167
186
|
async runTask(e) {
|
|
168
187
|
let t = this.records.get(e)?.current ?? null;
|
|
169
188
|
t === null && e.context.skip();
|
|
170
|
-
let n =
|
|
171
|
-
r === null ? await n() : t.timedOut = await
|
|
189
|
+
let n = P.getTestFn(e), { deadline: r } = t;
|
|
190
|
+
r === null ? await n() : t.timedOut = await l(n, Math.max(0, r - I.now()), I);
|
|
172
191
|
}
|
|
173
192
|
onAfterRunFiles(e) {
|
|
174
193
|
for (let e of this.records.values()) this.finishTest(e);
|
|
175
|
-
if (this.loadError === null) for (let t of e) this.hookError ??=
|
|
194
|
+
if (this.loadError === null) for (let t of e) this.hookError ??= p(t);
|
|
176
195
|
this.filesEnded = !0, this.endsInTeardown || this.finishUnit(), super.onAfterRunFiles(e);
|
|
177
196
|
}
|
|
197
|
+
async onAfterRetryTask(e, t) {
|
|
198
|
+
let n = this.records.get(e)?.current;
|
|
199
|
+
n && (n.state = e.result.state), await super.onAfterRetryTask?.(e, t);
|
|
200
|
+
}
|
|
178
201
|
async onBeforeRunSuite(e) {
|
|
179
202
|
this.finishEnded(), this.bailed && (e.mode = "skip"), await super.onBeforeRunSuite(e);
|
|
180
203
|
}
|
|
181
|
-
onAfterRetryTask(e) {
|
|
182
|
-
let t = this.records.get(e)?.current;
|
|
183
|
-
t && (t.state = e.result.state);
|
|
184
|
-
}
|
|
185
204
|
onAfterRunTask(e) {
|
|
186
205
|
this.finishTest(this.records.get(e)), super.onAfterRunTask(e);
|
|
187
206
|
}
|
|
@@ -189,7 +208,7 @@ var M = class extends O {
|
|
|
189
208
|
if (this.finishTry(e), this.abandoned) return;
|
|
190
209
|
let { runtime: t } = this, { mode: n } = this.options, { test: r } = e, i = e.next;
|
|
191
210
|
e.next += 1;
|
|
192
|
-
let a =
|
|
211
|
+
let a = I.now(), o = {
|
|
193
212
|
attempt: r.result.errors?.length ?? 0,
|
|
194
213
|
covers: n === "dry" ? /* @__PURE__ */ new Set() : null,
|
|
195
214
|
retries: r.result.retryCount ?? 0,
|
|
@@ -214,10 +233,10 @@ var M = class extends O {
|
|
|
214
233
|
finishTry(e) {
|
|
215
234
|
let { current: t } = e;
|
|
216
235
|
if (t === null) return;
|
|
217
|
-
e.current = null,
|
|
218
|
-
let { runtime: n } = this, { mode: r } = this.options, { test: i } = t, a =
|
|
236
|
+
e.current = null, z(t);
|
|
237
|
+
let { runtime: n } = this, { mode: r } = this.options, { test: i } = t, a = g(i, n, {
|
|
219
238
|
covers: t.covers === null ? null : [...t.covers].toSorted(),
|
|
220
|
-
duration:
|
|
239
|
+
duration: I.now() - t.started,
|
|
221
240
|
hits: n.hits - t.hits,
|
|
222
241
|
timedOut: t.timedOut,
|
|
223
242
|
strays: t.strays,
|
|
@@ -232,9 +251,9 @@ var M = class extends O {
|
|
|
232
251
|
let { hits: n } = e;
|
|
233
252
|
t === "batch" ? n += this.outsideHits : t === "dry" && (n -= this.inside.hits);
|
|
234
253
|
let { dependencies: r, ...i } = this.stopTracking();
|
|
235
|
-
|
|
254
|
+
u(this.out, {
|
|
236
255
|
covers: [...this.loadCovers].toSorted(),
|
|
237
|
-
duration:
|
|
256
|
+
duration: I.now() - this.started,
|
|
238
257
|
loadDuration: this.loadDuration,
|
|
239
258
|
environment: i.environment,
|
|
240
259
|
concurrent: this.concurrent,
|
|
@@ -249,49 +268,63 @@ var M = class extends O {
|
|
|
249
268
|
dependencies: r,
|
|
250
269
|
kind: "end",
|
|
251
270
|
hits: n
|
|
252
|
-
}),
|
|
271
|
+
}), D(O(j.join(this.options.directory, "done", this.outName), "w"));
|
|
253
272
|
}
|
|
254
|
-
this.beatDescriptor !== null && (
|
|
273
|
+
this.beatDescriptor !== null && (D(this.beatDescriptor), this.beatDescriptor = null), k(this.beatFile, { force: !0 }), e.hitLimit = Infinity, e.coverage = null, e.active = null;
|
|
255
274
|
}
|
|
256
275
|
async aroundTry(e, t) {
|
|
257
276
|
let n = this.records.get(e), { current: r } = n, i = e.result.retryCount ?? 0;
|
|
258
|
-
if (r === null || r.timedOut ? this.startTry(n) : i > r.retries ? (r.attempt = e.result.errors.length, r.state = void 0, r.retries = i) : r.repetitions + 1 === n.group ? this.startTry(n) :
|
|
259
|
-
let t = e.timeout > 0 ? e.timeout : Infinity, r =
|
|
277
|
+
if (r === null || r.timedOut ? this.startTry(n) : i > r.retries ? (r.attempt = e.result.errors.length, r.state = void 0, r.retries = i) : r.repetitions + 1 === n.group ? this.startTry(n) : z(r), this.options.mode === "dry") {
|
|
278
|
+
let t = e.timeout > 0 ? e.timeout : Infinity, r = I.now();
|
|
260
279
|
n.current.watch = r + this.options.timeouts.test + t + this.hookBudgets.get(e.id), this.beatDry(r);
|
|
261
280
|
}
|
|
262
281
|
await t(), await new Promise((e) => {
|
|
263
|
-
|
|
282
|
+
I.setImmediate(e);
|
|
264
283
|
});
|
|
265
284
|
}
|
|
266
285
|
startTracking(e) {
|
|
267
|
-
let { directory: t, root: n } = this.options, r =
|
|
286
|
+
let { directory: t, root: n } = this.options, r = v({
|
|
287
|
+
directory: t,
|
|
288
|
+
root: n
|
|
289
|
+
}, {
|
|
268
290
|
holder: Reflect.get(this, "workerState"),
|
|
269
|
-
ignored:
|
|
291
|
+
ignored: o
|
|
270
292
|
});
|
|
271
|
-
if (this.inputs = r, e) {
|
|
293
|
+
if (this.inputs = r, this.trackMeta(), e) {
|
|
272
294
|
let e = {};
|
|
273
|
-
for (let [t, n = ""] of Object.entries(r.real)) e[t] =
|
|
295
|
+
for (let [t, n = ""] of Object.entries(r.real)) e[t] = M("sha256").update(n).digest("hex");
|
|
274
296
|
try {
|
|
275
|
-
|
|
297
|
+
A(j.join(t, "env", `${y("", this.config.name ?? "")}.json`), JSON.stringify({
|
|
276
298
|
project: this.config.name ?? "",
|
|
277
299
|
variables: e
|
|
278
300
|
}), { flag: "wx" });
|
|
279
301
|
} catch {}
|
|
280
302
|
}
|
|
281
303
|
}
|
|
304
|
+
trackMeta() {
|
|
305
|
+
let e = Object.keys(this.scripted).filter((e) => e.startsWith("import.meta.") && !this.scripted[e]);
|
|
306
|
+
if (e.length === 0) return;
|
|
307
|
+
let { snapshotSerializers: t, snapshotEnvironment: n, diff: i } = this.config;
|
|
308
|
+
if (n !== void 0 || typeof i == "string" || t.length > 0 || !r(Reflect.get(this, "workerState"), Reflect.get(this, "moduleRunner"), {
|
|
309
|
+
record: (e) => {
|
|
310
|
+
this.values.add(e);
|
|
311
|
+
},
|
|
312
|
+
keys: e
|
|
313
|
+
})) for (let t of e) this.values.add(`${h.define}${t}`);
|
|
314
|
+
}
|
|
282
315
|
stopTracking() {
|
|
283
316
|
let e = /* @__PURE__ */ new Set([...this.dependencies ?? [], ...this.listDependencies(void 0)]), { environment: t, modified: n } = this.inputs.stop();
|
|
284
317
|
this.inputs = null;
|
|
285
318
|
let r = Reflect.get(this, "workerState"), i = [...e].toSorted();
|
|
286
319
|
return {
|
|
287
|
-
dependencies: Object.hasOwn(
|
|
288
|
-
environment: t,
|
|
320
|
+
dependencies: Object.hasOwn(N, r.ctx.environment.name) ? i : null,
|
|
321
|
+
environment: [...t, ...this.values].toSorted(),
|
|
289
322
|
modified: n
|
|
290
323
|
};
|
|
291
324
|
}
|
|
292
325
|
beat(e, t) {
|
|
293
|
-
this.sequence += 1, this.beatDescriptor ??=
|
|
294
|
-
budget: Math.min(Math.max(0, e),
|
|
326
|
+
this.sequence += 1, this.beatDescriptor ??= O(this.beatFile, "w"), this.beatLength = f(this.beatDescriptor, {
|
|
327
|
+
budget: Math.min(Math.max(0, e), F) + 1e3,
|
|
295
328
|
name: t?.fullTestName ?? null,
|
|
296
329
|
mutant: this.runtime.active,
|
|
297
330
|
sequence: this.sequence,
|
|
@@ -304,12 +337,12 @@ var M = class extends O {
|
|
|
304
337
|
finishTest(e) {
|
|
305
338
|
this.finishTry(e);
|
|
306
339
|
let { test: t } = e;
|
|
307
|
-
this.records.delete(t),
|
|
340
|
+
this.records.delete(t), u(this.out, {
|
|
308
341
|
line: t.location?.line ?? null,
|
|
309
342
|
name: t.fullTestName,
|
|
310
343
|
tries: e.tries,
|
|
311
344
|
kind: "test"
|
|
312
|
-
}), delete t.result.errors, this.options.mode === "dry" ? this.beatDry() : this.beat(this.budget - (
|
|
345
|
+
}), delete t.result.errors, this.options.mode === "dry" ? this.beatDry() : this.beat(this.budget - (I.now() - this.started), null);
|
|
313
346
|
}
|
|
314
347
|
routeCoverage() {
|
|
315
348
|
let { runtime: e } = this;
|
|
@@ -317,19 +350,19 @@ var M = class extends O {
|
|
|
317
350
|
let [t] = this.activeCovers;
|
|
318
351
|
e.coverage = t === void 0 ? this.loadCovers : this.activeCovers.length === 1 ? t : this.coverSink;
|
|
319
352
|
}
|
|
320
|
-
beatDry(e =
|
|
353
|
+
beatDry(e = I.now()) {
|
|
321
354
|
let t = null;
|
|
322
355
|
for (let e of this.listActive()) (t === null || e.watch > t.watch) && (t = e);
|
|
323
356
|
t === null ? this.beat(this.outsideBudget, null) : this.beat(t.watch - e, t.test);
|
|
324
357
|
}
|
|
325
358
|
listDependencies(e) {
|
|
326
|
-
return
|
|
359
|
+
return i(Reflect.get(this, "workerState"), [...Object.keys(E.createRequire(import.meta.url).cache), ...this.inputs.files], e);
|
|
327
360
|
}
|
|
328
361
|
async tearDown(e) {
|
|
329
362
|
try {
|
|
330
363
|
await e();
|
|
331
364
|
} catch (e) {
|
|
332
|
-
throw this.hookError ??=
|
|
365
|
+
throw this.hookError ??= a(e), e;
|
|
333
366
|
} finally {
|
|
334
367
|
this.endsOnClose || this.finishUnit();
|
|
335
368
|
}
|
|
@@ -343,19 +376,8 @@ var M = class extends O {
|
|
|
343
376
|
for (let e of this.records.values()) (this.sequential || e.test.mode === "skip") && this.finishTest(e);
|
|
344
377
|
}
|
|
345
378
|
};
|
|
346
|
-
function
|
|
347
|
-
let t = Reflect.get(globalThis, A);
|
|
348
|
-
if (t === void 0) {
|
|
349
|
-
let n = { current: e };
|
|
350
|
-
function r(e) {
|
|
351
|
-
n.current.onStray(e);
|
|
352
|
-
}
|
|
353
|
-
process.on("unhandledRejection", r), process.on("uncaughtException", r), Reflect.set(globalThis, A, n), t = n;
|
|
354
|
-
}
|
|
355
|
-
t.current = e;
|
|
356
|
-
}
|
|
357
|
-
function P(e) {
|
|
379
|
+
function z(e) {
|
|
358
380
|
let t = e.test.result.errors ?? [];
|
|
359
381
|
e.errors.push(...t.slice(e.attempt)), (e.state === "fail" || e.state === "skip") && (e.outcome = e.state), e.repetitions += 1, e.attempt = t.length, e.state = void 0;
|
|
360
382
|
}
|
|
361
|
-
export {
|
|
383
|
+
export { R as default };
|
|
@@ -10,7 +10,11 @@ import { AdapterContext } from '../../types/adapter/adapter-context.js';
|
|
|
10
10
|
* context's `onOutput` when there is one. Its sequencer spreads out the units
|
|
11
11
|
* of one test file (`createInterleavedSequencer`). The mutant runtime of this
|
|
12
12
|
* process records the mutant sites switched code evaluates here, outside the
|
|
13
|
-
* workers, such as in a `globalSetup` file, until the session closes.
|
|
13
|
+
* workers, such as in a `globalSetup` file, until the session closes. The
|
|
14
|
+
* listeners of SIGINT and SIGTERM that Vitest adds as it starts are dropped
|
|
15
|
+
* (`dropSignalListeners`), and once the run is interrupted the pool stops its
|
|
16
|
+
* workers and starts none (`MootantForksPool.interrupt`), so an interrupted run
|
|
17
|
+
* closes Vitest, which removes its temporary files, before the process ends.
|
|
14
18
|
*
|
|
15
19
|
* @param context - Switched files, work directory, concurrency and root.
|
|
16
20
|
* @param options - Options of the adapter.
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { installMutantRuntime as e } from "../../core/runtime/install-mutant-runtime.js";
|
|
2
2
|
import { createInterleavedSequencer as t } from "./create-interleaved-sequencer.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import p from "
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let y =
|
|
20
|
-
if (
|
|
21
|
-
let
|
|
22
|
-
|
|
3
|
+
import { readPreforkSwitch as n } from "../shared/read-prefork-switch.js";
|
|
4
|
+
import { createOutputReporter as r } from "./create-output-reporter.js";
|
|
5
|
+
import { dropSignalListeners as i } from "./drop-signal-listeners.js";
|
|
6
|
+
import { createMootantPlugin as a } from "./create-mootant-plugin.js";
|
|
7
|
+
import { createOutputStream as o } from "./create-output-stream.js";
|
|
8
|
+
import { createForksPool as s } from "./create-forks-pool.js";
|
|
9
|
+
import { checkVitestCopy as c } from "./check-vitest-copy.js";
|
|
10
|
+
import { getCacheInputs as l } from "./get-cache-inputs.js";
|
|
11
|
+
import { getRunnerPath as u } from "./get-runner-path.js";
|
|
12
|
+
import { detectVitest as d } from "./detect-vitest.js";
|
|
13
|
+
import { runIsolated as f } from "./run-isolated.js";
|
|
14
|
+
import { runBatch as p } from "./run-batch.js";
|
|
15
|
+
import { runDry as m } from "./run-dry.js";
|
|
16
|
+
import h from "node:path";
|
|
17
|
+
import { pathToFileURL as g } from "node:url";
|
|
18
|
+
async function _(_, v) {
|
|
19
|
+
let { root: y } = _, b = n(), x = await d(y);
|
|
20
|
+
if (!x.available) throw Error(x.version === null ? `Vitest is not installed in ${y}.` : `mootant runs Vitest 5, but ${y} has Vitest ${x.version}.`);
|
|
21
|
+
let S = u(), C = c(y, S);
|
|
22
|
+
if (C !== null) throw Error(C);
|
|
23
|
+
let w = await import(g(x.node).href), T = /* @__PURE__ */ new Map(), E = {
|
|
24
|
+
pool: s(w.ForksPoolWorker, T, b),
|
|
23
25
|
mismatched: /* @__PURE__ */ new Set(),
|
|
24
26
|
instrumented: !0,
|
|
25
27
|
outside: /* @__PURE__ */ new Set(),
|
|
@@ -29,60 +31,63 @@ async function h(h, g) {
|
|
|
29
31
|
diagnostics: [],
|
|
30
32
|
error: null,
|
|
31
33
|
files: null,
|
|
32
|
-
runnerPath:
|
|
33
|
-
spawns:
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
runnerPath: S,
|
|
35
|
+
spawns: T
|
|
36
|
+
};
|
|
37
|
+
_.signal?.addEventListener("abort", () => {
|
|
38
|
+
E.pool.interrupt();
|
|
39
|
+
}, { once: !0 });
|
|
40
|
+
let { onOutput: D } = _, O = null, k = await i(() => w.createVitest({
|
|
41
|
+
...v.config !== void 0 && { config: h.resolve(y, v.config) },
|
|
42
|
+
..._.concurrency !== null && { maxWorkers: _.concurrency },
|
|
43
|
+
reporters: D === void 0 ? [] : [r(D, () => O)],
|
|
38
44
|
coverage: { enabled: !1 },
|
|
39
|
-
includeTaskLocation: !0,
|
|
40
45
|
passWithNoTests: !0,
|
|
41
46
|
fsModuleCache: !1,
|
|
42
47
|
watch: !1,
|
|
43
48
|
cache: !1,
|
|
44
49
|
bail: 0,
|
|
45
|
-
root:
|
|
46
|
-
}, { plugins: [
|
|
47
|
-
stderr:
|
|
48
|
-
stdout:
|
|
49
|
-
});
|
|
50
|
-
if (
|
|
51
|
-
if ((await
|
|
52
|
-
await
|
|
53
|
-
let e = new Set(
|
|
50
|
+
root: y
|
|
51
|
+
}, { plugins: [a(_, E)] }, D === void 0 ? {} : {
|
|
52
|
+
stderr: o((e) => D(e, null)),
|
|
53
|
+
stdout: o((e) => D(e, null))
|
|
54
|
+
}));
|
|
55
|
+
if (O = k, E.error !== null) throw await k.close(), Error(E.error);
|
|
56
|
+
if ((await k.globTestSpecifications()).length === 0) {
|
|
57
|
+
await k.close();
|
|
58
|
+
let e = new Set(k.projects.flatMap((e) => e.config.include));
|
|
54
59
|
throw Error(`No test files match the include patterns of Vitest (${[...e].map((e) => `"${e}"`).join(", ")}); set vitestAdapter({ config }) or fix the patterns.`);
|
|
55
60
|
}
|
|
56
|
-
let { sequence:
|
|
57
|
-
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
context:
|
|
62
|
-
vitest:
|
|
63
|
-
state:
|
|
64
|
-
},
|
|
65
|
-
async function
|
|
61
|
+
let { sequence: A } = k.config;
|
|
62
|
+
A.sequencer = t(A.sequencer);
|
|
63
|
+
let j = e(), { coverage: M } = j;
|
|
64
|
+
j.coverage = E.outside;
|
|
65
|
+
let N = {
|
|
66
|
+
context: _,
|
|
67
|
+
vitest: k,
|
|
68
|
+
state: E
|
|
69
|
+
}, P = null;
|
|
70
|
+
async function F() {
|
|
66
71
|
try {
|
|
67
|
-
await E.close();
|
|
72
|
+
await E.pool.drain(), await k.close();
|
|
68
73
|
} finally {
|
|
69
|
-
|
|
74
|
+
j.coverage === E.outside && (j.coverage = M);
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
return {
|
|
73
78
|
listTestFiles: async () => {
|
|
74
|
-
let e = new Set((await
|
|
75
|
-
for (let t of
|
|
79
|
+
let e = new Set((await k.globTestSpecifications()).map(({ moduleId: e }) => e));
|
|
80
|
+
for (let t of k.projects) for (let n of [...t.config.setupFiles, ...t.config.globalSetup]) e.add(n);
|
|
76
81
|
return [...e];
|
|
77
82
|
},
|
|
78
|
-
cacheInputs: () => Promise.resolve(
|
|
79
|
-
close: () => (
|
|
80
|
-
runIsolated: (e) =>
|
|
81
|
-
dryRun: (e) =>
|
|
82
|
-
runBatch: (e) =>
|
|
83
|
-
workers:
|
|
84
|
-
diagnostics:
|
|
85
|
-
version:
|
|
83
|
+
cacheInputs: () => Promise.resolve(l(k, E.environment)),
|
|
84
|
+
close: () => (P ??= F(), P),
|
|
85
|
+
runIsolated: (e) => f(N, e),
|
|
86
|
+
dryRun: (e) => m(N, e),
|
|
87
|
+
runBatch: (e) => p(N, e),
|
|
88
|
+
workers: k.config.maxWorkers,
|
|
89
|
+
diagnostics: E.diagnostics,
|
|
90
|
+
version: k.version
|
|
86
91
|
};
|
|
87
92
|
}
|
|
88
|
-
export {
|
|
93
|
+
export { _ as startVitestSession };
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { MootantForksPool } from './types/mootant-forks-pool.js';
|
|
1
2
|
/**
|
|
2
|
-
* Stops a hung worker process with `SIGKILL
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Stops a hung worker process with `SIGKILL`. The pool stops it through the
|
|
4
|
+
* process of its worker, which cannot stand for another process, and leaves a
|
|
5
|
+
* process id that is none of its workers (`MootantForksPool.stopWorker`).
|
|
6
|
+
* Should Vitest stop exposing the processes of its workers, the process is
|
|
7
|
+
* stopped by its id, but only when it is still alive and, outside Windows, a
|
|
8
|
+
* child of this process, as a process id may have been reused by an unrelated
|
|
9
|
+
* process: the parent comes from `/proc/<pid>/stat` where Linux provides it,
|
|
10
|
+
* else from `ps`. A process whose parent neither tells is left.
|
|
5
11
|
*
|
|
6
12
|
* @param pid - Process id of the worker.
|
|
13
|
+
* @param pool - Pool of the session.
|
|
7
14
|
* @returns Whether the worker was stopped.
|
|
8
15
|
* @throws {Error} When the signal fails for another reason than a process that
|
|
9
16
|
* is gone.
|
|
10
17
|
*/
|
|
11
|
-
export declare function stopHungWorker(pid: number): Promise<boolean>;
|
|
18
|
+
export declare function stopHungWorker(pid: number, pool: Pick<MootantForksPool, 'stopWorker'>): Promise<boolean>;
|