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
|
@@ -18,7 +18,7 @@ async function f(e, n) {
|
|
|
18
18
|
let i = await m(e, n);
|
|
19
19
|
a(r.workDirectory);
|
|
20
20
|
let s = [], f = c(r.workDirectory, async (e) => {
|
|
21
|
-
await l(e.pid) && s.push(e);
|
|
21
|
+
await l(e.pid, d.pool) && s.push(e);
|
|
22
22
|
}), { onUnitEnd: h } = r, g = u(r.workDirectory, h === void 0 ? void 0 : (() => {
|
|
23
23
|
h();
|
|
24
24
|
})), _;
|
|
@@ -44,17 +44,17 @@ async function f(e, n) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
async function p(t, i, a) {
|
|
47
|
-
let { context: o,
|
|
47
|
+
let { context: o, vitest: c, state: l } = t, u = [...l.mismatched].toSorted(n), f = [...l.outside].toSorted(n), p = [...l.served].toSorted(n), m = /* @__PURE__ */ new Map(), g = new Map(i.map(({ moduleId: e, project: t }) => [s(e, t.name), {
|
|
48
48
|
project: t.name,
|
|
49
49
|
source: t,
|
|
50
50
|
file: e
|
|
51
|
-
}])),
|
|
52
|
-
for (let [e, t] of
|
|
53
|
-
let n = e.split("-", 1)[0], { project: r, source: i, file: o } =
|
|
54
|
-
|
|
51
|
+
}])), _ = /* @__PURE__ */ new Set(), v = [], y = [], b = [], x = d(c, o.workDirectory, /* @__PURE__ */ new Map());
|
|
52
|
+
for (let [e, t] of x) {
|
|
53
|
+
let n = e.split("-", 1)[0], { project: r, source: i, file: o } = g.get(n), s = !1, c = 0;
|
|
54
|
+
_.add(n);
|
|
55
55
|
for (let e of t) if (e.kind === "test") {
|
|
56
56
|
for (let t of e.tries) c += t.duration;
|
|
57
|
-
|
|
57
|
+
b.push({
|
|
58
58
|
id: e.tries[0].test,
|
|
59
59
|
tries: e.tries,
|
|
60
60
|
line: e.line,
|
|
@@ -81,28 +81,28 @@ async function p(t, i, a) {
|
|
|
81
81
|
project: r,
|
|
82
82
|
file: o
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
y.push(t), v.push([t, {
|
|
85
85
|
reported: e.dependencies,
|
|
86
86
|
project: i,
|
|
87
|
-
tsconfigs:
|
|
87
|
+
tsconfigs: m,
|
|
88
88
|
file: o
|
|
89
89
|
}]);
|
|
90
90
|
}
|
|
91
|
-
s ||
|
|
91
|
+
s || y.push(h({
|
|
92
92
|
project: r,
|
|
93
93
|
file: o
|
|
94
94
|
}, a));
|
|
95
95
|
}
|
|
96
|
-
await Promise.all(
|
|
96
|
+
await Promise.all(v.map(async ([e, t]) => {
|
|
97
97
|
e.dependencies = await r(t);
|
|
98
98
|
}));
|
|
99
|
-
for (let [e, t] of
|
|
99
|
+
for (let [e, t] of g) _.has(e) || y.push(h(t, a));
|
|
100
100
|
return {
|
|
101
|
-
tests:
|
|
102
|
-
files:
|
|
103
|
-
mismatched:
|
|
104
|
-
outside:
|
|
105
|
-
served:
|
|
101
|
+
tests: b.toSorted(e),
|
|
102
|
+
files: y.toSorted(e),
|
|
103
|
+
mismatched: u,
|
|
104
|
+
outside: f,
|
|
105
|
+
served: p
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
async function m(e, t) {
|
|
@@ -9,12 +9,16 @@ import { UnitOutcome } from './types/unit-outcome.js';
|
|
|
9
9
|
* hung workers and counts finished units while the run goes on. Several workers
|
|
10
10
|
* may get the same test file; each claims the next unit of the file and waits
|
|
11
11
|
* until the unit before it finished (`waitForTurn`), so a test file never runs
|
|
12
|
-
* twice at once
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* twice at once, unless an isolated run has parallel units, whose units of one
|
|
13
|
+
* test file start at once. A concurrency lowers every project's `maxWorkers`
|
|
14
|
+
* for this run. A unit counts as finished when its worker marks it done or,
|
|
15
|
+
* once the run is over, when a worker claimed it and died or was stopped before
|
|
16
|
+
* it could, so the progress reaches the number of units that ran. The context's
|
|
17
|
+
* `onUnitEnd` gets the index of each finished unit and, for a unit its worker
|
|
18
|
+
* marked done, its facts with `describe`, else how long it ran, from its
|
|
19
|
+
* records. The read as a unit ends and the read after the run share their
|
|
20
|
+
* decisions of the unhandled errors, so each error is decided once
|
|
21
|
+
* (`StrayDecisions`).
|
|
18
22
|
*
|
|
19
23
|
* @param handle - Live Vitest instance of the session.
|
|
20
24
|
* @param plan - Kind of the run, units in plan order and the most units at
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resetRunDirectory as e } from "./reset-run-directory.js";
|
|
2
2
|
import { runSpecifications as t } from "./run-specifications.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { watchHeartbeats as n } from "./watch-heartbeats.js";
|
|
4
|
+
import { readOutRecords as r } from "./read-out-records.js";
|
|
5
5
|
import { stopHungWorker as i } from "./stop-hung-worker.js";
|
|
6
6
|
import { writePlanFiles as a } from "./write-plan-files.js";
|
|
7
7
|
import { watchUnitEnds as o } from "./watch-unit-ends.js";
|
|
@@ -13,12 +13,12 @@ async function d(d, f) {
|
|
|
13
13
|
e(g), d.state.spawns.clear();
|
|
14
14
|
let _ = await a(g, p), v = p.map((e) => h.getProjectByName(e.project).createSpecification(e.file)), y = h.projects.map((e) => e.config), b = y.map((e) => e.maxWorkers);
|
|
15
15
|
if (f.concurrency !== void 0) for (let e of y) e.maxWorkers = Math.min(e.maxWorkers, f.concurrency);
|
|
16
|
-
let x = /* @__PURE__ */ new Map(), S =
|
|
17
|
-
await i(e.pid) && x.set(e.unit, e);
|
|
18
|
-
}), { onUnitEnd: C } = d.context, w = new Map(_.map((e, t) => [e, t])),
|
|
19
|
-
let t =
|
|
16
|
+
let x = /* @__PURE__ */ new Map(), S = n(g, async (e) => {
|
|
17
|
+
await i(e.pid, d.state.pool) && x.set(e.unit, e);
|
|
18
|
+
}), { onUnitEnd: C } = d.context, w = /* @__PURE__ */ new Map(), T = new Map(_.map((e, t) => [e, t])), E = o(g, C === void 0 ? void 0 : ((e) => {
|
|
19
|
+
let t = T.get(e), n = r(h, u.join(g, "out", `${e}.jsonl`), w);
|
|
20
20
|
if (f.describe === void 0) {
|
|
21
|
-
let e =
|
|
21
|
+
let e = n.find((e) => e.kind === "end");
|
|
22
22
|
C(e === void 0 ? { unit: t } : {
|
|
23
23
|
duration: e.duration,
|
|
24
24
|
unit: t
|
|
@@ -27,34 +27,34 @@ async function d(d, f) {
|
|
|
27
27
|
facts: f.describe(t, {
|
|
28
28
|
pid: Number(c(u.join(g, "claim", e), "utf8")),
|
|
29
29
|
hung: null,
|
|
30
|
-
records:
|
|
30
|
+
records: n
|
|
31
31
|
}),
|
|
32
32
|
unit: t
|
|
33
33
|
});
|
|
34
|
-
})),
|
|
34
|
+
})), D;
|
|
35
35
|
try {
|
|
36
|
-
|
|
36
|
+
D = await t(d, {
|
|
37
37
|
timeouts: null,
|
|
38
38
|
repeat: !1,
|
|
39
39
|
mode: m
|
|
40
40
|
}, v);
|
|
41
41
|
} finally {
|
|
42
|
-
|
|
42
|
+
E.stop(), await S.stop();
|
|
43
43
|
for (let [e, t] of y.entries()) t.maxWorkers = b[e];
|
|
44
44
|
}
|
|
45
|
-
let
|
|
46
|
-
for (let [e, t] of _.entries())
|
|
45
|
+
let O = s(h, g, w), k = new Set(l(u.join(g, "claim"))), A = new Set(l(u.join(g, "done")));
|
|
46
|
+
for (let [e, t] of _.entries()) k.has(t) && !A.has(t) && C?.({ unit: e });
|
|
47
47
|
return {
|
|
48
48
|
units: _.map((e, t) => {
|
|
49
|
-
let n =
|
|
49
|
+
let n = k.has(e);
|
|
50
50
|
return {
|
|
51
51
|
pid: n ? Number(c(u.join(g, "claim", e), "utf8")) : null,
|
|
52
|
-
records:
|
|
52
|
+
records: O.get(e) ?? [],
|
|
53
53
|
hung: x.get(t) ?? null,
|
|
54
54
|
claimed: n
|
|
55
55
|
};
|
|
56
56
|
}),
|
|
57
|
-
error:
|
|
57
|
+
error: D
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
export { d as runPlan };
|
|
@@ -7,8 +7,16 @@ import { VitestHandle } from './types/vitest-session-state.js';
|
|
|
7
7
|
* them after the run, and a unit's end is recorded only after the worker's
|
|
8
8
|
* teardown, the test environment's teardown included. The caller's watchdog
|
|
9
9
|
* must run until this resolves: the wait relies on it to stop workers that hang
|
|
10
|
-
* in their teardown. Failing tests and
|
|
11
|
-
* runs, so the exit code Vitest sets for them
|
|
10
|
+
* in their teardown. Failing tests and unhandled errors, such as a worker that
|
|
11
|
+
* died, are expected in mootant's runs, so the exit code Vitest sets for them
|
|
12
|
+
* is restored. When the context allows parallel units, the workers are told so,
|
|
13
|
+
* and a unit of an isolated run does not wait for the unit before it of the
|
|
14
|
+
* same test file; the pool then keeps spare workers for the units of the run
|
|
15
|
+
* (`MootantForksPool.prepare`). Otherwise the worker of a unit starts while the
|
|
16
|
+
* unit before it runs and waits for it, so spares would only add load. The
|
|
17
|
+
* spares left stop once Vitest ends the run, as no unit claims them, so the
|
|
18
|
+
* wait for workers never sees them. The options name the defines each project
|
|
19
|
+
* runs as a script (`listScriptDefines`).
|
|
12
20
|
*
|
|
13
21
|
* @param handle - Live Vitest instance of the session.
|
|
14
22
|
* @param worker - Kind of the run the workers perform and, for a dry run, the
|
|
@@ -20,4 +28,4 @@ import { VitestHandle } from './types/vitest-session-state.js';
|
|
|
20
28
|
* @returns First unhandled error of the run, such as a worker that died, or
|
|
21
29
|
* null.
|
|
22
30
|
*/
|
|
23
|
-
export declare function runSpecifications(handle: VitestHandle, worker: Omit<VitestWorkerOptions, 'directory' | 'root'>, specifications: TestSpecification[]): Promise<string | null>;
|
|
31
|
+
export declare function runSpecifications(handle: VitestHandle, worker: Omit<VitestWorkerOptions, 'directory' | 'parallel' | 'defines' | 'root'>, specifications: TestSpecification[]): Promise<string | null>;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { getErrorMessage as e } from "../shared/get-error-message.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
o
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { listScriptDefines as t } from "./list-script-defines.js";
|
|
3
|
+
import { waitForWorkers as n } from "./wait-for-workers.js";
|
|
4
|
+
async function r(r, i, a) {
|
|
5
|
+
let { context: o, vitest: s, state: c } = r, { exitCode: l } = process;
|
|
6
|
+
s.provide("mootant", {
|
|
7
|
+
...i,
|
|
8
|
+
...o.parallelUnits === !0 && { parallel: !0 },
|
|
9
|
+
defines: t(s),
|
|
10
|
+
directory: o.workDirectory,
|
|
11
|
+
root: o.root
|
|
9
12
|
});
|
|
13
|
+
let u = o.parallelUnits === !0 && i.mode === "isolated";
|
|
14
|
+
c.pool.prepare(u ? a : []);
|
|
10
15
|
try {
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
let t;
|
|
17
|
+
try {
|
|
18
|
+
t = await s.runTestSpecifications(a);
|
|
19
|
+
} finally {
|
|
20
|
+
await c.pool.drain();
|
|
21
|
+
}
|
|
22
|
+
await n(o.workDirectory, c.pool);
|
|
23
|
+
let [r] = t.unhandledErrors;
|
|
14
24
|
return r === void 0 ? null : e(r);
|
|
15
25
|
} finally {
|
|
16
|
-
process.exitCode =
|
|
26
|
+
process.exitCode = l;
|
|
17
27
|
}
|
|
18
28
|
}
|
|
19
|
-
export {
|
|
29
|
+
export { r as runSpecifications };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SerializedConfig, RunnerTestSuite, RunnerTestCase, RunnerTestFile, RunnerTask, TestRunner } from 'vitest';
|
|
1
|
+
import { SerializedConfig, RunnerTestSuite, RunnerTestCase, RunnerTestFile, TestTryOptions, RunnerTask, TestRunner } from 'vitest';
|
|
2
2
|
/**
|
|
3
3
|
* Vitest runner of mootant's workers. In a dry run it runs every test once, or
|
|
4
4
|
* twice in a row with `repeat`, and records which mutant sites each try
|
|
@@ -13,14 +13,16 @@ import { SerializedConfig, RunnerTestSuite, RunnerTestCase, RunnerTestFile, Runn
|
|
|
13
13
|
* the worker's teardown: Vitest cleans up the worker-scoped fixtures, then
|
|
14
14
|
* tears the test environment down; errors of both count as a failed suite hook,
|
|
15
15
|
* and the heartbeat covers both, so a hang there stops the worker. What the
|
|
16
|
-
* code reads is recorded until the unit ends, so files
|
|
17
|
-
*
|
|
18
|
-
* read; a teardown step that runs after the unit
|
|
19
|
-
* environment's when the worker's teardown cannot be
|
|
20
|
-
* neither. A test environment other than Vitest's own loads
|
|
21
|
-
* the runner exists, out of sight, so its units report no
|
|
22
|
-
* never cached. A unit waits until the worker of the unit
|
|
23
|
-
* test file is gone, so a test file never runs twice at
|
|
16
|
+
* code reads is recorded until the unit ends, so files, environment variables
|
|
17
|
+
* and values of `provide` and `define` read in that teardown are inputs of the
|
|
18
|
+
* unit like those its tests read; a teardown step that runs after the unit
|
|
19
|
+
* ended, as the test environment's when the worker's teardown cannot be
|
|
20
|
+
* watched, counts for neither. A test environment other than Vitest's own loads
|
|
21
|
+
* and sets up before the runner exists, out of sight, so its units report no
|
|
22
|
+
* dependencies and are never cached. A unit waits until the worker of the unit
|
|
23
|
+
* before it of the same test file is gone, so a test file never runs twice at
|
|
24
|
+
* once, unless the run is an isolated one with parallel units
|
|
25
|
+
* (`VitestWorkerOptions.parallel`).
|
|
24
26
|
*
|
|
25
27
|
* Tests the user marked concurrent stay concurrent in isolated units and in a
|
|
26
28
|
* dry run that tries each test once, as in a plain run; a batch run and a dry
|
|
@@ -42,9 +44,12 @@ import { SerializedConfig, RunnerTestSuite, RunnerTestCase, RunnerTestFile, Runn
|
|
|
42
44
|
* variable cannot change inside a running worker); switched code reads it on
|
|
43
45
|
* every evaluation. Facts go to out files in the work directory, one line per
|
|
44
46
|
* test; heartbeats let the main process stop a worker that hangs, dry runs
|
|
45
|
-
* included.
|
|
47
|
+
* included. An unhandled error is recorded only as Vitest's own listener
|
|
48
|
+
* reports it to the main process in a plain run, so an error of an event the
|
|
49
|
+
* code listens for itself is left to that code (`interceptStrays`); the main
|
|
50
|
+
* process decides which of the recorded errors count (`readStrays`).
|
|
46
51
|
*/
|
|
47
|
-
export default class
|
|
52
|
+
export default class Runner extends TestRunner {
|
|
48
53
|
/**
|
|
49
54
|
* Coverage the runtime writes to while several tries of a dry run overlap:
|
|
50
55
|
* each site counts for every one of them.
|
|
@@ -59,6 +64,11 @@ export default class MootantRunner extends TestRunner {
|
|
|
59
64
|
* when the user's tests run concurrently.
|
|
60
65
|
*/
|
|
61
66
|
private readonly records;
|
|
67
|
+
/**
|
|
68
|
+
* Defines Vitest ran as a script for the project, by key, with whether each
|
|
69
|
+
* value is code (`listScriptDefines`).
|
|
70
|
+
*/
|
|
71
|
+
private readonly scripted;
|
|
62
72
|
/**
|
|
63
73
|
* Milliseconds the hooks around each test may take by Vitest's own hook
|
|
64
74
|
* timeouts, by test id; filled in a dry run.
|
|
@@ -72,6 +82,11 @@ export default class MootantRunner extends TestRunner {
|
|
|
72
82
|
* Mutant sites evaluated outside tries in a dry run.
|
|
73
83
|
*/
|
|
74
84
|
private readonly loadCovers;
|
|
85
|
+
/**
|
|
86
|
+
* Unhandled errors Vitest reported outside tries, encoded for the main
|
|
87
|
+
* process (`encodeStray`).
|
|
88
|
+
*/
|
|
89
|
+
private readonly loadStrays;
|
|
75
90
|
/**
|
|
76
91
|
* Site evaluations while tries of a dry run ran, and the count when the
|
|
77
92
|
* current stretch of tries began.
|
|
@@ -101,13 +116,14 @@ export default class MootantRunner extends TestRunner {
|
|
|
101
116
|
*/
|
|
102
117
|
private readonly killed;
|
|
103
118
|
/**
|
|
104
|
-
*
|
|
119
|
+
* Names of the values of `provide` and `define` the code read since the
|
|
120
|
+
* runner was created (`trackValues`).
|
|
105
121
|
*/
|
|
106
|
-
private
|
|
122
|
+
private readonly values;
|
|
107
123
|
/**
|
|
108
|
-
*
|
|
124
|
+
* Ids of the tests that run, or null to run every test.
|
|
109
125
|
*/
|
|
110
|
-
private
|
|
126
|
+
private runnable;
|
|
111
127
|
/**
|
|
112
128
|
* Coverage sets of the tries that run now, in a dry run.
|
|
113
129
|
*/
|
|
@@ -193,6 +209,10 @@ export default class MootantRunner extends TestRunner {
|
|
|
193
209
|
* Length of the text in the heartbeat file.
|
|
194
210
|
*/
|
|
195
211
|
private beatLength;
|
|
212
|
+
/**
|
|
213
|
+
* Unhandled errors the runner recorded, which numbers the next one.
|
|
214
|
+
*/
|
|
215
|
+
private strayCount;
|
|
196
216
|
/**
|
|
197
217
|
* Index of the unit in the run's plan.
|
|
198
218
|
*/
|
|
@@ -224,19 +244,29 @@ export default class MootantRunner extends TestRunner {
|
|
|
224
244
|
*/
|
|
225
245
|
private file;
|
|
226
246
|
/**
|
|
227
|
-
* Creates the runner of one test file,
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
247
|
+
* Creates the runner of one test file, turns the compile cache of the worker
|
|
248
|
+
* on for the modules it loads from now on (`enableCompileCache`), which
|
|
249
|
+
* Vitest writes when it stops the worker, records the values of `provide` and
|
|
250
|
+
* `define` the code reads from now on, as Vitest loads the modules of the
|
|
251
|
+
* diff and the snapshot serializers after the runner (`trackValues`),
|
|
252
|
+
* installs the mutant runtime, takes over Vitest's report of the worker's
|
|
253
|
+
* unhandled errors (`interceptStrays`), records the worker's process id, so
|
|
254
|
+
* the main process waits until the worker is gone, and moves the end of the
|
|
255
|
+
* unit to the end of the worker's teardown, after the test environment's
|
|
256
|
+
* teardown, whose error fails the unit like a failed suite hook. A dry run
|
|
257
|
+
* turns test locations on, as the report gives the line of each test. Batch
|
|
258
|
+
* and isolated runs keep the project's setting: Vitest finds each location by
|
|
259
|
+
* mapping a stack trace through source maps, which every unit would pay for
|
|
260
|
+
* each test and suite of its file.
|
|
232
261
|
*
|
|
233
262
|
* @param config - Serialized configuration of the project.
|
|
234
263
|
*/
|
|
235
264
|
constructor(config: SerializedConfig);
|
|
236
265
|
/**
|
|
237
|
-
* Claims a unit, waits for the unit before it of the same test file
|
|
238
|
-
*
|
|
239
|
-
* awaits this hook once
|
|
266
|
+
* Claims a unit, waits for the unit before it of the same test file unless
|
|
267
|
+
* the run is an isolated one with parallel units, and prepares the runtime
|
|
268
|
+
* before the test file and its setup files load. Vitest awaits this hook once
|
|
269
|
+
* per test file.
|
|
240
270
|
*
|
|
241
271
|
* @param paths - Absolute path of the test file.
|
|
242
272
|
*/
|
|
@@ -266,13 +296,17 @@ export default class MootantRunner extends TestRunner {
|
|
|
266
296
|
*/
|
|
267
297
|
onBeforeRunTask(test: RunnerTask): Promise<void>;
|
|
268
298
|
/**
|
|
269
|
-
* Records an unhandled error
|
|
270
|
-
*
|
|
299
|
+
* Records an unhandled error as Vitest's listener reports it
|
|
300
|
+
* (`interceptStrays`), encoded and numbered for the main process, which
|
|
301
|
+
* decides once whether it counts (`readStrays`): in every try that runs now,
|
|
302
|
+
* as a late error of the last try in a batch run, or else as an error outside
|
|
271
303
|
* tries.
|
|
272
304
|
*
|
|
273
|
-
* @param error -
|
|
305
|
+
* @param error - Error as Vitest serialized it, or a reason that is not an
|
|
306
|
+
* object.
|
|
307
|
+
* @param type - Event of the error, as Vitest names it.
|
|
274
308
|
*/
|
|
275
|
-
onStray(error: unknown): void;
|
|
309
|
+
onStray(error: unknown, type: string): void;
|
|
276
310
|
/**
|
|
277
311
|
* Records a test that ended with a skip before a suite ends. Once the file
|
|
278
312
|
* suite ends, reads what the test file depended on so far, its snapshot files
|
|
@@ -299,6 +333,14 @@ export default class MootantRunner extends TestRunner {
|
|
|
299
333
|
* @param files - Test files that ran.
|
|
300
334
|
*/
|
|
301
335
|
onAfterRunFiles(files: RunnerTestFile[]): void;
|
|
336
|
+
/**
|
|
337
|
+
* Notes the state of the test after its `afterEach` hooks; the try's facts
|
|
338
|
+
* are read once its teardown finished.
|
|
339
|
+
*
|
|
340
|
+
* @param test - Vitest task of the try.
|
|
341
|
+
* @param options - Retry and repeat numbers of the try.
|
|
342
|
+
*/
|
|
343
|
+
onAfterRetryTask(test: RunnerTestCase, options: TestTryOptions): Promise<void>;
|
|
302
344
|
/**
|
|
303
345
|
* Records a test that ended with a skip before a suite's hooks run. After an
|
|
304
346
|
* isolated unit bailed, a suite that has not started is skipped with its
|
|
@@ -307,13 +349,6 @@ export default class MootantRunner extends TestRunner {
|
|
|
307
349
|
* @param suite - Suite about to run.
|
|
308
350
|
*/
|
|
309
351
|
onBeforeRunSuite(suite: RunnerTestSuite): Promise<void>;
|
|
310
|
-
/**
|
|
311
|
-
* Notes the state of the test after its `afterEach` hooks; the try's facts
|
|
312
|
-
* are read once its teardown finished.
|
|
313
|
-
*
|
|
314
|
-
* @param test - Vitest task of the try.
|
|
315
|
-
*/
|
|
316
|
-
onAfterRetryTask(test: RunnerTestCase): void;
|
|
317
352
|
/**
|
|
318
353
|
* Records the try of a test that ended with its last repeat.
|
|
319
354
|
*
|
|
@@ -359,29 +394,40 @@ export default class MootantRunner extends TestRunner {
|
|
|
359
394
|
*/
|
|
360
395
|
private aroundTry;
|
|
361
396
|
/**
|
|
362
|
-
* Starts recording the
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
397
|
+
* Starts recording the files the test code reads through `node:fs` that count
|
|
398
|
+
* as inputs, inside the project root or outside it (`createInputFilter`), the
|
|
399
|
+
* environment variables it reads and the defines of `import.meta`
|
|
400
|
+
* (`trackMeta`), before the test file and its setup files load. The first
|
|
401
|
+
* worker of a project in a dry run also writes the hashes of the worker's
|
|
402
|
+
* environment variables, as Vitest set them up, to `env/<hash>.json` of the
|
|
403
|
+
* work directory, for the main process to tell what the variables read were.
|
|
368
404
|
*
|
|
369
405
|
* @param snapshot - Whether to write the environment of the project.
|
|
370
406
|
*/
|
|
371
407
|
private startTracking;
|
|
408
|
+
/**
|
|
409
|
+
* Tracks the defines of `import.meta` given as JSON in the modules Vitest
|
|
410
|
+
* evaluates from now on (`trackMetaDefines`), or counts them for the unit at
|
|
411
|
+
* once when Vitest loaded modules of the project before, a snapshot
|
|
412
|
+
* environment, the diff options or snapshot serializers, or when they cannot
|
|
413
|
+
* be tracked.
|
|
414
|
+
*/
|
|
415
|
+
private trackMeta;
|
|
372
416
|
/**
|
|
373
417
|
* Stops recording what the code reads once the unit ended and lists what it
|
|
374
418
|
* depended on: what the test file depended on when its file suite ended, with
|
|
375
419
|
* what the worker evaluated, required and read through `node:fs` until now,
|
|
376
|
-
* the environment variables
|
|
377
|
-
* itself. A test environment other than
|
|
378
|
-
* the runner exists, so what its module
|
|
379
|
-
* to `process.env` and `node:fs` they
|
|
380
|
-
* reports no dependencies, so it is never
|
|
420
|
+
* the environment variables and the values of `provide` and `define` it read,
|
|
421
|
+
* and the files it read and changed itself. A test environment other than
|
|
422
|
+
* Vitest's own loads and sets up before the runner exists, so what its module
|
|
423
|
+
* and `setup` read, and the references to `process.env` and `node:fs` they
|
|
424
|
+
* keep, are out of sight: such a unit reports no dependencies, so it is never
|
|
425
|
+
* cached.
|
|
381
426
|
*
|
|
382
427
|
* @returns What the unit depended on, sorted, or null when it cannot tell,
|
|
383
428
|
* with the names of the environment variables it read, `*` for all of them,
|
|
384
|
-
* and the files and directories it read
|
|
429
|
+
* and of the values (`trackValues`), and the files and directories it read
|
|
430
|
+
* and changed itself, both sorted.
|
|
385
431
|
*/
|
|
386
432
|
private stopTracking;
|
|
387
433
|
/**
|