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
|
@@ -1,70 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { getTestFileKey as e } from "./get-test-file-key.js";
|
|
2
|
+
import { getDisplayPath as t } from "./get-display-path.js";
|
|
3
|
+
import { pluralize as n } from "../text/pluralize.js";
|
|
4
|
+
import { classifyTry as r } from "./classify-try.js";
|
|
5
|
+
function i(e, t, n) {
|
|
6
|
+
let { request: i, facts: o, unit: s } = n, { analysis: c } = e, l = o.tests.filter((e) => e.failed || e.timedOut), [u] = l;
|
|
7
|
+
if (o.hits > s.limits.hitLimit) {
|
|
8
|
+
let [e] = l.toSorted((e, t) => t.hits - e.hits);
|
|
6
9
|
return {
|
|
7
|
-
message: e?.message ??
|
|
10
|
+
message: e?.message ?? o.loadError ?? o.hookError,
|
|
8
11
|
test: e?.test ?? null,
|
|
9
12
|
cause: "hit-limit",
|
|
10
13
|
status: "Timeout",
|
|
11
|
-
file:
|
|
14
|
+
file: s.file
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
|
-
if (
|
|
17
|
+
if (o.incomplete === "hang") return {
|
|
15
18
|
status: "Timeout",
|
|
16
|
-
file:
|
|
19
|
+
file: s.file,
|
|
17
20
|
message: null,
|
|
18
21
|
cause: "hang",
|
|
19
22
|
test: null
|
|
20
23
|
};
|
|
21
|
-
if (
|
|
22
|
-
test:
|
|
24
|
+
if (o.incomplete === "crash") return {
|
|
25
|
+
test: u?.test ?? null,
|
|
23
26
|
status: "Killed",
|
|
24
|
-
file:
|
|
27
|
+
file: s.file,
|
|
25
28
|
cause: "crash",
|
|
26
29
|
message: null
|
|
27
30
|
};
|
|
28
|
-
let
|
|
29
|
-
for (let
|
|
30
|
-
|
|
31
|
-
let
|
|
32
|
-
...
|
|
33
|
-
reached:
|
|
34
|
-
strays:
|
|
35
|
-
},
|
|
36
|
-
if (
|
|
37
|
-
message: i === "stray-error" ?
|
|
38
|
-
status:
|
|
39
|
-
file:
|
|
40
|
-
test:
|
|
31
|
+
let d = t.static && o.reached;
|
|
32
|
+
for (let e of o.tests) {
|
|
33
|
+
d ||= e.reached;
|
|
34
|
+
let t = c.strayTests.has(e.test) ? [] : e.strays, { outcome: n, cause: i } = r({
|
|
35
|
+
...e,
|
|
36
|
+
reached: d,
|
|
37
|
+
strays: t
|
|
38
|
+
}, s.limits, "isolated");
|
|
39
|
+
if (n === "killed" || n === "timeout") return {
|
|
40
|
+
message: i === "stray-error" ? t[0] : e.message,
|
|
41
|
+
status: n === "killed" ? "Killed" : "Timeout",
|
|
42
|
+
file: s.file,
|
|
43
|
+
test: e.test,
|
|
41
44
|
cause: i
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
|
-
return
|
|
45
|
-
message:
|
|
47
|
+
return o.timedOut ? o.reached ? {
|
|
48
|
+
message: o.hookError,
|
|
46
49
|
cause: "time-limit",
|
|
47
50
|
status: "Timeout",
|
|
48
|
-
file:
|
|
51
|
+
file: s.file,
|
|
49
52
|
test: null
|
|
50
|
-
} :
|
|
51
|
-
message:
|
|
53
|
+
} : a(e, t, n) : o.loadError === null ? o.reached && o.hookError !== null ? {
|
|
54
|
+
message: o.hookError,
|
|
52
55
|
cause: "hook-error",
|
|
53
56
|
status: "Killed",
|
|
54
|
-
file:
|
|
57
|
+
file: s.file,
|
|
55
58
|
test: null
|
|
56
|
-
} :
|
|
57
|
-
message:
|
|
59
|
+
} : o.reached && o.strays.length > 0 && !c.strayFiles.has(i.file) ? {
|
|
60
|
+
message: o.strays[0],
|
|
58
61
|
cause: "stray-error",
|
|
59
62
|
status: "Killed",
|
|
60
|
-
file:
|
|
63
|
+
file: s.file,
|
|
61
64
|
test: null
|
|
62
|
-
} : a
|
|
63
|
-
message:
|
|
65
|
+
} : a(e, t, n) : {
|
|
66
|
+
message: o.loadError,
|
|
64
67
|
cause: "load-error",
|
|
65
68
|
status: "Killed",
|
|
66
|
-
file:
|
|
69
|
+
file: s.file,
|
|
67
70
|
test: null
|
|
68
71
|
};
|
|
69
72
|
}
|
|
70
|
-
|
|
73
|
+
function a(t, n, r) {
|
|
74
|
+
let { request: i, facts: a, unit: s } = r, { analysis: c } = t, l = a.tests.filter((e) => e.failed || e.timedOut), u = a.hookError ?? (a.strays.length > 0 && !c.strayFiles.has(i.file) ? a.strays[0] : null);
|
|
75
|
+
if (u !== null || l.length > 0) {
|
|
76
|
+
let r = a.tests.filter((e) => !e.failed && !e.timedOut), d = new Set(r.map((e) => e.test)), f = new Set(a.tests.map((e) => e.test)), p = r.some((e) => !c.tests.has(e.test)), m = n.coveredBy.filter((t) => !d.has(t) && (!p || f.has(t)) && e(c.tests.get(t)) === i.file);
|
|
77
|
+
if (m.length > 0) return {
|
|
78
|
+
message: o(t, s.file, {
|
|
79
|
+
stopped: l,
|
|
80
|
+
outside: u,
|
|
81
|
+
missed: m
|
|
82
|
+
}),
|
|
83
|
+
status: "Error",
|
|
84
|
+
cause: null,
|
|
85
|
+
file: null,
|
|
86
|
+
test: null
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return a.reached ? "survived" : null;
|
|
90
|
+
}
|
|
91
|
+
function o(e, r, i) {
|
|
92
|
+
let a = t(r, e.root), o = i.stopped.find((e) => i.missed.includes(e.test));
|
|
93
|
+
if (o !== void 0) {
|
|
94
|
+
let [t, n] = s(o);
|
|
95
|
+
return `"${c(e, o.test)}" in ${a} ${t} before it reached this mutant${n}`;
|
|
96
|
+
}
|
|
97
|
+
let l = i.missed.length, u = `${n(l, "test")} in ${a} that ${l === 1 ? "reaches" : "reach"} this mutant did not run`;
|
|
98
|
+
if (i.outside !== null) return `${u}: ${i.outside}`;
|
|
99
|
+
let d = i.stopped[0], [f, p] = s(d);
|
|
100
|
+
return `${u} after "${c(e, d.test)}" ${f}${p}`;
|
|
101
|
+
}
|
|
102
|
+
function s(e) {
|
|
103
|
+
let t = e.message === null ? "." : `: ${e.message}`;
|
|
104
|
+
return e.timedOut ? [e.message === null ? "ran past the time limit of its test file" : "ran out of time", t] : ["failed", t];
|
|
105
|
+
}
|
|
106
|
+
function c(e, t) {
|
|
107
|
+
return e.analysis.tests.get(t)?.name ?? t;
|
|
108
|
+
}
|
|
109
|
+
export { i as readIsolatedUnit };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the work directories of runs of this process that are not removed
|
|
3
|
+
* yet, at once and with everything in them, and forgets them, as the last
|
|
4
|
+
* cleanup before the process ends: a directory that cannot be removed is left
|
|
5
|
+
* as it is, so the process still ends.
|
|
6
|
+
*/
|
|
7
|
+
export declare function removeLiveWorkDirectories(): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LIVE_WORK_DIRECTORIES as e } from "./live-work-directories.js";
|
|
2
|
+
import { rmSync as t } from "node:fs";
|
|
3
|
+
function n() {
|
|
4
|
+
for (let n of e) try {
|
|
5
|
+
t(n, {
|
|
6
|
+
recursive: !0,
|
|
7
|
+
force: !0
|
|
8
|
+
});
|
|
9
|
+
} catch {}
|
|
10
|
+
e.clear();
|
|
11
|
+
}
|
|
12
|
+
export { n as removeLiveWorkDirectories };
|
|
@@ -8,18 +8,22 @@ import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
|
8
8
|
* and the second round, then twice as many as in the round before (2, 4, 8, and
|
|
9
9
|
* so on), so a mutant stops at the batch of the file that killed it, and a
|
|
10
10
|
* survivor, which must run every file, needs only a few rounds. Idle workers
|
|
11
|
-
* take no extra files: a unit can wait for another of
|
|
12
|
-
* pool runs units in order, so extra files may make a
|
|
13
|
-
* measurements showed no gain. A mutant whose timeout waits
|
|
14
|
-
* confirmation
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
11
|
+
* take no extra files: without parallel units a unit can wait for another of
|
|
12
|
+
* its test file, and the pool runs units in order, so extra files may make a
|
|
13
|
+
* round longer, and measurements showed no gain. A mutant whose timeout waits
|
|
14
|
+
* for its confirmation, or whose crash waits for one more run of its unit,
|
|
15
|
+
* takes no new files until that run decides it. The verdict comes from the
|
|
16
|
+
* first file with evidence (`decideEvidence`), so it does not depend on the
|
|
17
|
+
* batches or the workers. A round also runs the retries and confirmations of
|
|
18
|
+
* the round before. A request lives at most eight rounds, as a unit missing
|
|
19
|
+
* twice gets an `Error` verdict, and so does a second inconclusive unit of the
|
|
20
|
+
* mutant in the test file, a second crash of it kills, and a timeout is
|
|
21
|
+
* confirmed once, or twice when the confirmation of a timer goes over the hit
|
|
22
|
+
* limit, so the rounds end. While a round runs, its units count in the live
|
|
23
|
+
* verdict counts as they end (`previewIsolatedUnit`), and every mutant is
|
|
24
|
+
* counted again once its result is recorded (`countVerdicts`). With parallel
|
|
25
|
+
* units (`RunState.parallelUnits`) the units of one test file form no serial
|
|
26
|
+
* chain in the estimate of a round.
|
|
23
27
|
*
|
|
24
28
|
* @param session - Live test runner.
|
|
25
29
|
* @param state - State of the run, updated in place.
|
|
@@ -15,6 +15,7 @@ async function s(o, s, c) {
|
|
|
15
15
|
for (let [e, t] of m) for (let n of t) d.push({
|
|
16
16
|
mutant: e.mutant.id,
|
|
17
17
|
confirming: !1,
|
|
18
|
+
crashed: !1,
|
|
18
19
|
retried: !1,
|
|
19
20
|
raised: !1,
|
|
20
21
|
file: n
|
|
@@ -25,12 +26,12 @@ async function s(o, s, c) {
|
|
|
25
26
|
survivors: /* @__PURE__ */ new Set(),
|
|
26
27
|
retrying: /* @__PURE__ */ new Set()
|
|
27
28
|
};
|
|
28
|
-
for (let e of d) e.confirming ? _.confirming.add(e.mutant) : e.retried ? _.retrying.add(e.mutant) : u > 0 && _.survivors.add(e.mutant);
|
|
29
|
+
for (let e of d) e.confirming ? _.confirming.add(e.mutant) : e.retried || e.crashed || e.inconclusive === !0 ? _.retrying.add(e.mutant) : u > 0 && _.survivors.add(e.mutant);
|
|
29
30
|
for (let e of _.confirming) _.retrying.delete(e);
|
|
30
31
|
for (let e of [..._.confirming, ..._.retrying]) _.survivors.delete(e);
|
|
31
32
|
a(s, "isolated", {
|
|
32
33
|
costs: d.map((e, t) => e.confirming ? h.units[t].limits.timeout : i(s, e.file)),
|
|
33
|
-
chains: n(d.map((e) => e.file)),
|
|
34
|
+
chains: s.parallelUnits === !0 ? d.map((e, t) => t) : n(d.map((e) => e.file)),
|
|
34
35
|
confirming: _.confirming.size,
|
|
35
36
|
survivors: _.survivors.size,
|
|
36
37
|
retrying: _.retrying.size,
|
|
@@ -2,7 +2,7 @@ import { TestAdapter } from '../../types/adapter/test-adapter.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks the shape of a test runner adapter given in the configuration: an
|
|
4
4
|
* object with a kebab-case `name`, a boolean `batch`, a `start` function and,
|
|
5
|
-
* when present, a string `version`.
|
|
5
|
+
* when present, a string `version` and a boolean `parallelUnits`.
|
|
6
6
|
*
|
|
7
7
|
* @param value - Adapter object of the configuration.
|
|
8
8
|
* @param source - Where it came from, for messages, such as `run.runner`.
|
|
@@ -6,6 +6,6 @@ function n(e, t) {
|
|
|
6
6
|
return e;
|
|
7
7
|
}
|
|
8
8
|
function r(n) {
|
|
9
|
-
return t(n) ? typeof n.name != "string" || !e(n.name) ? "\"name\" must be a kebab-case name" : typeof n.batch == "boolean" ? typeof n.start == "function" ? n.version !== void 0 && typeof n.version != "string" ? "\"version\" must be a string" : null : "\"start\" must be a function" : "\"batch\" must be true or false" : "it must be an object";
|
|
9
|
+
return t(n) ? typeof n.name != "string" || !e(n.name) ? "\"name\" must be a kebab-case name" : typeof n.batch == "boolean" ? typeof n.start == "function" ? n.version !== void 0 && typeof n.version != "string" ? "\"version\" must be a string" : n.parallelUnits !== void 0 && typeof n.parallelUnits != "boolean" ? "\"parallelUnits\" must be true or false" : null : "\"start\" must be a function" : "\"batch\" must be true or false" : "it must be an object";
|
|
10
10
|
}
|
|
11
11
|
export { n as validateAdapter };
|
|
@@ -16,6 +16,12 @@ interface RunMutantsOptions {
|
|
|
16
16
|
* never names a test runner.
|
|
17
17
|
*/
|
|
18
18
|
builtIns: BuiltInAdapters;
|
|
19
|
+
/**
|
|
20
|
+
* Parallel units (`--parallel-units`): isolated units of one test file may
|
|
21
|
+
* run at the same time; over `run.parallelUnits`. With an adapter that cannot
|
|
22
|
+
* run them so, the run notes it and runs them one after another.
|
|
23
|
+
*/
|
|
24
|
+
parallelUnits?: boolean;
|
|
19
25
|
/**
|
|
20
26
|
* Incremental mode (`--incremental`): a cached verdict is reused while the
|
|
21
27
|
* region of its mutant (see `getMutantRegions`) and what its test file reads
|
|
@@ -27,6 +33,15 @@ interface RunMutantsOptions {
|
|
|
27
33
|
* Ids of the only mutants to run (`--mutant`); every mutant when omitted.
|
|
28
34
|
*/
|
|
29
35
|
mutantIds?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Interrupts the run once aborted, such as on a signal to the command line:
|
|
38
|
+
* no further run of the test runner starts, the adapter stops the running one
|
|
39
|
+
* (`AdapterContext.signal`), what that run gave is dropped, the session
|
|
40
|
+
* closes, the work directory is removed and the run rejects with the signal's
|
|
41
|
+
* reason. A signal that comes after the last run of the test runner ended
|
|
42
|
+
* lets the run end as without it, saving its cache.
|
|
43
|
+
*/
|
|
44
|
+
signal?: AbortSignal;
|
|
30
45
|
/**
|
|
31
46
|
* Most test files at once; over `run.concurrency`.
|
|
32
47
|
*/
|
|
@@ -101,13 +116,30 @@ interface RunMutantsOptions {
|
|
|
101
116
|
* report also lists the candidates its mutators skipped. The adapter is closed
|
|
102
117
|
* and the work directory removed whatever happens; what the adapter tells of
|
|
103
118
|
* its close, such as a global teardown that failed, joins the diagnostics of a
|
|
104
|
-
* run that went through, after its cache was saved.
|
|
119
|
+
* run that went through, after its cache was saved. Unless the cache is off, in
|
|
120
|
+
* fast mode, or with `--since` or `--mutant`, a run first tries to decide its
|
|
121
|
+
* mutants from the dry run an earlier run saved and cached verdicts, without
|
|
122
|
+
* starting the test runner (`replayDrySnapshot`); a run that starts it hashes
|
|
123
|
+
* everything under the project root first, and once its session closed with
|
|
124
|
+
* nothing to tell, saves its own dry run, leaving out its work directory, which
|
|
125
|
+
* may lie in the project, or removes the saved one when it cannot be replayed
|
|
126
|
+
* (`saveDrySnapshot`), with a note that names a path that changed during the
|
|
127
|
+
* run; the time it takes counts in the isolated phase. With parallel units, an
|
|
128
|
+
* adapter that runs them may run the isolated units of one test file at the
|
|
129
|
+
* same time, and their verdicts are cached apart from those of other runs; an
|
|
130
|
+
* adapter that cannot runs them one after another, with a note. Once the signal
|
|
131
|
+
* of the options aborts, nothing more starts: a signal while the mutants are
|
|
132
|
+
* listed or a saved dry run is checked starts no test runner, and the session
|
|
133
|
+
* asks nothing more of a started one (`guardSession`), whose adapter stops what
|
|
134
|
+
* runs; the session still closes and the work directory is still removed.
|
|
105
135
|
*
|
|
106
136
|
* @param options - Paths, configuration, adapters and run settings.
|
|
107
137
|
* @returns Verdicts, diagnostics and timings, before they are formatted.
|
|
108
138
|
* @throws Error - When the configuration, the paths, a `--mutant` id or the
|
|
109
139
|
* adapter is invalid, when the changed lines cannot be read from git, when
|
|
110
|
-
* the test runner cannot start, or when tests fail without mutants
|
|
140
|
+
* the test runner cannot start, or when tests fail without mutants; the
|
|
141
|
+
* reason of the signal of the options once it aborted before the last run of
|
|
142
|
+
* the test runner ended.
|
|
111
143
|
*/
|
|
112
144
|
export declare function runMutants(options: RunMutantsOptions): Promise<RunResult>;
|
|
113
145
|
export {};
|