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,3 +1,4 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
1
2
|
import { TestProcessOutcome } from './types/test-process-outcome.js';
|
|
2
3
|
import { NodeTestHandle } from './types/node-test-handle.js';
|
|
3
4
|
import { NodeTestUnit } from './types/node-test-unit.js';
|
|
@@ -5,18 +6,25 @@ import { ProcessWatch } from './types/process-watch.js';
|
|
|
5
6
|
/**
|
|
6
7
|
* Runs one test file in a test process of the session (`runTestProcess`):
|
|
7
8
|
* mootant's preload and the project's flags, then the test file, in the project
|
|
8
|
-
* root, with
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
9
|
+
* root, with an out file of its own in the work directory, removed once read.
|
|
10
|
+
* The process gets its unit as a line on file descriptor 3, or, where the
|
|
11
|
+
* session sends none that way (`NodeTestHandle.pipe`), in `MOOTANT_UNIT`; a
|
|
12
|
+
* spare process of the test file, started before, may run it instead. What the
|
|
13
|
+
* process writes goes to the context's `onOutput` with the test file. Once the
|
|
14
|
+
* run is interrupted (`AdapterContext.signal`), no process starts.
|
|
11
15
|
*
|
|
12
16
|
* @param handle - Live session.
|
|
13
|
-
* @param input - Test file, what the process runs and
|
|
17
|
+
* @param input - Test file, what the process runs, its deadline and a spare
|
|
18
|
+
* process, if any.
|
|
14
19
|
* @param input.file - Real absolute path of the test file.
|
|
15
20
|
* @param input.deadline - Deadline of the watchdog from what is known of the
|
|
16
21
|
* process.
|
|
22
|
+
* @param input.spare - Spare process of the test file to run in, if any.
|
|
17
23
|
* @returns What the process left behind.
|
|
24
|
+
* @throws The reason of the context's signal once it aborted.
|
|
18
25
|
*/
|
|
19
26
|
export declare function runTestFile(handle: NodeTestHandle, input: {
|
|
20
27
|
deadline(watch: ProcessWatch): number;
|
|
28
|
+
spare?: ChildProcess;
|
|
21
29
|
file: string;
|
|
22
30
|
} & Pick<NodeTestUnit, 'expected' | 'hitLimit' | 'mutant' | 'mode' | 'bail' | 'plan'>): Promise<TestProcessOutcome>;
|
|
@@ -2,34 +2,39 @@ import { runTestProcess as e } from "./run-test-process.js";
|
|
|
2
2
|
import { mkdirSync as t, rmSync as n, writeFileSync as r } from "node:fs";
|
|
3
3
|
import i from "node:path";
|
|
4
4
|
async function a(a, o) {
|
|
5
|
-
let { context: s, state: c } = a
|
|
6
|
-
|
|
7
|
-
let p = i.join(
|
|
8
|
-
|
|
9
|
-
let m = {
|
|
10
|
-
|
|
5
|
+
let { context: s, state: c } = a;
|
|
6
|
+
s.signal?.throwIfAborted();
|
|
7
|
+
let { deadline: l, spare: u, file: d, ...f } = o, p = i.join(s.workDirectory, "out");
|
|
8
|
+
t(p, { recursive: !0 });
|
|
9
|
+
let m = i.join(p, `${c.count}.jsonl`);
|
|
10
|
+
c.count += 1, r(m, "");
|
|
11
|
+
let h = {
|
|
12
|
+
...f,
|
|
13
|
+
directory: s.workDirectory,
|
|
11
14
|
commonjs: a.commonjs,
|
|
12
15
|
root: s.root,
|
|
13
|
-
out:
|
|
14
|
-
}, { onOutput:
|
|
16
|
+
out: m
|
|
17
|
+
}, { onOutput: g } = s, _ = JSON.stringify(h);
|
|
15
18
|
try {
|
|
16
19
|
return await e({
|
|
17
|
-
...
|
|
18
|
-
|
|
20
|
+
...g !== void 0 && { onOutput: (e) => {
|
|
21
|
+
g(e, d);
|
|
19
22
|
} },
|
|
23
|
+
...a.pipe && { unit: _ },
|
|
24
|
+
...u !== void 0 && { spare: u },
|
|
20
25
|
env: {
|
|
21
26
|
...a.env,
|
|
22
|
-
MOOTANT_UNIT:
|
|
27
|
+
...a.pipe ? { MOOTANT_UNIT_FD: "3" } : { MOOTANT_UNIT: _ }
|
|
23
28
|
},
|
|
24
|
-
args: [...a.args,
|
|
29
|
+
args: [...a.args, d],
|
|
25
30
|
groups: a.groups,
|
|
26
31
|
node: a.node,
|
|
27
32
|
cwd: s.root,
|
|
28
33
|
deadline: l,
|
|
29
|
-
out:
|
|
34
|
+
out: m
|
|
30
35
|
});
|
|
31
36
|
} finally {
|
|
32
|
-
n(
|
|
37
|
+
n(m, { force: !0 });
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
export { a as runTestFile };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
1
2
|
import { TestProcessOutcome } from './types/test-process-outcome.js';
|
|
2
3
|
import { ProcessWatch } from './types/process-watch.js';
|
|
3
4
|
/**
|
|
@@ -18,6 +19,11 @@ interface TestProcessOptions {
|
|
|
18
19
|
* Environment variables of the process.
|
|
19
20
|
*/
|
|
20
21
|
env: NodeJS.ProcessEnv;
|
|
22
|
+
/**
|
|
23
|
+
* Spare process of the test file, started with file descriptor 3, to run
|
|
24
|
+
* instead of a new one.
|
|
25
|
+
*/
|
|
26
|
+
spare?: ChildProcess;
|
|
21
27
|
/**
|
|
22
28
|
* Process groups of the session's test processes that run, which holds this
|
|
23
29
|
* one's while it runs.
|
|
@@ -27,6 +33,11 @@ interface TestProcessOptions {
|
|
|
27
33
|
* Arguments after the Node binary.
|
|
28
34
|
*/
|
|
29
35
|
args: string[];
|
|
36
|
+
/**
|
|
37
|
+
* The unit as JSON, sent on file descriptor 3 of the process; without it the
|
|
38
|
+
* environment carries the unit, and the process gets no descriptor 3.
|
|
39
|
+
*/
|
|
40
|
+
unit?: string;
|
|
30
41
|
/**
|
|
31
42
|
* Node binary.
|
|
32
43
|
*/
|
|
@@ -43,20 +54,26 @@ interface TestProcessOptions {
|
|
|
43
54
|
}
|
|
44
55
|
/**
|
|
45
56
|
* Runs one test process and collects the records it appends to its out file.
|
|
46
|
-
* The process starts detached, as the leader of a process group, without stdin
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* group is
|
|
55
|
-
*
|
|
57
|
+
* The process starts detached, as the leader of a process group, without stdin
|
|
58
|
+
* (`startTestProcess`), or a spare process of the test file, started before,
|
|
59
|
+
* runs instead. With a unit in the options, the process gets it as a line on
|
|
60
|
+
* file descriptor 3, which is closed after it. Either way the start time is
|
|
61
|
+
* now, so the deadline and the start-up of a spare count from the moment it got
|
|
62
|
+
* its unit. The out file is read every 50 ms; when the time passes the deadline
|
|
63
|
+
* the options compute from the records so far, the watchdog stops the whole
|
|
64
|
+
* process group (`stopProcessGroup`). Once the process exits, what is left of
|
|
65
|
+
* its group is stopped too, and the outcome tells whether anything was left or
|
|
66
|
+
* the watchdog stopped it (`lingering`); the deadline no longer applies, and
|
|
67
|
+
* the output gets 300 ms to close before it is dropped, so a process the tests
|
|
68
|
+
* detached into a group of its own cannot hold the outcome back. While the
|
|
69
|
+
* process runs, its group is in `groups`, which the session stops when it
|
|
70
|
+
* closes. A line that is not JSON, as the last line of a stopped process, is
|
|
71
|
+
* ignored.
|
|
56
72
|
*
|
|
57
|
-
* @param options - Binary, arguments, environment, out file
|
|
58
|
-
*
|
|
59
|
-
*
|
|
73
|
+
* @param options - Binary, arguments, environment, out file, deadline, the unit
|
|
74
|
+
* for file descriptor 3 and a spare process, if any.
|
|
75
|
+
* @returns Records, exit code or signal, start time, whether the watchdog
|
|
76
|
+
* stopped the process and whether its group outlived it.
|
|
60
77
|
* @throws {Error} When the process cannot start.
|
|
61
78
|
*/
|
|
62
79
|
export declare function runTestProcess(options: TestProcessOptions): Promise<TestProcessOutcome>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { stopProcessGroup as e } from "../shared/stop-process-group.js";
|
|
2
|
+
import { startTestProcess as t } from "./start-test-process.js";
|
|
3
|
+
import { isGroupAlive as n } from "./is-group-alive.js";
|
|
4
|
+
import { closeSync as r, fstatSync as i, openSync as a, readSync as o } from "node:fs";
|
|
5
5
|
function s(s) {
|
|
6
|
-
let { onOutput: c } = s, l = [], u =
|
|
6
|
+
let { onOutput: c } = s, l = [], u = a(s.out, "r"), d = 0, f = "", p = Date.now(), m = {
|
|
7
7
|
last: p,
|
|
8
8
|
records: l,
|
|
9
9
|
spawned: p
|
|
10
10
|
}, h = !1;
|
|
11
11
|
function g() {
|
|
12
|
-
let { size: e } =
|
|
12
|
+
let { size: e } = i(u);
|
|
13
13
|
if (e <= d) return;
|
|
14
14
|
let t = Buffer.alloc(e - d);
|
|
15
|
-
|
|
15
|
+
o(u, t, 0, t.length, d), d = e;
|
|
16
16
|
let n = (f + t.toString("utf8")).split("\n");
|
|
17
17
|
f = n.pop();
|
|
18
18
|
for (let e of n) try {
|
|
@@ -20,50 +20,48 @@ function s(s) {
|
|
|
20
20
|
} catch {}
|
|
21
21
|
m.last = Date.now();
|
|
22
22
|
}
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
windowsHide: !0,
|
|
23
|
+
let { unit: _ } = s, v = s.spare ?? t({
|
|
24
|
+
output: c === void 0 ? "ignore" : "pipe",
|
|
25
|
+
pipe: _ !== void 0,
|
|
26
|
+
groups: s.groups,
|
|
27
|
+
node: s.node,
|
|
28
|
+
args: s.args,
|
|
30
29
|
cwd: s.cwd,
|
|
31
|
-
env: s.env
|
|
32
|
-
detached: !0
|
|
30
|
+
env: s.env
|
|
33
31
|
});
|
|
32
|
+
if (_ !== void 0 && v.pid !== void 0) {
|
|
33
|
+
let e = v.stdio[3];
|
|
34
|
+
e?.on("error", () => {}), e?.end(`${_}\n`);
|
|
35
|
+
}
|
|
34
36
|
for (let e of [v.stdout, v.stderr]) e?.setEncoding("utf8"), e?.on("data", (e) => {
|
|
35
37
|
c(e);
|
|
36
38
|
});
|
|
37
|
-
let y =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function C() {
|
|
43
|
-
return !S && (S = !0, clearInterval(x), y(), s.groups.delete(v.pid), g(), n(u), !0);
|
|
39
|
+
let y = !1, b = setInterval(() => {
|
|
40
|
+
g(), !h && !y && Date.now() > s.deadline(m) && (h = !0, e(v.pid));
|
|
41
|
+
}, 50), x = !1;
|
|
42
|
+
function S() {
|
|
43
|
+
return !x && (x = !0, clearInterval(b), g(), r(u), !0);
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
v.stdout?.destroy(), v.stderr?.destroy(), C() && e({
|
|
51
|
-
spawned: p,
|
|
52
|
-
records: l,
|
|
53
|
-
signal: r,
|
|
54
|
-
code: n,
|
|
55
|
-
hung: h
|
|
56
|
-
});
|
|
57
|
-
}, 300);
|
|
58
|
-
}), v.on("close", (t, n) => {
|
|
59
|
-
C() && e({
|
|
45
|
+
let C = !1;
|
|
46
|
+
return new Promise((t, r) => {
|
|
47
|
+
function i(e, n) {
|
|
48
|
+
S() && t({
|
|
49
|
+
lingering: C,
|
|
60
50
|
spawned: p,
|
|
61
51
|
records: l,
|
|
62
52
|
signal: n,
|
|
63
|
-
code:
|
|
53
|
+
code: e,
|
|
64
54
|
hung: h
|
|
65
55
|
});
|
|
66
|
-
}
|
|
56
|
+
}
|
|
57
|
+
v.on("error", (e) => {
|
|
58
|
+
S(), r(e);
|
|
59
|
+
}), v.on("exit", (t, r) => {
|
|
60
|
+
y = !0, C = h || n(v.pid), e(v.pid), setTimeout(() => {
|
|
61
|
+
for (let e of v.stdio) e?.destroy();
|
|
62
|
+
i(t, r);
|
|
63
|
+
}, 300);
|
|
64
|
+
}), v.on("close", i);
|
|
67
65
|
});
|
|
68
66
|
}
|
|
69
67
|
export { s as runTestProcess };
|
|
@@ -13,8 +13,16 @@ import { AdapterContext } from '../../types/adapter/adapter-context.js';
|
|
|
13
13
|
* modules the project loads first (`placePreload`), the filtered flags and the
|
|
14
14
|
* extra flags of the options, mootant's reporter and the spec reporter, then
|
|
15
15
|
* one test file, in the project root, with the variables of mootant's process,
|
|
16
|
-
* the command and the options, and mootant's own `NODE_TEST_CONTEXT`.
|
|
17
|
-
*
|
|
16
|
+
* the command and the options, and mootant's own `NODE_TEST_CONTEXT`. A test
|
|
17
|
+
* process gets its unit through file descriptor 3, except on Windows, where it
|
|
18
|
+
* gets it in a variable. Isolated runs start spare test processes
|
|
19
|
+
* (`createSpareProcesses`), up to the cores the running units leave free
|
|
20
|
+
* (`getSpareLimit`), unless `MOOTANT_PREFORK=0` (`readPreforkSwitch`), Windows,
|
|
21
|
+
* a legacy loader, whose code runs before mootant's preload, or flags that load
|
|
22
|
+
* code from a file first or watch the process (`allowsSpares`) rule them out.
|
|
23
|
+
* Closing the session stops the test processes that still run, spares too, and
|
|
24
|
+
* so does an interrupt of the run (`AdapterContext.signal`), after which no
|
|
25
|
+
* test process starts.
|
|
18
26
|
*
|
|
19
27
|
* @param context - Switched files, work directory, concurrency and root.
|
|
20
28
|
* @param options - Options of the adapter.
|
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
let
|
|
30
|
-
if (
|
|
31
|
-
|
|
1
|
+
import { readPreforkSwitch as e } from "../shared/read-prefork-switch.js";
|
|
2
|
+
import { stopProcessGroup as t } from "../shared/stop-process-group.js";
|
|
3
|
+
import { readNodeOptions as n } from "../shared/read-node-options.js";
|
|
4
|
+
import { getNodeCacheInputs as r } from "./get-node-cache-inputs.js";
|
|
5
|
+
import { getDefaultPatterns as ee } from "./get-default-patterns.js";
|
|
6
|
+
import { listFlagValues as i } from "../shared/list-flag-values.js";
|
|
7
|
+
import { listNodeTestFiles as a } from "./list-node-test-files.js";
|
|
8
|
+
import { getSpareLimit as o } from "../shared/get-spare-limit.js";
|
|
9
|
+
import { checkNodeSupport as s } from "./check-node-support.js";
|
|
10
|
+
import { allowsSpares as c } from "../shared/allows-spares.js";
|
|
11
|
+
import { readNodeRuntime as l } from "./read-node-runtime.js";
|
|
12
|
+
import { findTestCommand as u } from "./find-test-command.js";
|
|
13
|
+
import { readTestTimeout as d } from "./read-test-timeout.js";
|
|
14
|
+
import { LOADER_FLAGS as f } from "../shared/loader-flags.js";
|
|
15
|
+
import { checkTypeScript as p } from "./check-typescript.js";
|
|
16
|
+
import { filterExecArgv as m } from "./filter-exec-argv.js";
|
|
17
|
+
import { listSetupFiles as h } from "./list-setup-files.js";
|
|
18
|
+
import { getPreloadPath as g } from "./get-preload-path.js";
|
|
19
|
+
import { placePreload as _ } from "./place-preload.js";
|
|
20
|
+
import { includesTsx as v } from "./includes-tsx.js";
|
|
21
|
+
import { runIsolated as y } from "./run-isolated.js";
|
|
22
|
+
import { resolveTsx as b } from "./resolve-tsx.js";
|
|
23
|
+
import { runDry as x } from "./run-dry.js";
|
|
24
|
+
import S from "node:path";
|
|
25
|
+
import { pathToFileURL as C } from "node:url";
|
|
26
|
+
import { availableParallelism as w } from "node:os";
|
|
27
|
+
const T = /* @__PURE__ */ new Set(["--experimental-loader", "--loader"]);
|
|
28
|
+
async function E(E, D) {
|
|
29
|
+
let { root: O } = E, k = e(), A = D.node ?? process.execPath, j = await u(O, D.command), M = await l(A, E.workDirectory);
|
|
30
|
+
if (!s(M.version)) throw Error(`mootant runs node:test on Node 20.19 or a later 20.x and on Node 22.12 or later, but ${A} is Node ${M.version}.`);
|
|
31
|
+
let { diagnostics: N, execArgv: P } = m(j.flags);
|
|
32
|
+
P.push(...D.execArgv ?? []);
|
|
33
|
+
let F = P.includes("--experimental-strip-types") || P.includes("--experimental-transform-types") || M.typescript && !P.includes("--no-experimental-strip-types"), I = D.files ?? j.files, L = await a(O, I, ee(j.tool, F));
|
|
34
|
+
if (L.length === 0) {
|
|
35
|
+
let e = I.length > 0 ? I.map((e) => `"${e}"`).join(", ") : "the default test file patterns";
|
|
32
36
|
throw Error(`No test files match ${e}; set nodeTestAdapter({ files }) or fix the test script.`);
|
|
33
37
|
}
|
|
34
|
-
if (
|
|
35
|
-
let e =
|
|
36
|
-
Number.parseInt(
|
|
38
|
+
if (j.tool === "bnt" && L.some((e) => e.endsWith(".ts"))) {
|
|
39
|
+
let e = b(O);
|
|
40
|
+
Number.parseInt(M.version.slice(1)) >= 22 ? (P.unshift("--disable-warning=ExperimentalWarning", "--experimental-strip-types"), F = !0) : e !== null && P.unshift("--enable-source-maps", "--import", e);
|
|
37
41
|
}
|
|
38
|
-
let
|
|
42
|
+
let R = {
|
|
39
43
|
...process.env,
|
|
44
|
+
...j.env,
|
|
40
45
|
...D.env,
|
|
41
|
-
...w.env,
|
|
42
46
|
NODE_TEST_CONTEXT: "mootant"
|
|
43
47
|
};
|
|
44
|
-
delete
|
|
45
|
-
let
|
|
46
|
-
for (let e of
|
|
48
|
+
delete R.MOOTANT_UNIT, delete R.MOOTANT_UNIT_FD;
|
|
49
|
+
let z = [...n(R.NODE_OPTIONS ?? ""), ...P], B = i(z, f), V = i(z, T);
|
|
50
|
+
for (let e of V) N.push({
|
|
47
51
|
message: `The loader ${e} runs before mootant's module hooks, so mootant cannot switch the modules it changes.`,
|
|
48
52
|
code: "config-overridden",
|
|
49
53
|
severity: "warning",
|
|
@@ -51,35 +55,35 @@ async function C(C, w) {
|
|
|
51
55
|
line: null,
|
|
52
56
|
file: null
|
|
53
57
|
});
|
|
54
|
-
function
|
|
55
|
-
return
|
|
56
|
-
version:
|
|
58
|
+
function H(e) {
|
|
59
|
+
return p({
|
|
60
|
+
version: M.version,
|
|
57
61
|
files: e,
|
|
58
|
-
loaders:
|
|
59
|
-
strips:
|
|
60
|
-
root:
|
|
62
|
+
loaders: B,
|
|
63
|
+
strips: F,
|
|
64
|
+
root: O
|
|
61
65
|
});
|
|
62
66
|
}
|
|
63
|
-
let
|
|
64
|
-
if (
|
|
65
|
-
let
|
|
67
|
+
let U = H(L);
|
|
68
|
+
if (U !== null) throw Error(U);
|
|
69
|
+
let W = v(B), G = h(O, P), K = r({
|
|
66
70
|
set: {
|
|
67
|
-
...
|
|
68
|
-
...
|
|
71
|
+
...j.env,
|
|
72
|
+
...D.env
|
|
69
73
|
},
|
|
70
|
-
version:
|
|
71
|
-
env:
|
|
72
|
-
execArgv:
|
|
73
|
-
setup:
|
|
74
|
-
root:
|
|
75
|
-
tsx:
|
|
76
|
-
}),
|
|
77
|
-
|
|
78
|
-
let
|
|
74
|
+
version: M.version,
|
|
75
|
+
env: R,
|
|
76
|
+
execArgv: P,
|
|
77
|
+
setup: G,
|
|
78
|
+
root: O,
|
|
79
|
+
tsx: W
|
|
80
|
+
}), q = g(), J = _(q, P, R.NODE_OPTIONS ?? "");
|
|
81
|
+
J.nodeOptions !== "" && (R.NODE_OPTIONS = J.nodeOptions);
|
|
82
|
+
let Y = Math.max(1, E.concurrency ?? w() - 1), X = process.platform !== "win32", Z = S.join(S.dirname(q), `reporter${S.extname(q)}`), Q = {
|
|
79
83
|
args: [
|
|
80
|
-
...
|
|
84
|
+
...J.args,
|
|
81
85
|
"--test-reporter",
|
|
82
|
-
|
|
86
|
+
C(Z).href,
|
|
83
87
|
"--test-reporter-destination",
|
|
84
88
|
"stderr",
|
|
85
89
|
"--test-reporter",
|
|
@@ -94,31 +98,33 @@ async function C(C, w) {
|
|
|
94
98
|
plan: null,
|
|
95
99
|
count: 0
|
|
96
100
|
},
|
|
97
|
-
|
|
98
|
-
testTimeout:
|
|
99
|
-
commonjs: !
|
|
100
|
-
checkTypeScript:
|
|
101
|
+
spares: X && k && V.length === 0 && c(z) ? o(Y) : 0,
|
|
102
|
+
testTimeout: d(P),
|
|
103
|
+
commonjs: !M.compiles,
|
|
104
|
+
checkTypeScript: H,
|
|
101
105
|
groups: /* @__PURE__ */ new Set(),
|
|
102
|
-
env:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
env: R,
|
|
107
|
+
workers: Y,
|
|
108
|
+
preload: q,
|
|
109
|
+
context: E,
|
|
110
|
+
files: L,
|
|
111
|
+
pipe: X,
|
|
112
|
+
node: A,
|
|
113
|
+
tsx: W
|
|
108
114
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
function $() {
|
|
116
|
+
for (let e of Q.groups) t(e);
|
|
117
|
+
}
|
|
118
|
+
return E.signal?.addEventListener("abort", $, { once: !0 }), {
|
|
119
|
+
close: () => ($(), Q.groups.clear(), Promise.resolve()),
|
|
114
120
|
runBatch: () => Promise.reject(/* @__PURE__ */ Error("The node-test adapter has no batch mode.")),
|
|
115
|
-
listTestFiles: () => Promise.resolve([...
|
|
116
|
-
runIsolated: (e) =>
|
|
117
|
-
cacheInputs: () => Promise.resolve(
|
|
118
|
-
dryRun: (e) =>
|
|
119
|
-
version:
|
|
120
|
-
workers:
|
|
121
|
-
diagnostics:
|
|
121
|
+
listTestFiles: () => Promise.resolve([...L, ...G]),
|
|
122
|
+
runIsolated: (e) => y(Q, e),
|
|
123
|
+
cacheInputs: () => Promise.resolve(K),
|
|
124
|
+
dryRun: (e) => x(Q, e),
|
|
125
|
+
version: M.version.slice(1),
|
|
126
|
+
workers: Q.workers,
|
|
127
|
+
diagnostics: N
|
|
122
128
|
};
|
|
123
129
|
}
|
|
124
|
-
export {
|
|
130
|
+
export { E as startNodeTestSession };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Starts a test process detached, as the leader of a process group of its own,
|
|
4
|
+
* without stdin. Until the process ends or fails to start, mootant stops its
|
|
5
|
+
* group when it exits or gets a signal that ends it (`trackProcessGroup`), and
|
|
6
|
+
* the session holds the group in `groups`, which it stops when it closes. With
|
|
7
|
+
* a pipe, the process gets file descriptor 3 too, through which mootant sends
|
|
8
|
+
* its unit.
|
|
9
|
+
*
|
|
10
|
+
* @param options - Binary, arguments, environment, working directory, where the
|
|
11
|
+
* output goes, the session's groups and whether the unit comes through a
|
|
12
|
+
* pipe.
|
|
13
|
+
* @param options.output - `pipe` to read stdout and stderr, else `ignore`.
|
|
14
|
+
* @param options.groups - Process groups of the session's test processes.
|
|
15
|
+
* @param options.env - Environment variables of the process.
|
|
16
|
+
* @param options.args - Arguments after the Node binary.
|
|
17
|
+
* @param options.pipe - Whether the process gets file descriptor 3.
|
|
18
|
+
* @param options.node - Node binary.
|
|
19
|
+
* @param options.cwd - Working directory of the process.
|
|
20
|
+
* @returns The child process, which may still be starting.
|
|
21
|
+
*/
|
|
22
|
+
export declare function startTestProcess(options: {
|
|
23
|
+
output: 'ignore' | 'pipe';
|
|
24
|
+
env: NodeJS.ProcessEnv;
|
|
25
|
+
groups: Set<number>;
|
|
26
|
+
args: string[];
|
|
27
|
+
pipe: boolean;
|
|
28
|
+
node: string;
|
|
29
|
+
cwd: string;
|
|
30
|
+
}): ChildProcess;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { trackProcessGroup as e } from "../shared/track-process-group.js";
|
|
2
|
+
import { spawn as t } from "node:child_process";
|
|
3
|
+
function n(n) {
|
|
4
|
+
let { output: r, groups: i } = n, a = [
|
|
5
|
+
"ignore",
|
|
6
|
+
r,
|
|
7
|
+
r
|
|
8
|
+
];
|
|
9
|
+
n.pipe && a.push("pipe");
|
|
10
|
+
let o = t(n.node, n.args, {
|
|
11
|
+
windowsHide: !0,
|
|
12
|
+
cwd: n.cwd,
|
|
13
|
+
env: n.env,
|
|
14
|
+
detached: !0,
|
|
15
|
+
stdio: a
|
|
16
|
+
}), { pid: s } = o;
|
|
17
|
+
if (s !== void 0) {
|
|
18
|
+
let t = e(s);
|
|
19
|
+
i.add(s);
|
|
20
|
+
function n() {
|
|
21
|
+
t(), i.delete(s);
|
|
22
|
+
}
|
|
23
|
+
o.once("exit", n), o.once("error", n);
|
|
24
|
+
}
|
|
25
|
+
return o;
|
|
26
|
+
}
|
|
27
|
+
export { n as startTestProcess };
|
|
@@ -20,7 +20,8 @@ export interface NodeTestHandle {
|
|
|
20
20
|
context: AdapterContext
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Environment variables of every test process, before `MOOTANT_UNIT
|
|
23
|
+
* Environment variables of every test process, before `MOOTANT_UNIT` or
|
|
24
|
+
* `MOOTANT_UNIT_FD`.
|
|
24
25
|
*/
|
|
25
26
|
env: NodeJS.ProcessEnv
|
|
26
27
|
|
|
@@ -64,6 +65,12 @@ export interface NodeTestHandle {
|
|
|
64
65
|
*/
|
|
65
66
|
workers: number
|
|
66
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Most spare test processes of an isolated run at once
|
|
70
|
+
* (`createSpareProcesses`), or 0 for none.
|
|
71
|
+
*/
|
|
72
|
+
spares: number
|
|
73
|
+
|
|
67
74
|
/**
|
|
68
75
|
* Flags of every test process before its test file: mootant's preload first,
|
|
69
76
|
* unless `NODE_OPTIONS` loads modules and carries it, then the command's
|
|
@@ -71,6 +78,12 @@ export interface NodeTestHandle {
|
|
|
71
78
|
*/
|
|
72
79
|
args: string[]
|
|
73
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Whether test processes get their unit as a line on file descriptor 3 rather
|
|
83
|
+
* than in `MOOTANT_UNIT`; not on Windows.
|
|
84
|
+
*/
|
|
85
|
+
pipe: boolean
|
|
86
|
+
|
|
74
87
|
/**
|
|
75
88
|
* Whether the test processes load tsx, so `tsconfig.json` files decide how
|
|
76
89
|
* modules compile.
|
|
@@ -174,7 +174,7 @@ export interface NodeTestEnd {
|
|
|
174
174
|
concurrent: boolean
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
*
|
|
177
|
+
* Files and directories among `files` that the code changed itself, sorted.
|
|
178
178
|
*/
|
|
179
179
|
modified: string[]
|
|
180
180
|
|
|
@@ -194,8 +194,8 @@ export interface NodeTestEnd {
|
|
|
194
194
|
reached: boolean
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
*
|
|
198
|
-
* one included, sorted.
|
|
197
|
+
* Files and directories the code read through `node:fs` that count as inputs
|
|
198
|
+
* (`createInputFilter`), a missing one included, sorted.
|
|
199
199
|
*/
|
|
200
200
|
files: string[]
|
|
201
201
|
|
|
@@ -34,6 +34,11 @@ export interface NodeTestUnit {
|
|
|
34
34
|
*/
|
|
35
35
|
commonjs: boolean
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Work directory of the run, whose files never count as inputs.
|
|
39
|
+
*/
|
|
40
|
+
directory: string
|
|
41
|
+
|
|
37
42
|
/**
|
|
38
43
|
* Whether the unit stops starting tests once a test failed after the mutant
|
|
39
44
|
* was reached. False in a dry run.
|
|
@@ -46,7 +51,7 @@ export interface NodeTestUnit {
|
|
|
46
51
|
plan: string
|
|
47
52
|
|
|
48
53
|
/**
|
|
49
|
-
* Project root;
|
|
54
|
+
* Project root; reads outside it count too (`createInputFilter`).
|
|
50
55
|
*/
|
|
51
56
|
root: string
|
|
52
57
|
|