mootant 0.2.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/collect-jest-dependencies.d.ts +8 -6
- 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/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 +4 -3
- package/dist/adapters/jest/types/worker-channel.d.ts +7 -0
- package/dist/adapters/jest/worker/boot-worker.d.ts +5 -4
- 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 +25 -20
- package/dist/adapters/jest/worker/vm-setup.js +1 -1
- package/dist/adapters/jest/worker/worker.js +1 -1
- 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 -52
- 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 +18 -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/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 +17 -14
- package/dist/adapters/shared/create-input-filter.js +2 -2
- 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-reads.d.ts +13 -12
- package/dist/adapters/shared/track-file-reads.js +71 -71
- package/dist/adapters/shared/track-process-group.d.ts +2 -1
- package/dist/adapters/shared/track-process-group.js +7 -2
- package/dist/adapters/vitest/build-isolated-facts.d.ts +4 -3
- package/dist/adapters/vitest/collect-dependencies.d.ts +11 -5
- package/dist/adapters/vitest/collect-dependencies.js +36 -27
- 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 +43 -28
- 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 +1 -2
- package/dist/adapters/vitest/is-virtual-module.js +1 -1
- 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-unit-inputs.d.ts +2 -1
- package/dist/adapters/vitest/run-dry.js +1 -1
- package/dist/adapters/vitest/run-plan.d.ts +10 -8
- package/dist/adapters/vitest/run-plan.js +1 -1
- package/dist/adapters/vitest/run-specifications.d.ts +9 -2
- package/dist/adapters/vitest/run-specifications.js +22 -12
- package/dist/adapters/vitest/runner.d.ts +60 -29
- package/dist/adapters/vitest/runner.js +109 -86
- 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/vitest-session-state.d.ts +9 -8
- package/dist/adapters/vitest/types/vitest-worker.d.ts +48 -33
- 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/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/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 +1 -0
- package/dist/cli/html/client/main.js +1 -1
- package/dist/cli/html/client/render-overview.d.ts +3 -3
- 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-run-report.js +1 -0
- package/dist/cli/report/format-command.d.ts +5 -0
- package/dist/cli/report/format-command.js +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 +32 -24
- package/dist/cli/terminal/create-spinner.d.ts +1 -2
- package/dist/cli/terminal/create-spinner.js +23 -32
- 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 +3 -2
- 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 +8 -7
- package/dist/core/cache/hash-files.js +17 -11
- 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 +48 -22
- package/dist/core/cache/prepare-run-cache.js +86 -73
- 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/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/generate/collect-candidates.d.ts +5 -1
- package/dist/core/generate/collect-candidates.js +125 -97
- package/dist/core/generate/generate-file-mutants.js +6 -5
- package/dist/core/index.d.ts +18 -0
- package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-comparison-plan.d.ts +2 -2
- package/dist/core/mutators/shared/get-default-option-skip.d.ts +2 -2
- package/dist/core/mutators/shared/get-group-constant.d.ts +2 -2
- package/dist/core/mutators/shared/get-literal-skip.d.ts +3 -3
- 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/leave-now-skip.d.ts +2 -2
- package/dist/core/mutators/shared/no-op-callback-skip.d.ts +2 -2
- 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/regex/collect-pattern-changes.d.ts +2 -2
- package/dist/core/regex/create-regex-replacement.d.ts +2 -2
- package/dist/core/run/apply-isolated-result.d.ts +22 -14
- package/dist/core/run/apply-isolated-result.js +45 -26
- 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-unit-evidence.d.ts +13 -7
- 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/read-isolated-unit.d.ts +6 -3
- 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-isolated-rounds.d.ts +16 -12
- package/dist/core/run/run-isolated-rounds.js +3 -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 +34 -2
- package/dist/core/run-mutants.js +356 -216
- package/dist/core/skips/skip-rules.d.ts +3 -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 +4 -2
- package/dist/types/adapter/isolated-plan.d.ts +2 -1
- package/dist/types/adapter/isolated-result.d.ts +3 -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/config/plugin.d.ts +11 -2
- package/dist/types/config/run-config.d.ts +10 -0
- package/dist/types/config/run-settings.d.ts +6 -0
- package/dist/types/mutant/core-note.d.ts +12 -0
- package/dist/types/mutant/diagnostic.d.ts +1 -0
- package/dist/types/mutant/registered-skip-rule.d.ts +11 -0
- 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 +14 -7
- package/dist/types/mutant/skipped-mutant.d.ts +6 -6
- package/dist/types/mutator/mutator.d.ts +3 -2
- package/dist/types/mutator/registered-mutator.d.ts +8 -0
- package/dist/types/regex/regex-change.d.ts +2 -2
- package/dist/types/report/html-report.d.ts +3 -2
- package/dist/types/report/list-report-skipped.d.ts +3 -2
- package/dist/types/report/run-report.d.ts +11 -2
- package/dist/types/report/slim-run-report.d.ts +1 -1
- package/dist/types/run/isolated-evidence.d.ts +3 -2
- package/dist/types/run/isolated-reason.d.ts +2 -1
- package/dist/types/run/run-durations.d.ts +8 -3
- package/dist/types/run/run-event.d.ts +10 -7
- package/dist/types/run/run-result.d.ts +11 -2
- package/dist/types/run/run-state.d.ts +21 -0
- package/dist/types/run/try-cause.d.ts +2 -1
- package/package.json +1 -1
- package/readme.md +85 -68
- package/skills/mootant/SKILL.md +36 -19
- package/skills/mootant/references/mutators.md +29 -23
- package/dist/adapters/node-test/list-flag-values.js +0 -9
- /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/{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
|
@@ -13,14 +13,16 @@ import { SerializedConfig, RunnerTestSuite, RunnerTestCase, RunnerTestFile, Test
|
|
|
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
|
|
@@ -62,6 +64,11 @@ export default class Runner extends TestRunner {
|
|
|
62
64
|
* when the user's tests run concurrently.
|
|
63
65
|
*/
|
|
64
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;
|
|
65
72
|
/**
|
|
66
73
|
* Milliseconds the hooks around each test may take by Vitest's own hook
|
|
67
74
|
* timeouts, by test id; filled in a dry run.
|
|
@@ -108,6 +115,11 @@ export default class Runner extends TestRunner {
|
|
|
108
115
|
* Mutants a try of this unit already failed with; they are not tried again.
|
|
109
116
|
*/
|
|
110
117
|
private readonly killed;
|
|
118
|
+
/**
|
|
119
|
+
* Names of the values of `provide` and `define` the code read since the
|
|
120
|
+
* runner was created (`trackValues`).
|
|
121
|
+
*/
|
|
122
|
+
private readonly values;
|
|
111
123
|
/**
|
|
112
124
|
* Ids of the tests that run, or null to run every test.
|
|
113
125
|
*/
|
|
@@ -232,20 +244,29 @@ export default class Runner extends TestRunner {
|
|
|
232
244
|
*/
|
|
233
245
|
private file;
|
|
234
246
|
/**
|
|
235
|
-
* Creates the runner of one test file,
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
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.
|
|
241
261
|
*
|
|
242
262
|
* @param config - Serialized configuration of the project.
|
|
243
263
|
*/
|
|
244
264
|
constructor(config: SerializedConfig);
|
|
245
265
|
/**
|
|
246
|
-
* Claims a unit, waits for the unit before it of the same test file
|
|
247
|
-
*
|
|
248
|
-
* 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.
|
|
249
270
|
*
|
|
250
271
|
* @param paths - Absolute path of the test file.
|
|
251
272
|
*/
|
|
@@ -374,29 +395,39 @@ export default class Runner extends TestRunner {
|
|
|
374
395
|
private aroundTry;
|
|
375
396
|
/**
|
|
376
397
|
* Starts recording the files the test code reads through `node:fs` that count
|
|
377
|
-
* as inputs, inside the project root or outside it (`createInputFilter`),
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* `env/<hash>.json` of the
|
|
382
|
-
* the variables read were.
|
|
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.
|
|
383
404
|
*
|
|
384
405
|
* @param snapshot - Whether to write the environment of the project.
|
|
385
406
|
*/
|
|
386
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;
|
|
387
416
|
/**
|
|
388
417
|
* Stops recording what the code reads once the unit ended and lists what it
|
|
389
418
|
* depended on: what the test file depended on when its file suite ended, with
|
|
390
419
|
* what the worker evaluated, required and read through `node:fs` until now,
|
|
391
|
-
* the environment variables
|
|
392
|
-
* itself. A test environment other than
|
|
393
|
-
* the runner exists, so what its module
|
|
394
|
-
* to `process.env` and `node:fs` they
|
|
395
|
-
* 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.
|
|
396
426
|
*
|
|
397
427
|
* @returns What the unit depended on, sorted, or null when it cannot tell,
|
|
398
428
|
* with the names of the environment variables it read, `*` for all of them,
|
|
399
|
-
* 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.
|
|
400
431
|
*/
|
|
401
432
|
private stopTracking;
|
|
402
433
|
/**
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
import { installMutantRuntime as e } from "../../core/runtime/install-mutant-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import { enableCompileCache as t } from "../shared/enable-compile-cache.js";
|
|
3
|
+
import { watchWorkerClose as n } from "./worker/watch-worker-close.js";
|
|
4
|
+
import { trackMetaDefines as r } from "./worker/track-meta-defines.js";
|
|
5
|
+
import { listDependencies as i } from "./worker/list-dependencies.js";
|
|
6
|
+
import { getErrorMessage as a } from "../shared/get-error-message.js";
|
|
7
|
+
import { VITEST_VARIABLES as o } from "./worker/vitest-variables.js";
|
|
8
|
+
import { interceptStrays as s } from "./worker/intercept-strays.js";
|
|
9
|
+
import { readWorkerPlan as c } from "./worker/read-worker-plan.js";
|
|
10
|
+
import { raceTryTimeout as l } from "./worker/race-try-timeout.js";
|
|
11
|
+
import { writeOutRecord as u } from "./worker/write-out-record.js";
|
|
12
|
+
import { installTryHook as d } from "./worker/install-try-hook.js";
|
|
13
|
+
import { writeHeartbeat as f } from "./worker/write-heartbeat.js";
|
|
14
|
+
import { findHookError as p } from "./worker/find-hook-error.js";
|
|
15
|
+
import { getHookBudget as m } from "./worker/get-hook-budget.js";
|
|
16
|
+
import { VALUE_PREFIXES as h } from "./worker/value-prefixes.js";
|
|
17
|
+
import { readTryFacts as g } from "./worker/read-try-facts.js";
|
|
18
|
+
import { captureClock as _ } from "../shared/capture-clock.js";
|
|
19
|
+
import { trackInputs as v } from "../shared/track-inputs.js";
|
|
20
|
+
import { getFileHash as y } from "./worker/get-file-hash.js";
|
|
21
|
+
import { waitForTurn as b } from "./worker/wait-for-turn.js";
|
|
22
|
+
import { trackValues as x } from "./worker/track-values.js";
|
|
23
|
+
import { encodeStray as S } from "./worker/encode-stray.js";
|
|
24
|
+
import { orderTests as C } from "./worker/order-tests.js";
|
|
25
|
+
import { claimUnit as w } from "./worker/claim-unit.js";
|
|
26
|
+
import { listTests as T } from "./worker/list-tests.js";
|
|
27
|
+
import * as E from "node:module";
|
|
28
|
+
import { closeSync as D, openSync as O, rmSync as k, writeFileSync as A } from "node:fs";
|
|
29
|
+
import j from "node:path";
|
|
30
|
+
import { createHash as M } from "node:crypto";
|
|
31
|
+
import { builtinEnvironments as N } from "vitest/runtime";
|
|
32
|
+
import { TestRunner as P } from "vitest";
|
|
33
|
+
const F = 2 ** 31 - 1;
|
|
34
|
+
let I = _(), L = Date.now.bind(Date);
|
|
35
|
+
var R = class extends P {
|
|
32
36
|
coverSink = { add: (e) => {
|
|
33
37
|
for (let t of this.activeCovers) t.add(e);
|
|
34
38
|
} };
|
|
35
39
|
runtime = e();
|
|
36
40
|
records = /* @__PURE__ */ new Map();
|
|
41
|
+
scripted;
|
|
37
42
|
hookBudgets = /* @__PURE__ */ new Map();
|
|
38
43
|
planned = /* @__PURE__ */ new Map();
|
|
39
44
|
loadCovers = /* @__PURE__ */ new Set();
|
|
@@ -47,6 +52,7 @@ var N = class extends A {
|
|
|
47
52
|
beatDescriptor = null;
|
|
48
53
|
inputs = null;
|
|
49
54
|
killed = /* @__PURE__ */ new Set();
|
|
55
|
+
values = /* @__PURE__ */ new Set();
|
|
50
56
|
runnable = null;
|
|
51
57
|
activeCovers = [];
|
|
52
58
|
lastMutant = null;
|
|
@@ -77,43 +83,49 @@ var N = class extends A {
|
|
|
77
83
|
file = "";
|
|
78
84
|
constructor(e) {
|
|
79
85
|
super(e), this.options = this.injectValue("mootant");
|
|
80
|
-
let { directory:
|
|
81
|
-
|
|
86
|
+
let { directory: r, repeat: i, mode: o } = this.options;
|
|
87
|
+
t(E, r), this.scripted = this.options.defines?.[e.name ?? ""] ?? {}, x(Reflect.get(this, "workerState"), {
|
|
88
|
+
snapshotEnvironment: e.snapshotEnvironment,
|
|
89
|
+
scripted: this.scripted,
|
|
90
|
+
defines: e.defines
|
|
91
|
+
}, (e) => {
|
|
92
|
+
this.values.add(e);
|
|
93
|
+
}), this.sequential = o === "batch" || o === "dry" && i, o === "dry" && (this.config.includeTaskLocation = !0), this.beatFile = j.join(r, "beat", `${process.pid}.json`), D(O(j.join(r, "worker", String(process.pid)), "w")), s(Reflect.get(this, "workerState"), (e, t) => {
|
|
82
94
|
this.onStray(e, t);
|
|
83
95
|
});
|
|
84
|
-
let
|
|
85
|
-
if (
|
|
86
|
-
let e = Reflect.get(this, "workerState"),
|
|
96
|
+
let c = this.onCleanupWorkerContext;
|
|
97
|
+
if (c !== void 0) {
|
|
98
|
+
let e = Reflect.get(this, "workerState"), t = n(Reflect.get(e.ctx, "traces"));
|
|
87
99
|
this.onCleanupWorkerContext = (e) => {
|
|
88
|
-
this.endsInTeardown = !0,
|
|
89
|
-
e !== null && (this.hookError ??=
|
|
90
|
-
})),
|
|
100
|
+
this.endsInTeardown = !0, t !== null && (this.endsOnClose = !0, t((e) => {
|
|
101
|
+
e !== null && (this.hookError ??= a(e.error)), this.finishUnit();
|
|
102
|
+
})), c(() => this.tearDown(e));
|
|
91
103
|
};
|
|
92
104
|
}
|
|
93
105
|
}
|
|
94
106
|
async onBeforeCollect(e) {
|
|
95
107
|
let { runtime: t, options: n } = this, r = e[0];
|
|
96
|
-
this.file = r, this.started =
|
|
97
|
-
let i =
|
|
108
|
+
this.file = r, this.started = I.now(), this.booted = L(), t.hitLimit = Infinity, t.coverage = null, t.reached = !1, t.active = null, t.hits = 0;
|
|
109
|
+
let i = y(r, this.config.name ?? ""), a = j.join(n.directory, "out");
|
|
98
110
|
if (n.mode === "dry") {
|
|
99
|
-
t.coverage = this.loadCovers, this.outName = `${i}-${process.pid}`, this.out =
|
|
111
|
+
t.coverage = this.loadCovers, this.outName = `${i}-${process.pid}`, this.out = O(j.join(a, `${this.outName}.jsonl`), "a"), this.beat(n.timeouts.file, null), this.startTracking(!0);
|
|
100
112
|
return;
|
|
101
113
|
}
|
|
102
|
-
let
|
|
103
|
-
if (
|
|
114
|
+
let o = c(n.directory, i), s = o === null ? null : w(n.directory, i, o.units.length);
|
|
115
|
+
if (s === null) {
|
|
104
116
|
this.runnable = /* @__PURE__ */ new Set();
|
|
105
117
|
return;
|
|
106
118
|
}
|
|
107
|
-
await
|
|
108
|
-
index:
|
|
119
|
+
(n.parallel !== !0 || n.mode !== "isolated") && await b(n.directory, {
|
|
120
|
+
index: s,
|
|
109
121
|
hash: i
|
|
110
|
-
},
|
|
122
|
+
}, I), this.started = I.now(), this.unitIndex = o.indexes[s], this.outName = `${i}-${s}`, this.out = O(j.join(a, `${this.outName}.jsonl`), "a");
|
|
111
123
|
let l = this.config.hookTimeout > 0 ? this.config.hookTimeout : Infinity;
|
|
112
124
|
if (n.mode === "isolated") {
|
|
113
|
-
let e =
|
|
125
|
+
let e = o.units[s];
|
|
114
126
|
t.active = e.mutant, t.hitLimit = e.limits.hitLimit, this.budget = e.limits.timeout, this.config.hookTimeout = Math.min(l, e.limits.timeout);
|
|
115
127
|
} else {
|
|
116
|
-
let e =
|
|
128
|
+
let e = o.units[s];
|
|
117
129
|
this.batch = e;
|
|
118
130
|
for (let t of e.tests) this.planned.set(t.id, t);
|
|
119
131
|
t.hitLimit = e.limits.load.hitLimit, this.budget = e.limits.total, this.config.hookTimeout = Math.min(l, e.tests.reduce((e, t) => Math.max(e, t.timeout), e.limits.load.timeout));
|
|
@@ -121,19 +133,19 @@ var N = class extends A {
|
|
|
121
133
|
this.beat(this.budget, null), this.startTracking(!1);
|
|
122
134
|
}
|
|
123
135
|
onCollected(e) {
|
|
124
|
-
this.loadDuration =
|
|
136
|
+
this.loadDuration = I.now() - this.started;
|
|
125
137
|
let { options: t } = this;
|
|
126
138
|
for (let n of e) {
|
|
127
139
|
if (t.mode === "dry") {
|
|
128
140
|
let { hookTimeout: e } = this.config;
|
|
129
|
-
for (let t of
|
|
130
|
-
this.outsideBudget = t.timeouts.file +
|
|
141
|
+
for (let t of T(n)) this.hookBudgets.set(t.id, m(t, e));
|
|
142
|
+
this.outsideBudget = t.timeouts.file + m(n, e), this.beat(this.outsideBudget, null);
|
|
131
143
|
}
|
|
132
|
-
this.concurrent =
|
|
144
|
+
this.concurrent = C(n, this.sequential) || this.concurrent, d(n, (e, t) => this.aroundTry(e, t)), n.result?.state === "fail" && (this.loadError ??= a(n.result.errors?.[0]));
|
|
133
145
|
}
|
|
134
146
|
if (this.batch === null || this.runnable !== null) return;
|
|
135
|
-
let n = e.flatMap((e) =>
|
|
136
|
-
this.runnable = new Set(n.slice(0,
|
|
147
|
+
let n = e.flatMap((e) => T(e)), r = n.findLastIndex((e) => this.planned.has(e.id));
|
|
148
|
+
this.runnable = new Set(n.slice(0, r + 1).map((e) => e.id));
|
|
137
149
|
}
|
|
138
150
|
async onBeforeRunTask(e) {
|
|
139
151
|
if (this.finishEnded(), await super.onBeforeRunTask(e), e.mode !== "run" || e.type !== "test") return;
|
|
@@ -153,11 +165,11 @@ var N = class extends A {
|
|
|
153
165
|
});
|
|
154
166
|
}
|
|
155
167
|
onStray(e, t) {
|
|
156
|
-
let n =
|
|
168
|
+
let n = S(e, t, this.strayCount);
|
|
157
169
|
this.strayCount += 1;
|
|
158
170
|
let r = this.listActive();
|
|
159
171
|
if (r.length > 0) for (let e of r) e.strays.push(n);
|
|
160
|
-
else this.options.mode === "batch" && this.lastTest !== null && this.out !== null ?
|
|
172
|
+
else this.options.mode === "batch" && this.lastTest !== null && this.out !== null ? u(this.out, {
|
|
161
173
|
mutant: this.lastMutant,
|
|
162
174
|
test: this.lastTest,
|
|
163
175
|
kind: "late",
|
|
@@ -174,12 +186,12 @@ var N = class extends A {
|
|
|
174
186
|
async runTask(e) {
|
|
175
187
|
let t = this.records.get(e)?.current ?? null;
|
|
176
188
|
t === null && e.context.skip();
|
|
177
|
-
let n =
|
|
178
|
-
r === null ? await n() : t.timedOut = await
|
|
189
|
+
let n = P.getTestFn(e), { deadline: r } = t;
|
|
190
|
+
r === null ? await n() : t.timedOut = await l(n, Math.max(0, r - I.now()), I);
|
|
179
191
|
}
|
|
180
192
|
onAfterRunFiles(e) {
|
|
181
193
|
for (let e of this.records.values()) this.finishTest(e);
|
|
182
|
-
if (this.loadError === null) for (let t of e) this.hookError ??=
|
|
194
|
+
if (this.loadError === null) for (let t of e) this.hookError ??= p(t);
|
|
183
195
|
this.filesEnded = !0, this.endsInTeardown || this.finishUnit(), super.onAfterRunFiles(e);
|
|
184
196
|
}
|
|
185
197
|
async onAfterRetryTask(e, t) {
|
|
@@ -196,7 +208,7 @@ var N = class extends A {
|
|
|
196
208
|
if (this.finishTry(e), this.abandoned) return;
|
|
197
209
|
let { runtime: t } = this, { mode: n } = this.options, { test: r } = e, i = e.next;
|
|
198
210
|
e.next += 1;
|
|
199
|
-
let a =
|
|
211
|
+
let a = I.now(), o = {
|
|
200
212
|
attempt: r.result.errors?.length ?? 0,
|
|
201
213
|
covers: n === "dry" ? /* @__PURE__ */ new Set() : null,
|
|
202
214
|
retries: r.result.retryCount ?? 0,
|
|
@@ -221,10 +233,10 @@ var N = class extends A {
|
|
|
221
233
|
finishTry(e) {
|
|
222
234
|
let { current: t } = e;
|
|
223
235
|
if (t === null) return;
|
|
224
|
-
e.current = null,
|
|
225
|
-
let { runtime: n } = this, { mode: r } = this.options, { test: i } = t, a =
|
|
236
|
+
e.current = null, z(t);
|
|
237
|
+
let { runtime: n } = this, { mode: r } = this.options, { test: i } = t, a = g(i, n, {
|
|
226
238
|
covers: t.covers === null ? null : [...t.covers].toSorted(),
|
|
227
|
-
duration:
|
|
239
|
+
duration: I.now() - t.started,
|
|
228
240
|
hits: n.hits - t.hits,
|
|
229
241
|
timedOut: t.timedOut,
|
|
230
242
|
strays: t.strays,
|
|
@@ -239,9 +251,9 @@ var N = class extends A {
|
|
|
239
251
|
let { hits: n } = e;
|
|
240
252
|
t === "batch" ? n += this.outsideHits : t === "dry" && (n -= this.inside.hits);
|
|
241
253
|
let { dependencies: r, ...i } = this.stopTracking();
|
|
242
|
-
|
|
254
|
+
u(this.out, {
|
|
243
255
|
covers: [...this.loadCovers].toSorted(),
|
|
244
|
-
duration:
|
|
256
|
+
duration: I.now() - this.started,
|
|
245
257
|
loadDuration: this.loadDuration,
|
|
246
258
|
environment: i.environment,
|
|
247
259
|
concurrent: this.concurrent,
|
|
@@ -256,52 +268,63 @@ var N = class extends A {
|
|
|
256
268
|
dependencies: r,
|
|
257
269
|
kind: "end",
|
|
258
270
|
hits: n
|
|
259
|
-
}),
|
|
271
|
+
}), D(O(j.join(this.options.directory, "done", this.outName), "w"));
|
|
260
272
|
}
|
|
261
|
-
this.beatDescriptor !== null && (
|
|
273
|
+
this.beatDescriptor !== null && (D(this.beatDescriptor), this.beatDescriptor = null), k(this.beatFile, { force: !0 }), e.hitLimit = Infinity, e.coverage = null, e.active = null;
|
|
262
274
|
}
|
|
263
275
|
async aroundTry(e, t) {
|
|
264
276
|
let n = this.records.get(e), { current: r } = n, i = e.result.retryCount ?? 0;
|
|
265
|
-
if (r === null || r.timedOut ? this.startTry(n) : i > r.retries ? (r.attempt = e.result.errors.length, r.state = void 0, r.retries = i) : r.repetitions + 1 === n.group ? this.startTry(n) :
|
|
266
|
-
let t = e.timeout > 0 ? e.timeout : Infinity, r =
|
|
277
|
+
if (r === null || r.timedOut ? this.startTry(n) : i > r.retries ? (r.attempt = e.result.errors.length, r.state = void 0, r.retries = i) : r.repetitions + 1 === n.group ? this.startTry(n) : z(r), this.options.mode === "dry") {
|
|
278
|
+
let t = e.timeout > 0 ? e.timeout : Infinity, r = I.now();
|
|
267
279
|
n.current.watch = r + this.options.timeouts.test + t + this.hookBudgets.get(e.id), this.beatDry(r);
|
|
268
280
|
}
|
|
269
281
|
await t(), await new Promise((e) => {
|
|
270
|
-
|
|
282
|
+
I.setImmediate(e);
|
|
271
283
|
});
|
|
272
284
|
}
|
|
273
285
|
startTracking(e) {
|
|
274
|
-
let { directory: t, root: n } = this.options, r =
|
|
286
|
+
let { directory: t, root: n } = this.options, r = v({
|
|
275
287
|
directory: t,
|
|
276
288
|
root: n
|
|
277
289
|
}, {
|
|
278
290
|
holder: Reflect.get(this, "workerState"),
|
|
279
|
-
ignored:
|
|
291
|
+
ignored: o
|
|
280
292
|
});
|
|
281
|
-
if (this.inputs = r, e) {
|
|
293
|
+
if (this.inputs = r, this.trackMeta(), e) {
|
|
282
294
|
let e = {};
|
|
283
|
-
for (let [t, n = ""] of Object.entries(r.real)) e[t] =
|
|
295
|
+
for (let [t, n = ""] of Object.entries(r.real)) e[t] = M("sha256").update(n).digest("hex");
|
|
284
296
|
try {
|
|
285
|
-
|
|
297
|
+
A(j.join(t, "env", `${y("", this.config.name ?? "")}.json`), JSON.stringify({
|
|
286
298
|
project: this.config.name ?? "",
|
|
287
299
|
variables: e
|
|
288
300
|
}), { flag: "wx" });
|
|
289
301
|
} catch {}
|
|
290
302
|
}
|
|
291
303
|
}
|
|
304
|
+
trackMeta() {
|
|
305
|
+
let e = Object.keys(this.scripted).filter((e) => e.startsWith("import.meta.") && !this.scripted[e]);
|
|
306
|
+
if (e.length === 0) return;
|
|
307
|
+
let { snapshotSerializers: t, snapshotEnvironment: n, diff: i } = this.config;
|
|
308
|
+
if (n !== void 0 || typeof i == "string" || t.length > 0 || !r(Reflect.get(this, "workerState"), Reflect.get(this, "moduleRunner"), {
|
|
309
|
+
record: (e) => {
|
|
310
|
+
this.values.add(e);
|
|
311
|
+
},
|
|
312
|
+
keys: e
|
|
313
|
+
})) for (let t of e) this.values.add(`${h.define}${t}`);
|
|
314
|
+
}
|
|
292
315
|
stopTracking() {
|
|
293
316
|
let e = /* @__PURE__ */ new Set([...this.dependencies ?? [], ...this.listDependencies(void 0)]), { environment: t, modified: n } = this.inputs.stop();
|
|
294
317
|
this.inputs = null;
|
|
295
318
|
let r = Reflect.get(this, "workerState"), i = [...e].toSorted();
|
|
296
319
|
return {
|
|
297
|
-
dependencies: Object.hasOwn(
|
|
298
|
-
environment: t,
|
|
320
|
+
dependencies: Object.hasOwn(N, r.ctx.environment.name) ? i : null,
|
|
321
|
+
environment: [...t, ...this.values].toSorted(),
|
|
299
322
|
modified: n
|
|
300
323
|
};
|
|
301
324
|
}
|
|
302
325
|
beat(e, t) {
|
|
303
|
-
this.sequence += 1, this.beatDescriptor ??=
|
|
304
|
-
budget: Math.min(Math.max(0, e),
|
|
326
|
+
this.sequence += 1, this.beatDescriptor ??= O(this.beatFile, "w"), this.beatLength = f(this.beatDescriptor, {
|
|
327
|
+
budget: Math.min(Math.max(0, e), F) + 1e3,
|
|
305
328
|
name: t?.fullTestName ?? null,
|
|
306
329
|
mutant: this.runtime.active,
|
|
307
330
|
sequence: this.sequence,
|
|
@@ -314,12 +337,12 @@ var N = class extends A {
|
|
|
314
337
|
finishTest(e) {
|
|
315
338
|
this.finishTry(e);
|
|
316
339
|
let { test: t } = e;
|
|
317
|
-
this.records.delete(t),
|
|
340
|
+
this.records.delete(t), u(this.out, {
|
|
318
341
|
line: t.location?.line ?? null,
|
|
319
342
|
name: t.fullTestName,
|
|
320
343
|
tries: e.tries,
|
|
321
344
|
kind: "test"
|
|
322
|
-
}), delete t.result.errors, this.options.mode === "dry" ? this.beatDry() : this.beat(this.budget - (
|
|
345
|
+
}), delete t.result.errors, this.options.mode === "dry" ? this.beatDry() : this.beat(this.budget - (I.now() - this.started), null);
|
|
323
346
|
}
|
|
324
347
|
routeCoverage() {
|
|
325
348
|
let { runtime: e } = this;
|
|
@@ -327,19 +350,19 @@ var N = class extends A {
|
|
|
327
350
|
let [t] = this.activeCovers;
|
|
328
351
|
e.coverage = t === void 0 ? this.loadCovers : this.activeCovers.length === 1 ? t : this.coverSink;
|
|
329
352
|
}
|
|
330
|
-
beatDry(e =
|
|
353
|
+
beatDry(e = I.now()) {
|
|
331
354
|
let t = null;
|
|
332
355
|
for (let e of this.listActive()) (t === null || e.watch > t.watch) && (t = e);
|
|
333
356
|
t === null ? this.beat(this.outsideBudget, null) : this.beat(t.watch - e, t.test);
|
|
334
357
|
}
|
|
335
358
|
listDependencies(e) {
|
|
336
|
-
return
|
|
359
|
+
return i(Reflect.get(this, "workerState"), [...Object.keys(E.createRequire(import.meta.url).cache), ...this.inputs.files], e);
|
|
337
360
|
}
|
|
338
361
|
async tearDown(e) {
|
|
339
362
|
try {
|
|
340
363
|
await e();
|
|
341
364
|
} catch (e) {
|
|
342
|
-
throw this.hookError ??=
|
|
365
|
+
throw this.hookError ??= a(e), e;
|
|
343
366
|
} finally {
|
|
344
367
|
this.endsOnClose || this.finishUnit();
|
|
345
368
|
}
|
|
@@ -353,8 +376,8 @@ var N = class extends A {
|
|
|
353
376
|
for (let e of this.records.values()) (this.sequential || e.test.mode === "skip") && this.finishTest(e);
|
|
354
377
|
}
|
|
355
378
|
};
|
|
356
|
-
function
|
|
379
|
+
function z(e) {
|
|
357
380
|
let t = e.test.result.errors ?? [];
|
|
358
381
|
e.errors.push(...t.slice(e.attempt)), (e.state === "fail" || e.state === "skip") && (e.outcome = e.state), e.repetitions += 1, e.attempt = t.length, e.state = void 0;
|
|
359
382
|
}
|
|
360
|
-
export {
|
|
383
|
+
export { R as default };
|
|
@@ -10,7 +10,11 @@ import { AdapterContext } from '../../types/adapter/adapter-context.js';
|
|
|
10
10
|
* context's `onOutput` when there is one. Its sequencer spreads out the units
|
|
11
11
|
* of one test file (`createInterleavedSequencer`). The mutant runtime of this
|
|
12
12
|
* process records the mutant sites switched code evaluates here, outside the
|
|
13
|
-
* workers, such as in a `globalSetup` file, until the session closes.
|
|
13
|
+
* workers, such as in a `globalSetup` file, until the session closes. The
|
|
14
|
+
* listeners of SIGINT and SIGTERM that Vitest adds as it starts are dropped
|
|
15
|
+
* (`dropSignalListeners`), and once the run is interrupted the pool stops its
|
|
16
|
+
* workers and starts none (`MootantForksPool.interrupt`), so an interrupted run
|
|
17
|
+
* closes Vitest, which removes its temporary files, before the process ends.
|
|
14
18
|
*
|
|
15
19
|
* @param context - Switched files, work directory, concurrency and root.
|
|
16
20
|
* @param options - Options of the adapter.
|