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
|
@@ -38,10 +38,11 @@ export interface RunTextOptions {
|
|
|
38
38
|
/**
|
|
39
39
|
* Formats a run report as text: a header with the command and the test runner;
|
|
40
40
|
* the dry run, the mutants with how many were ignored or reused from the cache,
|
|
41
|
-
* and time
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* and time, which names fast mode and parallel units when they were on; the
|
|
42
|
+
* counts by status and the score; in a terminal, the files with the lowest
|
|
43
|
+
* scores below 100, five at most; a section for each status to act on
|
|
44
|
+
* (`survived`, `no coverage`, `errors`) with its count and its mutants grouped
|
|
45
|
+
* by file, each as a diff of its source lines under a heading with the
|
|
45
46
|
* location, mutator and short id, the reason of an error or the likeliest test
|
|
46
47
|
* file to extend of another mutant under the diff; and a hint to re-check the
|
|
47
48
|
* first survivor, else the first listed mutant. Killed, timed-out and ignored
|
|
@@ -55,25 +55,25 @@ function p(e, t) {
|
|
|
55
55
|
}, _, i)}\n\n${_}`;
|
|
56
56
|
}
|
|
57
57
|
function m(e, t) {
|
|
58
|
-
let { summary: n } = e, { duration: r } = n, a = n.totalIgnored > 0 ? `, ${n.totalIgnored} ignored` : "", o = n.totalCached !== null && n.totalCached > 0 ? `, ${n.totalCached} cached` : "", c = [
|
|
58
|
+
let { summary: n } = e, { duration: r } = n, a = n.totalIgnored > 0 ? `, ${n.totalIgnored} ignored` : "", o = n.totalCached !== null && n.totalCached > 0 ? `, ${n.totalCached} cached` : "", c = n.runs.dry === void 0 && n.totalTests > 0, l = [
|
|
59
59
|
`start ${s(r.startup)}`,
|
|
60
60
|
`dry run ${s(r.dryRun)}`,
|
|
61
61
|
...r.batch === null ? [] : [`batch ${s(r.batch)}`],
|
|
62
62
|
`isolated ${s(r.isolated)}`
|
|
63
|
-
],
|
|
64
|
-
["dry run", `${i(n.totalTests, "test")} in ${s(r.dryRun)}`],
|
|
63
|
+
], u = [
|
|
64
|
+
["dry run", c ? `${i(n.totalTests, "test")} of an earlier run` : `${i(n.totalTests, "test")} in ${s(r.dryRun)}`],
|
|
65
65
|
["mutants", `${n.totalMutants} in ${i(n.totalFiles, "file")}${a}${o}`],
|
|
66
|
-
["time", `${s(r.total)}${e.mode === "fast" ? " in fast mode" : ""} (${
|
|
67
|
-
], { staticCost:
|
|
68
|
-
if (
|
|
69
|
-
let e = Math.max(1,
|
|
70
|
-
|
|
66
|
+
["time", `${s(r.total)}${e.mode === "fast" ? " in fast mode" : ""}${e.parallelUnits ? " with parallel units" : ""} (${l.join(", ")})`]
|
|
67
|
+
], { staticCost: d } = n;
|
|
68
|
+
if (d.length > 0 && r.total >= 3e4 && r.isolated > r.total * .25) {
|
|
69
|
+
let e = Math.max(1, d.reduce((e, t) => e + t.duration, 0));
|
|
70
|
+
u.push(["most test time", d.slice(0, 3).map((t) => `${t.file} ${Math.round(t.duration / e * 100)}%`).join(", ")]);
|
|
71
71
|
}
|
|
72
72
|
if (t) {
|
|
73
73
|
let e = f.filter((e) => n.runs[e] !== void 0).map((e) => `${n.runs[e]} ${e}`);
|
|
74
|
-
|
|
74
|
+
u.push(["runs", e.length === 0 ? "none" : e.join(", ")]);
|
|
75
75
|
}
|
|
76
|
-
return
|
|
76
|
+
return u;
|
|
77
77
|
}
|
|
78
78
|
function h(n, o) {
|
|
79
79
|
let { colors: s } = o, { ellipsis: c } = a(o.unicode), l = n.slice(0, 5), u = Math.min(e(l.map((e) => e.file)), Math.max(16, o.width - 38)), d = l.map((e) => {
|
|
@@ -3,16 +3,16 @@ import { RunReport } from '../../types/report/run-report.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Shapes a run report as `--json` prints it: the counts and scores with the
|
|
5
5
|
* total duration, the schema version, diagnostics, command, which mutants are
|
|
6
|
-
* listed, runner, preset, mode,
|
|
7
|
-
* that output cut short keeps the rest, the
|
|
8
|
-
* ignored one keeps its position, mutator,
|
|
9
|
-
* focus (`slimListMutant`), the ignore
|
|
10
|
-
* and cause of the verdict, `path` only
|
|
11
|
-
* covering tests, its likeliest test files,
|
|
12
|
-
* re-check command, each only when set. A
|
|
13
|
-
* with `--all`, keeps only its position,
|
|
14
|
-
* killed it and a batch `path`. Fields that
|
|
15
|
-
* report is what `--json --verbose` prints.
|
|
6
|
+
* listed, runner, preset, mode, parallel units when they were on, the `--since`
|
|
7
|
+
* revision when given and, last, so that output cut short keeps the rest, the
|
|
8
|
+
* mutants. A mutant to act on or an ignored one keeps its position, mutator,
|
|
9
|
+
* status, scope, source lines and focus (`slimListMutant`), the ignore
|
|
10
|
+
* directive and its reason, the message and cause of the verdict, `path` only
|
|
11
|
+
* for a batch verdict, the number of covering tests, its likeliest test files,
|
|
12
|
+
* the first covering test and the re-check command, each only when set. A
|
|
13
|
+
* killed or timed-out mutant, listed with `--all`, keeps only its position,
|
|
14
|
+
* mutator, status, the test file that killed it and a batch `path`. Fields that
|
|
15
|
+
* are null are left out; the full report is what `--json --verbose` prints.
|
|
16
16
|
*
|
|
17
17
|
* @param report - Full report of a run.
|
|
18
18
|
* @returns Report as `--json` prints it.
|
|
@@ -11,7 +11,11 @@ import { RunOptions } from './parse-arguments.js';
|
|
|
11
11
|
* --verbose` the full one. A terminal also gets the files with the lowest
|
|
12
12
|
* scores. When the run asks for an HTML report, it is written after the report
|
|
13
13
|
* is printed and its path goes to stderr; a report that cannot be written is an
|
|
14
|
-
* error.
|
|
14
|
+
* error. SIGHUP, SIGINT or SIGTERM during the run (`watchInterrupts`) ends the
|
|
15
|
+
* progress at once, without the line of the running phase, and interrupts the
|
|
16
|
+
* run, which stops its test processes and removes its files; then nothing is
|
|
17
|
+
* printed and the process ends by that signal, after 5 seconds even when the
|
|
18
|
+
* cleanup did not end.
|
|
15
19
|
*
|
|
16
20
|
* @param options - Options of the run command.
|
|
17
21
|
*/
|
package/dist/cli/run-mutation.js
CHANGED
|
@@ -10,50 +10,58 @@ import { createRunProgress as c } from "./create-run-progress.js";
|
|
|
10
10
|
import { getFileScores as l } from "./report/get-file-scores.js";
|
|
11
11
|
import { getTextStyle as u } from "./terminal/get-text-style.js";
|
|
12
12
|
import { formatCommand as d } from "./report/format-command.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import m from "
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
import { watchInterrupts as f } from "./watch-interrupts.js";
|
|
14
|
+
import { runMutants as p } from "../core/run-mutants.js";
|
|
15
|
+
import { version as m } from "../package.js";
|
|
16
|
+
import h from "node:path";
|
|
17
|
+
async function g(i) {
|
|
18
|
+
let { verbose: a, json: o, all: m, ...h } = i, g = u(process.stderr), v = f(), y = c(g, a);
|
|
19
|
+
v.signal.addEventListener("abort", () => {
|
|
20
|
+
y.stop();
|
|
21
|
+
});
|
|
18
22
|
try {
|
|
19
|
-
let c = await
|
|
23
|
+
let c = await p({
|
|
20
24
|
onProgress: (e) => {
|
|
21
|
-
|
|
25
|
+
y.handle(e);
|
|
22
26
|
},
|
|
23
27
|
builtIns: r(),
|
|
24
|
-
|
|
28
|
+
signal: v.signal,
|
|
29
|
+
...h,
|
|
25
30
|
cwd: process.cwd()
|
|
26
31
|
});
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
if (v.end()) return;
|
|
33
|
+
y.finish();
|
|
34
|
+
let f = d("run", {
|
|
35
|
+
parallelUnits: i.parallelUnits,
|
|
29
36
|
incremental: i.incremental,
|
|
30
37
|
config: i.config,
|
|
31
38
|
preset: i.preset,
|
|
32
39
|
paths: i.paths,
|
|
33
40
|
fast: i.fast
|
|
34
|
-
}),
|
|
35
|
-
recheck:
|
|
36
|
-
all:
|
|
41
|
+
}), b = s(c, {
|
|
42
|
+
recheck: f,
|
|
43
|
+
all: m
|
|
37
44
|
});
|
|
38
|
-
o || t(
|
|
45
|
+
o || t(b.diagnostics, g), console.info(n(b, o ? "json" : "text", {
|
|
39
46
|
...!o && process.stdout.isTTY && { files: l(c) },
|
|
40
47
|
idLength: e(c.listedIds),
|
|
41
48
|
command: d("run", i),
|
|
42
49
|
style: u(process.stdout),
|
|
43
50
|
verbose: a,
|
|
44
|
-
recheck:
|
|
45
|
-
})),
|
|
51
|
+
recheck: f
|
|
52
|
+
})), b.summary.passed || (process.exitCode = 1), c.html !== null && await _(c, c.html, {
|
|
46
53
|
command: `${d("run", i)}${i.html ? " --html" : ""}`,
|
|
47
|
-
style:
|
|
48
|
-
recheck:
|
|
54
|
+
style: g,
|
|
55
|
+
recheck: f
|
|
49
56
|
});
|
|
50
57
|
} catch (e) {
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
if (v.end()) return;
|
|
59
|
+
y.finish();
|
|
60
|
+
let t = y.output(), { colors: n } = g;
|
|
53
61
|
t.trim() !== "" && console.error(`${n.gray("Output of the tests:")}\n${t.replace(/\n$/u, "")}\n`), console.error(`${n.red("Error:")} ${e.message}`), process.exitCode = 1;
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
|
-
async function
|
|
64
|
+
async function _(t, n, r) {
|
|
57
65
|
let { colors: s } = r.style, c = /* @__PURE__ */ new Date();
|
|
58
66
|
try {
|
|
59
67
|
let l = i(t, {
|
|
@@ -62,11 +70,11 @@ async function g(t, n, r) {
|
|
|
62
70
|
recheck: r.recheck,
|
|
63
71
|
command: r.command,
|
|
64
72
|
date: c.toISOString(),
|
|
65
|
-
version:
|
|
73
|
+
version: m
|
|
66
74
|
}), { formatHtmlReport: u } = await import("./html/format-html-report.js");
|
|
67
|
-
await a(n, u(l)), console.error(`${s.gray("html report:")} ${
|
|
75
|
+
await a(n, u(l)), console.error(`${s.gray("html report:")} ${h.relative(process.cwd(), n)}`);
|
|
68
76
|
} catch (e) {
|
|
69
77
|
console.error(`${s.red("Error:")} The HTML report could not be written to ${n}: ${e.message}`), process.exitCode = 1;
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
|
-
export {
|
|
80
|
+
export { g as runMutation };
|
|
@@ -27,8 +27,7 @@ export interface Spinner {
|
|
|
27
27
|
* In an interactive terminal the spinner redraws its row every 80 ms with the
|
|
28
28
|
* cursor hidden, asking for its text on every frame, so the text may show a
|
|
29
29
|
* live clock. Elsewhere it never animates: only the lines given to `print` are
|
|
30
|
-
* written.
|
|
31
|
-
* before the process exits.
|
|
30
|
+
* written.
|
|
32
31
|
*
|
|
33
32
|
* @param text - Gives the text next to the animation; called on every frame.
|
|
34
33
|
* @param colors - Color functions of the CLI.
|
|
@@ -17,46 +17,37 @@ const r = [
|
|
|
17
17
|
"\\",
|
|
18
18
|
"|",
|
|
19
19
|
"/"
|
|
20
|
-
], a = "\x1B[2K\x1B[1G"
|
|
21
|
-
function
|
|
22
|
-
let
|
|
23
|
-
function
|
|
20
|
+
], a = "\x1B[2K\x1B[1G";
|
|
21
|
+
function o(o, s) {
|
|
22
|
+
let c = process.stderr, l = e(), u = t() ? r : i, d = 0, f = 0, p = !1, m;
|
|
23
|
+
function h() {
|
|
24
24
|
let e = "\x1B[1G";
|
|
25
|
-
for (let t = 0; t <
|
|
26
|
-
return
|
|
25
|
+
for (let t = 0; t < f; t++) e += t === 0 ? a : `[1A${a}`;
|
|
26
|
+
return f = 0, e;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return `${
|
|
28
|
+
function g() {
|
|
29
|
+
return `${s.greenBright(u[d])} ${o()}`;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
let e =
|
|
33
|
-
|
|
31
|
+
function _() {
|
|
32
|
+
let e = g();
|
|
33
|
+
m = setTimeout(_, 80), c.write(`[?25l${h()}${e}`), f = n(e, c.columns), d = (d + 1) % u.length;
|
|
34
34
|
}
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
if (!
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
process.on(e, n = () => {
|
|
41
|
-
b.stop(), process.exit(t);
|
|
42
|
-
}), g.push([e, n]);
|
|
35
|
+
let v = {
|
|
36
|
+
print(e) {
|
|
37
|
+
if (!p) {
|
|
38
|
+
c.write(`${e}\n`);
|
|
39
|
+
return;
|
|
43
40
|
}
|
|
44
|
-
|
|
41
|
+
let t = g();
|
|
42
|
+
c.write(`${h()}${e}\n${t}`), f = n(t, c.columns);
|
|
45
43
|
},
|
|
46
44
|
stop() {
|
|
47
|
-
clearTimeout(h);
|
|
48
|
-
for (let [e, t] of g) process.off(e, t);
|
|
49
|
-
g = [], m && (m = !1, l.write(`${_()}[?25h`));
|
|
45
|
+
clearTimeout(m), p && (p = !1, c.write(`${h()}[?25h`));
|
|
50
46
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
l.write(`${e}\n`);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
let t = v();
|
|
57
|
-
l.write(`${_()}${e}\n${t}`), p = n(t, l.columns);
|
|
47
|
+
start() {
|
|
48
|
+
return l && (p = !0, _()), v;
|
|
58
49
|
}
|
|
59
50
|
};
|
|
60
|
-
return
|
|
51
|
+
return v;
|
|
61
52
|
}
|
|
62
|
-
export {
|
|
53
|
+
export { o as createSpinner };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Watch of the signals that interrupt a run.
|
|
3
|
+
*/
|
|
4
|
+
interface Interrupts {
|
|
5
|
+
/**
|
|
6
|
+
* Aborted on the first signal.
|
|
7
|
+
*/
|
|
8
|
+
signal: AbortSignal;
|
|
9
|
+
/**
|
|
10
|
+
* Ends the watch once the run is over. Without a signal, it removes the
|
|
11
|
+
* listeners of the watch and returns false. After a signal, it ends the
|
|
12
|
+
* process by that signal, as the process would end without the listeners;
|
|
13
|
+
* where the signal does not end it, on Windows, which cannot raise a signal
|
|
14
|
+
* again, or while another listener of the signal remains, it exits with the
|
|
15
|
+
* code a shell gives for the signal, 128 plus its number.
|
|
16
|
+
*
|
|
17
|
+
* @returns False when no signal came.
|
|
18
|
+
*/
|
|
19
|
+
end(): boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Watches SIGHUP, SIGINT and SIGTERM for a run, so that it can stop its test
|
|
23
|
+
* processes and remove its files before the process ends. The first signal sets
|
|
24
|
+
* the exit code a shell gives for it, 128 plus its number, and aborts the
|
|
25
|
+
* returned signal; later ones are ignored while the run cleans up, since npm
|
|
26
|
+
* and other wrappers send the terminal's SIGINT a second time. The cleanup gets
|
|
27
|
+
* 5 seconds: past them, such as when a global teardown hangs, the work
|
|
28
|
+
* directories of the run are removed at once (`removeLiveWorkDirectories`) and
|
|
29
|
+
* the process ends by the signal anyway. They are removed too when something
|
|
30
|
+
* else ends the process meanwhile, such as a listener of the project's code
|
|
31
|
+
* that exits. The listeners stay until the process ends, as a listener that
|
|
32
|
+
* removed itself would let other listeners raise the signal again before the
|
|
33
|
+
* cleanup. SIGQUIT, the quit key, keeps ending the process at once. Errors of
|
|
34
|
+
* writes to standard error are ignored from the start: after a terminal closed
|
|
35
|
+
* a write fails with EIO, which would otherwise end the process before the run
|
|
36
|
+
* cleaned up.
|
|
37
|
+
*
|
|
38
|
+
* @returns The watch, with the signal to pass to the run.
|
|
39
|
+
*/
|
|
40
|
+
export declare function watchInterrupts(): Interrupts;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { removeLiveWorkDirectories as e } from "../core/run/remove-live-work-directories.js";
|
|
2
|
+
import { constants as t } from "node:os";
|
|
3
|
+
const n = [
|
|
4
|
+
"SIGHUP",
|
|
5
|
+
"SIGINT",
|
|
6
|
+
"SIGTERM"
|
|
7
|
+
];
|
|
8
|
+
function r() {
|
|
9
|
+
let r = new AbortController(), i = null, a;
|
|
10
|
+
function o(n) {
|
|
11
|
+
i === null && (i = n, process.exitCode = 128 + t.signals[n], a = setTimeout(() => {
|
|
12
|
+
e(), s(n);
|
|
13
|
+
}, 5e3), r.abort());
|
|
14
|
+
}
|
|
15
|
+
function s(e) {
|
|
16
|
+
clearTimeout(a);
|
|
17
|
+
for (let e of n) process.off(e, o);
|
|
18
|
+
process.platform !== "win32" && process.kill(process.pid, e), process.exit();
|
|
19
|
+
}
|
|
20
|
+
function c() {}
|
|
21
|
+
process.stderr.on("error", c), process.on("exit", e);
|
|
22
|
+
for (let e of n) process.on(e, o);
|
|
23
|
+
return {
|
|
24
|
+
end: () => {
|
|
25
|
+
if (i !== null) return s(i), !0;
|
|
26
|
+
for (let e of n) process.off(e, o);
|
|
27
|
+
return process.off("exit", e), process.stderr.off("error", c), !1;
|
|
28
|
+
},
|
|
29
|
+
signal: r.signal
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export { r as watchInterrupts };
|
|
@@ -2,13 +2,14 @@ import { RunState } from '../../types/run/run-state.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Applies cached isolated evidence before the isolated rounds, by the rule of
|
|
4
4
|
* fresh units (`decideEvidence`): for every undecided mutant on the isolated
|
|
5
|
-
* path, a valid cached kill in one of its test files is that file's
|
|
6
|
-
* and a valid cached reached pass counts as `Survived` evidence;
|
|
7
|
-
* its test file off the list. The cache
|
|
8
|
-
*
|
|
9
|
-
* kill
|
|
10
|
-
*
|
|
11
|
-
* left with nothing to run
|
|
5
|
+
* path, a valid cached kill or timeout in one of its test files is that file's
|
|
6
|
+
* evidence, and a valid cached reached pass counts as `Survived` evidence;
|
|
7
|
+
* either takes its test file off the list. The cache holds no error and no
|
|
8
|
+
* timeout but a confirmed one by the hit limit, so a file before the first
|
|
9
|
+
* cached kill or timeout without a valid entry still runs, and the cached one
|
|
10
|
+
* decides only if that file brings no kill or timeout of its own; files after
|
|
11
|
+
* it can no longer decide and are dropped. A mutant left with nothing to run
|
|
12
|
+
* that never ran is `cached`.
|
|
12
13
|
*
|
|
13
14
|
* @param state - State of the run with its cache, updated in place.
|
|
14
15
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hash of the code of mootant's build, which the build writes in place of this
|
|
3
|
+
* text (`vite.config.ts`), so a reinstall of the same package keeps the cache
|
|
4
|
+
* keys and a build of other code under the same version changes them. Sources
|
|
5
|
+
* keep this text, and `getBuildId` gives them an id of their own. Pass it on
|
|
6
|
+
* only as a value: the build may inline a constant that code compares and fold
|
|
7
|
+
* the comparison before the hash is written.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BUILD_HASH: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Version of the cache file
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Version of the format of the cache file and of the saved dry run, and of the
|
|
3
|
+
* recipe of their keys; it is part of their file names, so a file of another
|
|
4
|
+
* version is never read. Bump it when any of them changes.
|
|
5
5
|
*/
|
|
6
|
-
export declare const CACHE_VERSION =
|
|
6
|
+
export declare const CACHE_VERSION = 8;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ProjectTree } from '../../types/cache/project-tree.js';
|
|
2
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
3
|
+
/**
|
|
4
|
+
* Tells whether the inputs of a saved dry run (`DrySnapshot`) are unchanged,
|
|
5
|
+
* the cheapest check first, before a run builds its switched files for the key:
|
|
6
|
+
* the environment variables of the main process, the files the dry run and the
|
|
7
|
+
* cache keys depended on, then everything under the project root
|
|
8
|
+
* (`hashProjectTree`), which a run that starts the test runner hashes anyway. A
|
|
9
|
+
* file that is now a device, a pipe or a socket (`UNKNOWN_HASH`) has another
|
|
10
|
+
* hash than any saved one, which never names such a file.
|
|
11
|
+
*
|
|
12
|
+
* @param snapshot - Saved dry run of an earlier run.
|
|
13
|
+
* @param run - Environment, root and tree of this run.
|
|
14
|
+
* @param run.environment - Environment variables of the main process as the run
|
|
15
|
+
* started, before a test runner could set any.
|
|
16
|
+
* @param run.root - Project root, for the paths of the reason.
|
|
17
|
+
* @param run.tree - Hashes everything under the project root, once per run.
|
|
18
|
+
* @returns Null when the inputs are unchanged, else the end of a sentence that
|
|
19
|
+
* tells what changed, such as `src/a.test.ts changed`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function checkDrySnapshot(snapshot: DrySnapshot, run: {
|
|
22
|
+
tree(): Promise<ProjectTree | null>;
|
|
23
|
+
environment: NodeJS.ProcessEnv;
|
|
24
|
+
root: string;
|
|
25
|
+
}): Promise<string | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { listVariableHashes as e } from "./list-variable-hashes.js";
|
|
2
|
+
import { getDisplayPath as t } from "../run/get-display-path.js";
|
|
3
|
+
import { createDigest as n } from "./create-digest.js";
|
|
4
|
+
import { hashFiles as r } from "./hash-files.js";
|
|
5
|
+
async function i(i, a) {
|
|
6
|
+
let o = e(i.variables.map(([e]) => e), a.environment);
|
|
7
|
+
if (n(o) !== n(i.variables)) return "an environment variable changed";
|
|
8
|
+
let s = await r(i.files.map(([e]) => e)), c = i.files.find(([e, t]) => s.get(e) !== t);
|
|
9
|
+
if (c !== void 0) return `${t(c[0], a.root)} changed`;
|
|
10
|
+
let l = await a.tree();
|
|
11
|
+
return l === null ? "mootant cannot read every directory and link of the project" : l.hash === i.tree ? null : "a file of the project was added, removed or changed";
|
|
12
|
+
}
|
|
13
|
+
export { i as checkDrySnapshot };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates the error thrown inside a run that replays a saved dry run once the
|
|
3
|
+
* saved dry run turns out to be stale, a mutant has no valid cached verdict and
|
|
4
|
+
* needs the test runner, or the replay fails otherwise. The run then starts
|
|
5
|
+
* over with the test runner; nothing ran or was written before. The message is
|
|
6
|
+
* the note the run gives.
|
|
7
|
+
*
|
|
8
|
+
* @param reason - Why the saved dry run cannot decide the run, as the end of a
|
|
9
|
+
* sentence, such as `src/a.test.ts changed`.
|
|
10
|
+
* @returns Error named `DryReuseMiss`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createDryReuseMiss(reason: string): Error;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
2
|
+
import { DryRunResult } from '../../types/adapter/dry-run-result.js';
|
|
3
|
+
import { CacheInputs } from '../../types/adapter/cache-inputs.js';
|
|
4
|
+
import { ProjectTree } from '../../types/cache/project-tree.js';
|
|
5
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
6
|
+
import { Diagnostic } from '../../types/mutant/diagnostic.js';
|
|
7
|
+
import { RunCache } from '../../types/cache/run-cache.js';
|
|
8
|
+
/**
|
|
9
|
+
* What a saved dry run is built from.
|
|
10
|
+
*/
|
|
11
|
+
interface SnapshotInput {
|
|
12
|
+
/**
|
|
13
|
+
* Outcome of the dry phase: the final dry run, the messages of the files
|
|
14
|
+
* whose mutants get no verdict, by display path, its diagnostics and its runs
|
|
15
|
+
* of the test runner.
|
|
16
|
+
*/
|
|
17
|
+
phase: {
|
|
18
|
+
errors: ReadonlyMap<string, string>;
|
|
19
|
+
diagnostics: Diagnostic[];
|
|
20
|
+
dry: DryRunResult;
|
|
21
|
+
runs: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Environment variables of the main process as the run started, before the
|
|
25
|
+
* test runner could set any, such as `NODE_ENV`.
|
|
26
|
+
*/
|
|
27
|
+
environment: NodeJS.ProcessEnv;
|
|
28
|
+
/**
|
|
29
|
+
* Everything under the project root before the test runner started
|
|
30
|
+
* (`hashProjectTree`), or null when a directory or link could not be read.
|
|
31
|
+
*/
|
|
32
|
+
tree: ProjectTree | null;
|
|
33
|
+
/**
|
|
34
|
+
* Live session of the run.
|
|
35
|
+
*/
|
|
36
|
+
session: AdapterSession;
|
|
37
|
+
/**
|
|
38
|
+
* What the session said every verdict depends on, as `prepareRunCache` asked
|
|
39
|
+
* it once.
|
|
40
|
+
*/
|
|
41
|
+
inputs: CacheInputs;
|
|
42
|
+
/**
|
|
43
|
+
* Test files and setup files of the session.
|
|
44
|
+
*/
|
|
45
|
+
testFiles: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Cache of the run after it was saved.
|
|
48
|
+
*/
|
|
49
|
+
cache: RunCache;
|
|
50
|
+
/**
|
|
51
|
+
* Key of the run (`getDrySnapshotKey`).
|
|
52
|
+
*/
|
|
53
|
+
key: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Builds the saved dry run of a run whose cache was saved (`DrySnapshot`), with
|
|
57
|
+
* the hashes the cache keys took in after the dry run, and each environment
|
|
58
|
+
* variable that test code read in the dry run or in a unit whose evidence the
|
|
59
|
+
* cache reused or stored. A run gets none when a test file of the dry run has
|
|
60
|
+
* no key: the adapter cannot tell what it depended on, or one of its
|
|
61
|
+
* dependencies changed during the run or has unknown content (`UNKNOWN_HASH`),
|
|
62
|
+
* so the saved files never name such a file. Nor does a run whose dry phase ran
|
|
63
|
+
* the tests more than once, as after a test file that failed and passed when it
|
|
64
|
+
* ran again, since a fresh dry run may not repeat what it kept, and nor does
|
|
65
|
+
* one with a directory or link of the project it could not read.
|
|
66
|
+
*
|
|
67
|
+
* @param input - Dry phase, session, cache, environment, tree and key.
|
|
68
|
+
* @returns The saved dry run, or null when the run cannot be replayed.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createDrySnapshot(input: SnapshotInput): DrySnapshot | null;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { listVariableHashes as e } from "./list-variable-hashes.js";
|
|
2
|
+
import { compareCodeUnits as t } from "../compare-code-units.js";
|
|
3
|
+
function n(n) {
|
|
4
|
+
let { session: r, phase: i, cache: a, tree: o } = n;
|
|
5
|
+
if (o === null || a.dependencies.size !== i.dry.files.length || i.runs !== 1) return null;
|
|
6
|
+
let s = /* @__PURE__ */ new Set([...a.environment, ...[...a.dependencies.values()].flat()]);
|
|
7
|
+
return {
|
|
8
|
+
variables: e([...i.dry.files.flatMap((e) => e.environment ?? []), ...[...a.inputs.values(), ...a.pending.values()].flatMap((e) => e.environment.map(([e]) => e))], n.environment),
|
|
9
|
+
session: {
|
|
10
|
+
diagnostics: [...r.diagnostics ?? []],
|
|
11
|
+
version: r.version ?? null,
|
|
12
|
+
workers: r.workers ?? null,
|
|
13
|
+
inputs: n.inputs
|
|
14
|
+
},
|
|
15
|
+
files: [...s].toSorted(t).map((e) => [e, a.hashes.get(e) ?? null]),
|
|
16
|
+
phase: {
|
|
17
|
+
diagnostics: i.diagnostics,
|
|
18
|
+
errors: [...i.errors],
|
|
19
|
+
dry: i.dry
|
|
20
|
+
},
|
|
21
|
+
testFiles: n.testFiles,
|
|
22
|
+
version: 8,
|
|
23
|
+
tree: o.hash,
|
|
24
|
+
key: n.key
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export { n as createDrySnapshot };
|
|
@@ -58,6 +58,21 @@ interface RunCacheInput {
|
|
|
58
58
|
* Entries and inputs read from the cache file.
|
|
59
59
|
*/
|
|
60
60
|
stored: StoredCache;
|
|
61
|
+
/**
|
|
62
|
+
* Whether isolated timeouts by the hit limit are stored and reused: the count
|
|
63
|
+
* of site evaluations does not depend on the load of the machine, so such a
|
|
64
|
+
* timeout is as repeatable as a kill among runs that switch the same files
|
|
65
|
+
* (`switched`). False in fast mode, whose dry run tries each test twice and
|
|
66
|
+
* so gives other limits.
|
|
67
|
+
*/
|
|
68
|
+
timeouts: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Digest of the files the run switched. The hit counts of a unit and its
|
|
71
|
+
* limits cover only their sites, so the keys of a timeout by the hit limit
|
|
72
|
+
* take it in: a run that switches other files, as a run of only some mutants
|
|
73
|
+
* does, never reuses it.
|
|
74
|
+
*/
|
|
75
|
+
switched: string;
|
|
61
76
|
/**
|
|
62
77
|
* Project root; slots name test files relative to it.
|
|
63
78
|
*/
|
|
@@ -81,8 +96,11 @@ interface RunCacheInput {
|
|
|
81
96
|
* than the dry run of its test file, such as a module only the mutant loads or
|
|
82
97
|
* an environment variable only it reads: evidence stores those inputs, and is
|
|
83
98
|
* valid only while each of them is unchanged too. Evidence of a run whose
|
|
84
|
-
* inputs are unknown is not stored. Kills by a crash
|
|
85
|
-
* machine and are never stored, and neither
|
|
99
|
+
* inputs are unknown is not stored. Kills by a crash and timeouts by the timer
|
|
100
|
+
* or a hang depend on the load of the machine and are never stored, and neither
|
|
101
|
+
* are errors; an isolated timeout by the hit limit does not and is stored and
|
|
102
|
+
* reused outside fast mode (`timeouts`), by runs that switch the same files
|
|
103
|
+
* (`switched`), whose sites its hit counts cover.
|
|
86
104
|
*
|
|
87
105
|
* @param input - Stored entries, test file keys, source hashes, mutant regions,
|
|
88
106
|
* the mode and the dry run.
|