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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { stopProcessGroup as e } from "../shared/stop-process-group.js";
|
|
2
|
+
import { startTestProcess as t } from "./start-test-process.js";
|
|
3
|
+
function n(e, n) {
|
|
4
|
+
let { context: i } = e, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = 0, c = 0;
|
|
5
|
+
function l(n) {
|
|
6
|
+
let r = t({
|
|
7
|
+
output: i.onOutput === void 0 ? "ignore" : "pipe",
|
|
8
|
+
env: {
|
|
9
|
+
...e.env,
|
|
10
|
+
MOOTANT_UNIT_FD: "3"
|
|
11
|
+
},
|
|
12
|
+
args: [...e.args, n],
|
|
13
|
+
groups: e.groups,
|
|
14
|
+
node: e.node,
|
|
15
|
+
cwd: i.root,
|
|
16
|
+
pipe: !0
|
|
17
|
+
});
|
|
18
|
+
a.set(n, [...a.get(n) ?? [], r]), s += 1;
|
|
19
|
+
function o() {
|
|
20
|
+
let e = a.get(n);
|
|
21
|
+
e.includes(r) && (a.set(n, e.filter((e) => e !== r)), --s);
|
|
22
|
+
}
|
|
23
|
+
r.on("error", o), r.on("exit", o), r.pid !== void 0 && r.stdio[3]?.on("error", () => {});
|
|
24
|
+
}
|
|
25
|
+
function u() {
|
|
26
|
+
if (i.signal?.aborted === !0) return;
|
|
27
|
+
for (; o.has(c);) c += 1;
|
|
28
|
+
let t = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
|
|
29
|
+
for (let r = c; r < n.length && t.size < e.spares; r += 1) {
|
|
30
|
+
let e = n[r];
|
|
31
|
+
!o.has(r) && !t.has(e.key) && (t.add(e.key), u.set(e.file, (u.get(e.file) ?? 0) + 1));
|
|
32
|
+
}
|
|
33
|
+
for (let [e, t] of a) {
|
|
34
|
+
let n = t.splice(u.get(e) ?? 0);
|
|
35
|
+
s -= n.length, r(n);
|
|
36
|
+
}
|
|
37
|
+
for (let [t, n] of u) for (let r = a.get(t)?.length ?? 0; r < n && s < e.spares; r += 1) l(t);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
take: (e, t) => {
|
|
41
|
+
o.add(e);
|
|
42
|
+
let { file: r } = n[e], [i = null, ...c] = t ? [] : a.get(r) ?? [];
|
|
43
|
+
return i !== null && (a.set(r, c), --s, (i.pid === void 0 || i.exitCode !== null || i.signalCode !== null) && (i = null)), u(), i;
|
|
44
|
+
},
|
|
45
|
+
stop: () => {
|
|
46
|
+
for (let e of a.values()) r(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function r(t) {
|
|
51
|
+
for (let { pid: n } of t) n !== void 0 && e(n);
|
|
52
|
+
}
|
|
53
|
+
export { n as createSpareProcesses };
|
|
@@ -8,7 +8,8 @@ import { Diagnostic } from '../../types/mutant/diagnostic.js';
|
|
|
8
8
|
* `none`; `--test-global-setup` is kept with a warning, since it then runs in
|
|
9
9
|
* every test process; `--test-randomize` without a seed gets a fixed seed, so
|
|
10
10
|
* every process of every run orders tests the same way. Every other flag is
|
|
11
|
-
* kept in order.
|
|
11
|
+
* kept in order. Names are read as Node's option parser reads them
|
|
12
|
+
* (`readFlagName`), so `--test_update_snapshots` is left out too.
|
|
12
13
|
*
|
|
13
14
|
* @param flags - Flags of the command, each with its value.
|
|
14
15
|
* @returns Flags of the test processes and `config-overridden` warnings.
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
import { readFlagName as e } from "../shared/read-flag-name.js";
|
|
2
|
+
const t = /* @__PURE__ */ new Set([
|
|
2
3
|
"--experimental-test-coverage",
|
|
3
4
|
"--test-reporter-destination",
|
|
4
5
|
"--test-concurrency",
|
|
5
6
|
"--test-reporter",
|
|
6
7
|
"--test"
|
|
7
|
-
]),
|
|
8
|
+
]), n = /* @__PURE__ */ new Set([
|
|
8
9
|
"--watch-preserve-output",
|
|
9
10
|
"--test-update-snapshots",
|
|
10
11
|
"--test-rerun-failures",
|
|
11
12
|
"--watch-path",
|
|
12
13
|
"--test-shard",
|
|
13
14
|
"--watch"
|
|
14
|
-
]),
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
for (let [
|
|
18
|
-
let
|
|
19
|
-
|
|
15
|
+
]), r = /* @__PURE__ */ new Set(["--experimental-test-isolation", "--test-isolation"]);
|
|
16
|
+
function i(i) {
|
|
17
|
+
let a = /* @__PURE__ */ new Map(), o = [], s = i.map(([t]) => e(t));
|
|
18
|
+
for (let [e, c] of i.entries()) {
|
|
19
|
+
let i = s[e], l = c[1] ?? c[0].slice(i.length + 1);
|
|
20
|
+
n.has(i) ? a.set(i, i === "--test-update-snapshots" ? "mootant never writes snapshots, so it ignores --test-update-snapshots of the test command." : `mootant ignores ${i} of the test command.`) : r.has(i) ? l === "none" && a.set(i, `mootant runs every test file in a process of its own, so it ignores ${i}=none of the test command.`) : !t.has(i) && !i.startsWith("--test-coverage-") && (o.push(...c), i === "--test-global-setup" && a.set(i, "The global setup of --test-global-setup runs in every test process under mootant, not once per run."));
|
|
20
21
|
}
|
|
21
|
-
return
|
|
22
|
-
diagnostics: [...
|
|
22
|
+
return s.includes("--test-randomize") && !s.includes("--test-random-seed") && o.push("--test-random-seed=1"), {
|
|
23
|
+
diagnostics: [...a.values()].map((e) => ({
|
|
23
24
|
code: "config-overridden",
|
|
24
25
|
severity: "warning",
|
|
25
26
|
column: null,
|
|
@@ -27,7 +28,7 @@ function r(r) {
|
|
|
27
28
|
file: null,
|
|
28
29
|
message: e
|
|
29
30
|
})),
|
|
30
|
-
execArgv:
|
|
31
|
+
execArgv: o
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
|
-
export {
|
|
34
|
+
export { i as filterExecArgv };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VERDICT_VARIABLE_PATTERN as e } from "../shared/verdict-variable-pattern.js";
|
|
2
2
|
import { listTsconfigFiles as t } from "../shared/list-tsconfig-files.js";
|
|
3
3
|
import { hashEnvironment as n } from "../shared/hash-environment.js";
|
|
4
|
-
import { listFlagValues as r } from "
|
|
4
|
+
import { listFlagValues as r } from "../shared/list-flag-values.js";
|
|
5
5
|
import i from "node:path";
|
|
6
6
|
const a = /* @__PURE__ */ new Set([
|
|
7
7
|
"--experimental-config-file",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ProcessWatch } from './types/process-watch.js';
|
|
2
2
|
/**
|
|
3
3
|
* Computes the deadline of an isolated unit: its timeout from the moment the
|
|
4
|
-
* preload
|
|
5
|
-
* not counted; before that record, the timeout
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* preload got the unit (`start` record), so the time the process takes to
|
|
5
|
+
* start, or a spare waited, is not counted; before that record, the timeout
|
|
6
|
+
* plus ten seconds from the start of the process, or from the moment a spare
|
|
7
|
+
* got its unit, so a process that hangs before the preload runs, as in a module
|
|
8
|
+
* another flag loads first, is stopped too.
|
|
8
9
|
*
|
|
9
|
-
* @param watch - Records so far and when the process started.
|
|
10
|
+
* @param watch - Records so far and when the process started or got its unit.
|
|
10
11
|
* @param timeout - Milliseconds the unit may take (`IsolatedUnit.limits`).
|
|
11
12
|
* @returns Epoch milliseconds, or `Infinity`.
|
|
12
13
|
*/
|
|
@@ -7,7 +7,7 @@ export type { NodeTestAdapterOptions } from './types/node-test-adapter-options.j
|
|
|
7
7
|
*
|
|
8
8
|
* @param options - Test command, test files, flags, variables and Node binary,
|
|
9
9
|
* when not those of the project's test scripts.
|
|
10
|
-
* @returns Adapter named `node-test` without batch mode
|
|
11
|
-
* version.
|
|
10
|
+
* @returns Adapter named `node-test` with parallel units, without batch mode,
|
|
11
|
+
* and with mootant's version.
|
|
12
12
|
*/
|
|
13
13
|
export declare function nodeTestAdapter(options?: NodeTestAdapterOptions): TestAdapter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells whether a process group has a process left. A group that cannot be
|
|
3
|
+
* looked at, as on Windows, counts as one with processes left.
|
|
4
|
+
*
|
|
5
|
+
* @param pid - Process id of the leader of the group.
|
|
6
|
+
* @returns Whether a process of the group is left.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isGroupAlive(pid: number): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { listFlagValues as e } from "
|
|
2
|
-
import { LOADER_FLAGS as t } from "
|
|
1
|
+
import { listFlagValues as e } from "../shared/list-flag-values.js";
|
|
2
|
+
import { LOADER_FLAGS as t } from "../shared/loader-flags.js";
|
|
3
3
|
import n from "node:path";
|
|
4
4
|
import { fileURLToPath as r } from "node:url";
|
|
5
5
|
const i = /* @__PURE__ */ new Set(["--test-global-setup"]);
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* `NODE_OPTIONS` before those of the command line, so: when the project
|
|
5
5
|
* requires modules, the preload is the first `--require` (of `NODE_OPTIONS` if
|
|
6
6
|
* they require one); otherwise it is the first `--import`, of `NODE_OPTIONS`
|
|
7
|
-
* when they load modules, else of the command line.
|
|
7
|
+
* when they load modules, else of the command line. `NODE_OPTIONS` are read as
|
|
8
|
+
* Node reads them (`readNodeOptions`, `readFlagName`), quotes included.
|
|
8
9
|
*
|
|
9
10
|
* @param preload - Absolute path of the preload.
|
|
10
11
|
* @param execArgv - Flags of the test processes.
|
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { readNodeOptions as e } from "../shared/read-node-options.js";
|
|
2
|
+
import { readFlagName as t } from "../shared/read-flag-name.js";
|
|
3
|
+
import { pathToFileURL as n } from "node:url";
|
|
4
|
+
const r = /* @__PURE__ */ new Set(["--require", "-r"]), i = /* @__PURE__ */ new Set([
|
|
5
|
+
"--experimental-loader",
|
|
6
|
+
"--import",
|
|
7
|
+
"--loader"
|
|
8
|
+
]);
|
|
9
|
+
function a(a, o, s) {
|
|
10
|
+
let c = n(a).href, l = o.some((e) => r.has(e.split("=", 1)[0])), u = e(s).map(t);
|
|
11
|
+
return u.some((e) => r.has(e)) ? {
|
|
12
|
+
nodeOptions: `--require=${JSON.stringify(a)} ${s}`,
|
|
13
|
+
args: [...o]
|
|
14
|
+
} : l ? {
|
|
9
15
|
args: [
|
|
10
16
|
"--require",
|
|
11
|
-
|
|
12
|
-
...
|
|
17
|
+
a,
|
|
18
|
+
...o
|
|
13
19
|
],
|
|
14
|
-
nodeOptions:
|
|
15
|
-
} :
|
|
16
|
-
nodeOptions: `--import=${
|
|
17
|
-
args: [...
|
|
20
|
+
nodeOptions: s
|
|
21
|
+
} : u.some((e) => i.has(e)) ? {
|
|
22
|
+
nodeOptions: `--import=${c} ${s}`,
|
|
23
|
+
args: [...o]
|
|
18
24
|
} : {
|
|
19
25
|
args: [
|
|
20
26
|
"--import",
|
|
21
|
-
|
|
22
|
-
...
|
|
27
|
+
c,
|
|
28
|
+
...o
|
|
23
29
|
],
|
|
24
|
-
nodeOptions:
|
|
30
|
+
nodeOptions: s
|
|
25
31
|
};
|
|
26
32
|
}
|
|
27
|
-
export {
|
|
33
|
+
export { a as placePreload };
|
|
@@ -1,74 +1,76 @@
|
|
|
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 m from "node:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import { enableCompileCache as t } from "../../shared/enable-compile-cache.js";
|
|
3
|
+
import { installMarkerReceivers as n } from "./install-marker-receivers.js";
|
|
4
|
+
import { createSourceSwitcher as r } from "./create-source-switcher.js";
|
|
5
|
+
import { installModuleHooks as i } from "./install-module-hooks.js";
|
|
6
|
+
import { createRecordWriter as a } from "./create-record-writer.js";
|
|
7
|
+
import { createFileRecorder as o } from "./create-file-recorder.js";
|
|
8
|
+
import { captureClock as s } from "../../shared/capture-clock.js";
|
|
9
|
+
import { trackInputs as c } from "../../shared/track-inputs.js";
|
|
10
|
+
import { createTryTracker as l } from "./create-try-tracker.js";
|
|
11
|
+
import { readUnit as u } from "./read-unit.js";
|
|
12
|
+
import { isMainThread as d } from "node:worker_threads";
|
|
13
|
+
import * as f from "node:module";
|
|
14
|
+
import { beforeEach as p } from "node:test";
|
|
15
|
+
import { realpathSync as m } from "node:fs";
|
|
16
|
+
import h from "node:path";
|
|
17
|
+
const g = ["NODE_TEST_CONTEXT", "FORCE_COLOR"];
|
|
18
|
+
let _ = s(), v = u(process, d), y = Date.now(), b = _.now();
|
|
19
|
+
if (v !== null) {
|
|
20
|
+
t(f, v.directory);
|
|
21
|
+
let s = a(v.out), u = l({
|
|
20
22
|
runtime: e(),
|
|
21
23
|
now: _.now,
|
|
22
|
-
started:
|
|
23
|
-
write:
|
|
24
|
-
unit:
|
|
25
|
-
}),
|
|
26
|
-
|
|
24
|
+
started: b,
|
|
25
|
+
write: s,
|
|
26
|
+
unit: v
|
|
27
|
+
}), d = m(process.argv[1]);
|
|
28
|
+
n({
|
|
27
29
|
reported: (e, t) => {
|
|
28
|
-
|
|
30
|
+
s(e), e.kind === "todo" && u.todo(t);
|
|
29
31
|
},
|
|
30
32
|
loaded: () => {
|
|
31
|
-
|
|
33
|
+
u.loaded();
|
|
32
34
|
},
|
|
33
|
-
served:
|
|
35
|
+
served: o(s, "served")
|
|
34
36
|
});
|
|
35
|
-
let
|
|
36
|
-
switcher:
|
|
37
|
-
plan:
|
|
38
|
-
write:
|
|
39
|
-
main:
|
|
37
|
+
let x = `hooks${h.extname(import.meta.url)}`, S = i(f, {
|
|
38
|
+
switcher: r({
|
|
39
|
+
plan: v.plan,
|
|
40
|
+
write: s,
|
|
41
|
+
main: d
|
|
40
42
|
}),
|
|
41
43
|
data: {
|
|
42
|
-
plan:
|
|
43
|
-
out:
|
|
44
|
-
main:
|
|
44
|
+
plan: v.plan,
|
|
45
|
+
out: v.out,
|
|
46
|
+
main: d
|
|
45
47
|
},
|
|
46
|
-
record:
|
|
47
|
-
prototype:
|
|
48
|
-
hooks: new URL(
|
|
49
|
-
commonjs:
|
|
48
|
+
record: o(s, "load"),
|
|
49
|
+
prototype: f.Module.prototype,
|
|
50
|
+
hooks: new URL(x, import.meta.url),
|
|
51
|
+
commonjs: v.commonjs
|
|
50
52
|
});
|
|
51
|
-
|
|
53
|
+
s({
|
|
52
54
|
node: process.version,
|
|
53
55
|
pid: process.pid,
|
|
54
56
|
kind: "start",
|
|
55
|
-
hooks:
|
|
56
|
-
time:
|
|
57
|
+
hooks: S,
|
|
58
|
+
time: y
|
|
57
59
|
});
|
|
58
|
-
let
|
|
59
|
-
directory:
|
|
60
|
-
root:
|
|
61
|
-
}, { ignored:
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
let C = c({
|
|
61
|
+
directory: v.directory,
|
|
62
|
+
root: v.root
|
|
63
|
+
}, { ignored: g }), w = f.createRequire(import.meta.url);
|
|
64
|
+
p((e) => {
|
|
65
|
+
u.open(e);
|
|
64
66
|
}), process.on("uncaughtExceptionMonitor", (e) => {
|
|
65
|
-
|
|
67
|
+
u.error(e);
|
|
66
68
|
}), process.on("unhandledRejection", (e) => {
|
|
67
|
-
|
|
69
|
+
u.error(e);
|
|
68
70
|
}), process.on("exit", (e) => {
|
|
69
|
-
|
|
70
|
-
...
|
|
71
|
-
required: Object.keys(
|
|
71
|
+
u.exit(e, {
|
|
72
|
+
...C.stop(),
|
|
73
|
+
required: Object.keys(w.cache)
|
|
72
74
|
});
|
|
73
75
|
});
|
|
74
76
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the first line of a file descriptor, blocking the thread until its end
|
|
3
|
+
* arrives, then closes the descriptor. A read that finds no data ready yet or
|
|
4
|
+
* is interrupted by a signal is tried again; an error of another kind ends the
|
|
5
|
+
* input.
|
|
6
|
+
*
|
|
7
|
+
* @param descriptor - File descriptor to read, such as a pipe.
|
|
8
|
+
* @returns The line without its line feed, or null when the input ended before
|
|
9
|
+
* one.
|
|
10
|
+
*/
|
|
11
|
+
export declare function readLineSync(descriptor: number): string | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { closeSync as e, readSync as t } from "node:fs";
|
|
2
|
+
const n = /* @__PURE__ */ new Set(["EAGAIN", "EINTR"]);
|
|
3
|
+
function r(r) {
|
|
4
|
+
let i = Buffer.alloc(65536), a = new Int32Array(new SharedArrayBuffer(4)), o = [];
|
|
5
|
+
try {
|
|
6
|
+
for (;;) {
|
|
7
|
+
let e;
|
|
8
|
+
try {
|
|
9
|
+
e = t(r, i, 0, i.length, null);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
if (!n.has(e.code ?? "")) return null;
|
|
12
|
+
Atomics.wait(a, 0, 0, 10);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (e === 0) return null;
|
|
16
|
+
let s = i.subarray(0, e), c = s.indexOf(10);
|
|
17
|
+
if (o.push(Buffer.from(c === -1 ? s : s.subarray(0, c))), c !== -1) return Buffer.concat(o).toString("utf8");
|
|
18
|
+
}
|
|
19
|
+
} finally {
|
|
20
|
+
try {
|
|
21
|
+
e(r);
|
|
22
|
+
} catch {}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export { r as readLineSync };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { NodeTestUnit } from '../types/node-test-unit.js';
|
|
2
2
|
/**
|
|
3
|
-
* Reads what the test process runs
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Reads what the test process runs and removes the variables that carry it, so
|
|
4
|
+
* processes the test code starts with the variables of this one, such as
|
|
5
|
+
* through `fork()`, do not take the unit for theirs. The unit comes as a line
|
|
6
|
+
* through the file descriptor in `MOOTANT_UNIT_FD`; the process waits for it
|
|
7
|
+
* there, which lets a spare process start before mootant knows its unit, and
|
|
8
|
+
* closes the descriptor once read. A process that gets no line, as a spare that
|
|
9
|
+
* mootant no longer needs or whose mootant is gone, exits at once, before any
|
|
10
|
+
* module of the project loads. Where mootant sends no line, as on Windows, the
|
|
11
|
+
* unit is in `MOOTANT_UNIT`.
|
|
6
12
|
*
|
|
7
|
-
* @param
|
|
13
|
+
* @param target - The process, with its environment variables and its exit.
|
|
8
14
|
* @param main - Whether the code runs in the main thread; a worker thread loads
|
|
9
15
|
* the preload too, since it inherits the flags of the process.
|
|
10
16
|
* @returns The unit, or null when this process or thread is not the unit's own,
|
|
11
17
|
* so the preload stays inert.
|
|
12
18
|
*/
|
|
13
|
-
export declare function readUnit(
|
|
19
|
+
export declare function readUnit(target: Pick<NodeJS.Process, 'exit' | 'env'>, main: boolean): NodeTestUnit | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { readLineSync as e } from "./read-line-sync.js";
|
|
2
|
+
function t(t, n) {
|
|
3
|
+
let { env: r } = t, i = r.MOOTANT_UNIT, a = r.MOOTANT_UNIT_FD;
|
|
4
|
+
return delete r.MOOTANT_UNIT, delete r.MOOTANT_UNIT_FD, n ? (a !== void 0 && (i = e(Number(a)) ?? t.exit()), i === void 0 ? null : JSON.parse(i)) : null;
|
|
4
5
|
}
|
|
5
|
-
export {
|
|
6
|
+
export { t as readUnit };
|
|
@@ -4,16 +4,25 @@ import { NodeTestHandle } from './types/node-test-handle.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Executes isolated units, each in a test process of its own with its mutant
|
|
6
6
|
* active from the start, with the session's processes at once but never two
|
|
7
|
-
* units of one test file at once, in plan order per file (`runInPool`)
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
7
|
+
* units of one test file at once, in plan order per file (`runInPool`), unless
|
|
8
|
+
* the context allows parallel units, when every unit has a key of its own. A
|
|
9
|
+
* unit stops starting tests after a test failed once the mutant was reached,
|
|
10
|
+
* unless its test file reported a todo test or suite in its dry run, since
|
|
11
|
+
* node:test reports todo tests only some time after they ran; tests that failed
|
|
12
|
+
* in the file's dry run of a process that still exited with 0 never count. A
|
|
13
|
+
* unit that stopped for a failure that turned out a todo test, as one that only
|
|
14
|
+
* the mutant made todo, runs again without stopping (`checkTodoBail`). A
|
|
15
|
+
* watchdog stops a unit past its timeout (`getUnitDeadline`). A unit runs in a
|
|
16
|
+
* spare process of its test file when one is ready (`createSpareProcesses`),
|
|
17
|
+
* except right after a unit whose processes outlived it or hung
|
|
18
|
+
* (`TestProcessOutcome.lingering`): the next unit to start, and the next unit
|
|
19
|
+
* of the same test file, start a process of their own then, so what those
|
|
20
|
+
* processes held is free for as long as a process takes to start, as without
|
|
21
|
+
* spares. A unit whose spare ended before it began the unit runs again in a
|
|
22
|
+
* process of its own, as a run again after a todo test does. The spares no unit
|
|
23
|
+
* took stop once the run is over. Every unit reports its facts
|
|
24
|
+
* (`buildIsolatedFacts`) and, once its process reached its end, what it read,
|
|
25
|
+
* to the result and, as it ends, to the context's `onUnitEnd`.
|
|
17
26
|
*
|
|
18
27
|
* @param handle - Live session.
|
|
19
28
|
* @param plan - Units to run.
|