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
|
@@ -44,53 +44,62 @@ function a(a) {
|
|
|
44
44
|
return e.key === t.key || a.incremental && t.incremental !== null && e.incremental === t.incremental;
|
|
45
45
|
}
|
|
46
46
|
function C(e) {
|
|
47
|
+
return {
|
|
48
|
+
...e,
|
|
49
|
+
incremental: e.incremental === null ? null : r([e.incremental, a.switched]),
|
|
50
|
+
key: r([e.key, a.switched])
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function w(e) {
|
|
47
54
|
if (e === null) return null;
|
|
48
|
-
let t = u.entries.get(e.slot);
|
|
49
|
-
return t === void 0 || !S(t,
|
|
55
|
+
let t = u.entries.get(e.slot), n = t?.status === "Timeout" ? C(e) : e;
|
|
56
|
+
return t === void 0 || t.status === "Timeout" && !a.timeouts || !S(t, n) || t.test !== null && !c.tests.has(t.test) || t.inputs !== null && !b(e.file, u.inputs.get(t.inputs)) ? null : (t.inputs !== null && _.set(t.inputs, u.inputs.get(t.inputs)), t.key !== n.key && h.add(e.mutant), m.set(e.slot, {
|
|
50
57
|
...t,
|
|
51
58
|
used: p
|
|
52
59
|
}), v.set(e.slot, e.file), t.status === "Survived" ? "survived" : {
|
|
53
60
|
file: c.testFiles.get(e.file).file,
|
|
54
61
|
message: t.message,
|
|
62
|
+
status: t.status,
|
|
55
63
|
cause: t.cause,
|
|
56
|
-
test: t.test
|
|
57
|
-
status: "Killed"
|
|
64
|
+
test: t.test
|
|
58
65
|
});
|
|
59
66
|
}
|
|
60
|
-
function
|
|
61
|
-
let { verdict: i, inputs: o } = r;
|
|
62
|
-
if (e === null || !o ||
|
|
63
|
-
let
|
|
64
|
-
environment: [...new Set(o.environment)].filter((e) => !
|
|
65
|
-
files: [...new Set(o.dependencies)].filter((e) => !
|
|
67
|
+
function T(e, n, r) {
|
|
68
|
+
let { verdict: i, inputs: o } = r, s = i === "survived" || i.status === "Killed" && i.cause !== "crash" || a.timeouts && n.path === "isolated" && i.status === "Timeout" && i.cause === "hit-limit";
|
|
69
|
+
if (e === null || !o || !s) return;
|
|
70
|
+
let c = new Set(a.dependencies.get(e.file)), l = new Set(a.reads.get(e.file)), u = {
|
|
71
|
+
environment: [...new Set(o.environment)].filter((e) => !l.has(e)).toSorted(t).map((t) => [t, y(e.file, t)]),
|
|
72
|
+
files: [...new Set(o.dependencies)].filter((e) => !c.has(e)).toSorted(t)
|
|
66
73
|
};
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
u.files.length > 0 || u.environment.length > 0 ? g.set(e.slot, u) : g.delete(e.slot), v.set(e.slot, e.file);
|
|
75
|
+
let { incremental: d, key: f } = i !== "survived" && i.status === "Timeout" ? C(e) : e;
|
|
76
|
+
m.set(e.slot, i === "survived" ? {
|
|
69
77
|
status: "Survived",
|
|
70
78
|
path: n.path,
|
|
71
|
-
key: e.key,
|
|
72
79
|
message: null,
|
|
73
80
|
inputs: null,
|
|
74
81
|
first: !1,
|
|
82
|
+
incremental: d,
|
|
75
83
|
cause: null,
|
|
76
84
|
test: null,
|
|
77
|
-
used: p
|
|
85
|
+
used: p,
|
|
86
|
+
key: f
|
|
78
87
|
} : {
|
|
79
|
-
|
|
88
|
+
status: i.status === "Timeout" ? "Timeout" : "Killed",
|
|
80
89
|
message: i.message,
|
|
81
90
|
cause: i.cause,
|
|
82
91
|
first: n.first,
|
|
83
92
|
test: i.test,
|
|
84
93
|
path: n.path,
|
|
85
|
-
key: e.key,
|
|
86
|
-
status: "Killed",
|
|
87
94
|
inputs: null,
|
|
88
|
-
|
|
95
|
+
incremental: d,
|
|
96
|
+
used: p,
|
|
97
|
+
key: f
|
|
89
98
|
});
|
|
90
99
|
}
|
|
91
100
|
return {
|
|
92
101
|
lookupBatch: (t, n) => {
|
|
93
|
-
let r = x(t, e(c.tests.get(n)), n), i =
|
|
102
|
+
let r = x(t, e(c.tests.get(n)), n), i = w(r);
|
|
94
103
|
return i === null || i === "survived" ? i : {
|
|
95
104
|
first: u.entries.get(r.slot).first,
|
|
96
105
|
verdict: i
|
|
@@ -102,18 +111,18 @@ function a(a) {
|
|
|
102
111
|
},
|
|
103
112
|
recordBatch: (t, n, r) => {
|
|
104
113
|
let i = e(c.tests.get(n)), a = t.coveredBy[0] === n;
|
|
105
|
-
|
|
114
|
+
T(x(t, i, n), {
|
|
106
115
|
path: "batch",
|
|
107
116
|
first: a
|
|
108
117
|
}, r);
|
|
109
118
|
},
|
|
110
119
|
recordUnit: (e, t, n) => {
|
|
111
|
-
|
|
120
|
+
T(x(e, t, null), {
|
|
112
121
|
path: "isolated",
|
|
113
122
|
first: !1
|
|
114
123
|
}, n);
|
|
115
124
|
},
|
|
116
|
-
lookupUnit: (e, t) =>
|
|
125
|
+
lookupUnit: (e, t) => w(x(e, t, null)),
|
|
117
126
|
dependencies: a.dependencies,
|
|
118
127
|
environment: a.environment,
|
|
119
128
|
regional: h,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
2
|
+
import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
|
|
3
|
+
/**
|
|
4
|
+
* Stands in for the session of the test runner in a run that replays a saved
|
|
5
|
+
* dry run: it lists the test files and tells the cache inputs, version, workers
|
|
6
|
+
* and warnings of the session that saved it, and refuses to run anything, so a
|
|
7
|
+
* run that needs the test runner starts over with it (`createDryReuseMiss`).
|
|
8
|
+
*
|
|
9
|
+
* @param snapshot - Saved dry run of an earlier run that still holds.
|
|
10
|
+
* @returns Session without a test runner.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSnapshotSession(snapshot: DrySnapshot): AdapterSession;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createDryReuseMiss as e } from "./create-dry-reuse-miss.js";
|
|
2
|
+
function t(t) {
|
|
3
|
+
let { session: n } = t;
|
|
4
|
+
function r() {
|
|
5
|
+
return Promise.reject(e("some mutants have no cached verdict"));
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
listTestFiles: () => Promise.resolve([...t.testFiles]),
|
|
9
|
+
cacheInputs: () => Promise.resolve(n.inputs),
|
|
10
|
+
...n.version !== null && { version: n.version },
|
|
11
|
+
...n.workers !== null && { workers: n.workers },
|
|
12
|
+
diagnostics: n.diagnostics,
|
|
13
|
+
close: () => Promise.resolve(),
|
|
14
|
+
runIsolated: r,
|
|
15
|
+
runBatch: r,
|
|
16
|
+
dryRun: r
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export { t as createSnapshotSession };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gives the id of mootant's own code that the cache keys take in: the hash the
|
|
3
|
+
* build wrote (`BUILD_HASH`), or, when mootant runs from its sources, a random
|
|
4
|
+
* id made once per process, so a later process, whose sources may differ, never
|
|
5
|
+
* reuses verdicts of this one.
|
|
6
|
+
*
|
|
7
|
+
* @param file - Path of the module, a `.ts` file in the sources; this module's
|
|
8
|
+
* path when omitted.
|
|
9
|
+
* @returns Hash of the build, or the id of the sources in this process.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getBuildId(file?: string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ActiveMutator } from '../../types/mutator/active-mutator.js';
|
|
2
|
+
import { SwitchedFile } from '../../types/adapter/switched-file.js';
|
|
3
|
+
import { TestAdapter } from '../../types/adapter/test-adapter.js';
|
|
4
|
+
import { LimitSettings } from '../../types/run/run-state.js';
|
|
5
|
+
/**
|
|
6
|
+
* Builds the key of a saved dry run (`DrySnapshot`) over what the dry run was
|
|
7
|
+
* asked to do and how the run reads it: the versions of mootant, its build, the
|
|
8
|
+
* cache, the instrumenter and the runtime; the adapter; the version of Node.js
|
|
9
|
+
* with the platform; the project root and the configuration file, whose text
|
|
10
|
+
* the hash of the project tree takes in, so a run of another configuration in
|
|
11
|
+
* the same root never replays it; the working directory, which configuration
|
|
12
|
+
* and tests may read; what the test runner starts with: the concurrency, which
|
|
13
|
+
* a global setup may read, the number of cores a default one comes from, and
|
|
14
|
+
* whether units run in parallel; the try limits; the preset and its mutators;
|
|
15
|
+
* the switched files given to the dry run with their texts, which name every
|
|
16
|
+
* hosted mutant; and the files it relates tests to.
|
|
17
|
+
*
|
|
18
|
+
* @param input - Settings, adapter and files of the dry run.
|
|
19
|
+
* @param input.setup - Preset, active mutators, preset settings and the
|
|
20
|
+
* configuration file.
|
|
21
|
+
* @param input.context - Concurrency and parallel units the test runner starts
|
|
22
|
+
* with (`AdapterContext`).
|
|
23
|
+
* @param input.switched - Switched files given to the dry run, in order.
|
|
24
|
+
* @param input.related - Absolute paths of the files the dry run relates tests
|
|
25
|
+
* to, in order.
|
|
26
|
+
* @param input.limits - How try limits grow from the dry run.
|
|
27
|
+
* @param input.adapter - Adapter of the run.
|
|
28
|
+
* @param input.root - Project root.
|
|
29
|
+
* @returns SHA-256 in hex.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDrySnapshotKey(input: {
|
|
32
|
+
setup: {
|
|
33
|
+
mutators: ActiveMutator[];
|
|
34
|
+
file: string | null;
|
|
35
|
+
settings: unknown;
|
|
36
|
+
preset: string;
|
|
37
|
+
};
|
|
38
|
+
context: {
|
|
39
|
+
concurrency: number | null;
|
|
40
|
+
parallelUnits: boolean;
|
|
41
|
+
};
|
|
42
|
+
switched: readonly SwitchedFile[];
|
|
43
|
+
related: readonly string[];
|
|
44
|
+
limits: LimitSettings;
|
|
45
|
+
adapter: TestAdapter;
|
|
46
|
+
root: string;
|
|
47
|
+
}): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getPortablePath as e } from "./get-portable-path.js";
|
|
2
|
+
import { createDigest as t } from "./create-digest.js";
|
|
3
|
+
import { version as n } from "../../package.js";
|
|
4
|
+
import { getBuildId as r } from "./get-build-id.js";
|
|
5
|
+
import { availableParallelism as i } from "node:os";
|
|
6
|
+
import { createHash as a } from "node:crypto";
|
|
7
|
+
function o(o) {
|
|
8
|
+
let { context: s, setup: c, root: l } = o;
|
|
9
|
+
return t([
|
|
10
|
+
8,
|
|
11
|
+
n,
|
|
12
|
+
r(),
|
|
13
|
+
2,
|
|
14
|
+
2,
|
|
15
|
+
[o.adapter.name, o.adapter.version ?? null],
|
|
16
|
+
[
|
|
17
|
+
process.version,
|
|
18
|
+
process.platform,
|
|
19
|
+
process.arch
|
|
20
|
+
],
|
|
21
|
+
l,
|
|
22
|
+
c.file === null ? null : e(c.file, l),
|
|
23
|
+
process.cwd(),
|
|
24
|
+
[
|
|
25
|
+
s.concurrency,
|
|
26
|
+
i(),
|
|
27
|
+
s.parallelUnits
|
|
28
|
+
],
|
|
29
|
+
o.limits,
|
|
30
|
+
[
|
|
31
|
+
c.mutators.map((e) => [e.id, e.options]),
|
|
32
|
+
c.settings,
|
|
33
|
+
c.preset
|
|
34
|
+
],
|
|
35
|
+
o.switched.map((t) => [
|
|
36
|
+
e(t.file, l),
|
|
37
|
+
a("sha256").update(t.switched).digest("hex"),
|
|
38
|
+
a("sha256").update(t.original).digest("hex")
|
|
39
|
+
]),
|
|
40
|
+
o.related.map((t) => e(t, l))
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
export { o as getDrySnapshotKey };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the path of the saved dry run of a project (`DrySnapshot`), next to
|
|
3
|
+
* the cache file.
|
|
4
|
+
*
|
|
5
|
+
* @param root - Project root.
|
|
6
|
+
* @returns Absolute path, such as
|
|
7
|
+
* `<root>/node_modules/.cache/mootant/dry-v8.json`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDrySnapshotPath(root: string): string;
|
|
@@ -25,6 +25,11 @@ interface EnvironmentInput {
|
|
|
25
25
|
* Hashes of the files by absolute path, null for a missing one.
|
|
26
26
|
*/
|
|
27
27
|
hashes: ReadonlyMap<string, string | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether isolated units of one test file run at the same time, false when
|
|
30
|
+
* omitted.
|
|
31
|
+
*/
|
|
32
|
+
parallelUnits?: boolean;
|
|
28
33
|
/**
|
|
29
34
|
* How try limits grow from the dry run.
|
|
30
35
|
*/
|
|
@@ -39,10 +44,9 @@ interface EnvironmentInput {
|
|
|
39
44
|
*/
|
|
40
45
|
files: string[];
|
|
41
46
|
/**
|
|
42
|
-
*
|
|
43
|
-
* not reuse verdicts of the previous build.
|
|
47
|
+
* Id of mootant's own code (`getBuildId`).
|
|
44
48
|
*/
|
|
45
|
-
build:
|
|
49
|
+
build: string;
|
|
46
50
|
/**
|
|
47
51
|
* Project root; paths are hashed relative to it.
|
|
48
52
|
*/
|
|
@@ -54,7 +58,8 @@ interface EnvironmentInput {
|
|
|
54
58
|
* runner, the hashes of the files every verdict depends on, the settings of the
|
|
55
59
|
* test runner, the try limits, the preset and its mutators, and the major
|
|
56
60
|
* version of Node.js with the platform. Concurrency and fast mode are not part
|
|
57
|
-
* of it.
|
|
61
|
+
* of it. Parallel units are part of it only when on, since their verdicts may
|
|
62
|
+
* differ where tests rely on a test file never running twice at once.
|
|
58
63
|
*
|
|
59
64
|
* @param input - Versions, files, hashes and settings of the run.
|
|
60
65
|
* @returns SHA-256 in hex.
|
|
@@ -7,7 +7,7 @@ function r(r) {
|
|
|
7
7
|
root: a
|
|
8
8
|
});
|
|
9
9
|
return t([
|
|
10
|
-
|
|
10
|
+
8,
|
|
11
11
|
n,
|
|
12
12
|
r.build,
|
|
13
13
|
2,
|
|
@@ -19,7 +19,8 @@ function r(r) {
|
|
|
19
19
|
r.mutators,
|
|
20
20
|
process.versions.node.split(".", 1)[0],
|
|
21
21
|
process.platform,
|
|
22
|
-
process.arch
|
|
22
|
+
process.arch,
|
|
23
|
+
...r.parallelUnits === !0 ? ["parallel-units"] : []
|
|
23
24
|
]);
|
|
24
25
|
}
|
|
25
26
|
export { r as getEnvironmentKey };
|
|
@@ -7,7 +7,8 @@ import { DryFile } from '../../types/adapter/dry-file.js';
|
|
|
7
7
|
* is not set included. Incremental keys leave out the files mutants are listed
|
|
8
8
|
* from, for which the region of a mutant stands (see `getMutantRegions`). Test
|
|
9
9
|
* files without dependencies get no key, so their verdicts are neither reused
|
|
10
|
-
* nor stored.
|
|
10
|
+
* nor stored. Each file is made portable once for all test files, which share
|
|
11
|
+
* most of what they load, such as the files of a test environment like jsdom.
|
|
11
12
|
*
|
|
12
13
|
* @param input - Test files of the dry run, file hashes and environment.
|
|
13
14
|
* @param input.files - Test files of the dry run.
|
|
@@ -4,21 +4,22 @@ import { getPortablePath as n } from "./get-portable-path.js";
|
|
|
4
4
|
import { listFileHashes as r } from "./list-file-hashes.js";
|
|
5
5
|
import { createDigest as i } from "./create-digest.js";
|
|
6
6
|
function a(a) {
|
|
7
|
-
let { environment: o, variables: s, mutated: c, hashes: l, root: u } = a, d = /* @__PURE__ */ new Map();
|
|
8
|
-
for (let
|
|
9
|
-
if (!Array.isArray(
|
|
10
|
-
let a = r([
|
|
7
|
+
let { environment: o, variables: s, mutated: c, hashes: l, root: u } = a, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
8
|
+
for (let p of a.files) {
|
|
9
|
+
if (!Array.isArray(p.dependencies)) continue;
|
|
10
|
+
let a = r([p.file, ...p.dependencies.filter((e) => !c.has(e))], {
|
|
11
11
|
hashes: l,
|
|
12
|
+
paths: d,
|
|
12
13
|
root: u
|
|
13
|
-
}),
|
|
14
|
-
|
|
14
|
+
}), m = Object.hasOwn(s, p.project) ? s[p.project] : {}, h = [...new Set(p.environment)].toSorted(t).map((e) => [e, Object.hasOwn(m, e) ? m[e] : null]);
|
|
15
|
+
f.set(e(p), i([
|
|
15
16
|
o,
|
|
16
|
-
n(
|
|
17
|
-
|
|
17
|
+
n(p.file, u),
|
|
18
|
+
p.project,
|
|
18
19
|
a,
|
|
19
|
-
|
|
20
|
+
h
|
|
20
21
|
]));
|
|
21
22
|
}
|
|
22
|
-
return
|
|
23
|
+
return f;
|
|
23
24
|
}
|
|
24
25
|
export { a as getTestFileKeys };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hashes the contents of files, each file once, a few at a time
|
|
3
|
-
* hashed by the names in it, those of
|
|
4
|
-
* or replacing a file with a directory
|
|
5
|
-
* directory in it does not. A path that is
|
|
6
|
-
* as a device, a pipe or a socket, is
|
|
7
|
-
*
|
|
8
|
-
* unknown, which differs from a missing
|
|
2
|
+
* Hashes the contents of files, each file once, a few at a time, a large one as
|
|
3
|
+
* a stream (`STREAM_SIZE`); a directory is hashed by the names in it, those of
|
|
4
|
+
* directories marked, so adding, removing or replacing a file with a directory
|
|
5
|
+
* changes it, while a change inside a directory in it does not. A path that is
|
|
6
|
+
* neither a file nor a directory, such as a device, a pipe or a socket, is
|
|
7
|
+
* never read, as reading `/dev/stdin` or a pipe would wait for its writer and
|
|
8
|
+
* `/dev/zero` never ends: its content is unknown, which differs from a missing
|
|
9
|
+
* file.
|
|
9
10
|
*
|
|
10
11
|
* @param paths - Absolute paths, duplicates allowed.
|
|
11
12
|
* @returns SHA-256 of each file in hex by path, `UNKNOWN_HASH` for a path that
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { compareCodeUnits as e } from "../compare-code-units.js";
|
|
2
2
|
import { UNKNOWN_HASH as t } from "./unknown-hash.js";
|
|
3
3
|
import { runInChunks as n } from "./run-in-chunks.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import { createReadStream as r } from "node:fs";
|
|
5
|
+
import { createHash as i } from "node:crypto";
|
|
6
|
+
import { readFile as a, readdir as o, stat as s } from "node:fs/promises";
|
|
7
|
+
async function c(e) {
|
|
7
8
|
let t = /* @__PURE__ */ new Map();
|
|
8
9
|
return await n([...new Set(e)], 32, async (e) => {
|
|
9
|
-
t.set(e, await
|
|
10
|
+
t.set(e, await l(e));
|
|
10
11
|
}), t;
|
|
11
12
|
}
|
|
12
|
-
async function
|
|
13
|
+
async function l(n) {
|
|
13
14
|
try {
|
|
14
|
-
let
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
let c = await s(n);
|
|
16
|
+
if (c.isFile() && c.size <= 16777216) return i("sha256").update(await a(n)).digest("hex");
|
|
17
|
+
if (c.isFile()) {
|
|
18
|
+
let e = i("sha256");
|
|
19
|
+
for await (let t of r(n)) e.update(t);
|
|
20
|
+
return e.digest("hex");
|
|
21
|
+
}
|
|
22
|
+
if (!c.isDirectory()) return t;
|
|
23
|
+
let l = (await o(n, { withFileTypes: !0 })).map((e) => e.isDirectory() ? `${e.name}/` : e.name).toSorted(e);
|
|
24
|
+
return i("sha256").update(`directory\0${l.join("\0")}`).digest("hex");
|
|
19
25
|
} catch {
|
|
20
26
|
return null;
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
|
-
export {
|
|
29
|
+
export { c as hashFiles };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ProjectTree } from '../../types/cache/project-tree.js';
|
|
2
|
+
/**
|
|
3
|
+
* Hashes everything under the project root with its contents, so that adding,
|
|
4
|
+
* removing, renaming or changing any file, directory or symbolic link changes
|
|
5
|
+
* the hash: a new test file, a test file the dry run did not run that now
|
|
6
|
+
* imports a mutated file, or a file that now shadows a module a test imports.
|
|
7
|
+
* Directories in `SKIPPED` and the given outputs of mootant are left out. A
|
|
8
|
+
* symbolic link counts by its target, never followed, and a path that is
|
|
9
|
+
* neither a file nor a directory by its name, as `hashFiles` cannot read it. A
|
|
10
|
+
* directory that cannot be listed may still hold files a test loads by their
|
|
11
|
+
* paths, so the tree then has no hash. The entries go into the hash one at a
|
|
12
|
+
* time, so a large tree never makes one long text, and come back by path, so a
|
|
13
|
+
* later tree can name what changed.
|
|
14
|
+
*
|
|
15
|
+
* @param root - Directory whose contents are hashed: the project root.
|
|
16
|
+
* @param outputs - Absolute paths mootant writes into the project during or
|
|
17
|
+
* after a run, such as the HTML report and the work directory, which are left
|
|
18
|
+
* out.
|
|
19
|
+
* @returns The hash with the entry of every path, or null when a directory
|
|
20
|
+
* cannot be listed or a link cannot be read.
|
|
21
|
+
*/
|
|
22
|
+
export declare function hashProjectTree(root: string, outputs: readonly string[]): Promise<ProjectTree | null>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { compareCodeUnits as e } from "../compare-code-units.js";
|
|
2
|
+
import { getPortablePath as t } from "./get-portable-path.js";
|
|
3
|
+
import { runInChunks as n } from "./run-in-chunks.js";
|
|
4
|
+
import { hashFiles as r } from "./hash-files.js";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
import { createHash as a } from "node:crypto";
|
|
7
|
+
import { readdir as o, readlink as s } from "node:fs/promises";
|
|
8
|
+
const c = /* @__PURE__ */ new Set([
|
|
9
|
+
"node_modules",
|
|
10
|
+
".pnpm-store",
|
|
11
|
+
".mootant",
|
|
12
|
+
".git"
|
|
13
|
+
]);
|
|
14
|
+
async function l(o, s) {
|
|
15
|
+
let l = new Set(s), f = [], p = 0, m = [], h = [];
|
|
16
|
+
async function g(e) {
|
|
17
|
+
let r = [];
|
|
18
|
+
await n(e, 32, async (e) => {
|
|
19
|
+
let n = await u(e);
|
|
20
|
+
if (n === null) p += 1;
|
|
21
|
+
else {
|
|
22
|
+
f.push([
|
|
23
|
+
t(e, o),
|
|
24
|
+
"directory",
|
|
25
|
+
null
|
|
26
|
+
]);
|
|
27
|
+
for (let t of n) {
|
|
28
|
+
let n = i.join(e, t.name);
|
|
29
|
+
l.has(n) || (t.isSymbolicLink() ? h.push(n) : t.isDirectory() ? c.has(t.name) || r.push(n) : m.push(n));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}), r.length > 0 && await g(r);
|
|
33
|
+
}
|
|
34
|
+
if (await g([o]), await n(h, 32, async (e) => {
|
|
35
|
+
let n = await d(e);
|
|
36
|
+
n === null && (p += 1), f.push([
|
|
37
|
+
t(e, o),
|
|
38
|
+
"link",
|
|
39
|
+
n
|
|
40
|
+
]);
|
|
41
|
+
}), p > 0) return null;
|
|
42
|
+
let _ = await r(m);
|
|
43
|
+
for (let e of m) f.push([
|
|
44
|
+
t(e, o),
|
|
45
|
+
"file",
|
|
46
|
+
_.get(e)
|
|
47
|
+
]);
|
|
48
|
+
let v = f.toSorted(([t], [n]) => e(t, n)), y = a("sha256");
|
|
49
|
+
for (let e of v) y.update(`${JSON.stringify(e)}\n`);
|
|
50
|
+
return {
|
|
51
|
+
entries: new Map(v.map(([e, t, n]) => [e, JSON.stringify([t, n])])),
|
|
52
|
+
hash: y.digest("hex")
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function u(e) {
|
|
56
|
+
try {
|
|
57
|
+
return await o(e, { withFileTypes: !0 });
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function d(e) {
|
|
63
|
+
try {
|
|
64
|
+
return await s(e);
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export { l as hashProjectTree };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells whether a thrown value is the error that ends a replay of a saved dry
|
|
3
|
+
* run (`createDryReuseMiss`).
|
|
4
|
+
*
|
|
5
|
+
* @param error - Thrown value.
|
|
6
|
+
* @returns Whether the value is an object named `DryReuseMiss`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isDryReuseMiss(error: unknown): error is Error;
|
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
* @param input - Hashes of the files and the project root.
|
|
7
7
|
* @param input.hashes - Hashes of the files by absolute path, null for a
|
|
8
8
|
* missing one.
|
|
9
|
+
* @param input.paths - Portable paths by absolute path, which calls that list
|
|
10
|
+
* the same files share: a path found there is taken, and one computed is
|
|
11
|
+
* added. None when omitted.
|
|
9
12
|
* @param input.root - Project root; paths are listed relative to it.
|
|
10
13
|
* @returns Portable path and hash of each file, or null for a file without a
|
|
11
14
|
* hash.
|
|
12
15
|
*/
|
|
13
16
|
export declare function listFileHashes(files: Iterable<string>, input: {
|
|
14
17
|
hashes: ReadonlyMap<string, string | null>;
|
|
18
|
+
paths?: Map<string, string>;
|
|
15
19
|
root: string;
|
|
16
20
|
}): [string, string | null][];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { compareCodeUnits as e } from "../compare-code-units.js";
|
|
2
2
|
import { getPortablePath as t } from "./get-portable-path.js";
|
|
3
3
|
function n(n, r) {
|
|
4
|
-
let {
|
|
5
|
-
return [...new Set(n)].map((e) =>
|
|
4
|
+
let { paths: i = /* @__PURE__ */ new Map(), hashes: a, root: o } = r;
|
|
5
|
+
return [...new Set(n)].map((e) => {
|
|
6
|
+
let n = i.get(e);
|
|
7
|
+
return n === void 0 && (n = t(e, o), i.set(e, n)), [n, a.get(e) ?? null];
|
|
8
|
+
}).toSorted(([t], [n]) => e(t, n));
|
|
6
9
|
}
|
|
7
10
|
export { n as listFileHashes };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists the files that tell what a package manager installed, in the root and
|
|
3
|
+
* in every directory above it, where Node looks for packages, as in a workspace
|
|
4
|
+
* that installs above the root with or without a lockfile. They follow what is
|
|
5
|
+
* installed when the lockfile does not, as after a switch of branches without
|
|
6
|
+
* an install. Every name is listed, missing files included, so one that appears
|
|
7
|
+
* changes the hashes as a changed one does.
|
|
8
|
+
*
|
|
9
|
+
* @param root - Project root.
|
|
10
|
+
* @returns Absolute paths, missing files included, from the root up.
|
|
11
|
+
*/
|
|
12
|
+
export declare function listInstallStates(root: string): string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import e from "node:path";
|
|
2
|
+
const t = [
|
|
3
|
+
"node_modules/.package-lock.json",
|
|
4
|
+
"node_modules/.pnpm/lock.yaml",
|
|
5
|
+
"node_modules/.yarn-state.yml",
|
|
6
|
+
"node_modules/.yarn-integrity",
|
|
7
|
+
".pnp.data.json",
|
|
8
|
+
".pnp.cjs"
|
|
9
|
+
];
|
|
10
|
+
function n(n) {
|
|
11
|
+
let r = [], i = n;
|
|
12
|
+
for (;;) {
|
|
13
|
+
for (let n of t) r.push(e.join(i, n));
|
|
14
|
+
let n = e.dirname(i);
|
|
15
|
+
if (n === i) return r;
|
|
16
|
+
i = n;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export { n as listInstallStates };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hashes environment variables of the main process for a saved dry run
|
|
3
|
+
* (`DrySnapshot.variables`): each variable that test code read, by name, set or
|
|
4
|
+
* not, and under `*` every variable but those that change from one shell to
|
|
5
|
+
* another (`VOLATILE_VARIABLES`), so that adding, removing or changing any of
|
|
6
|
+
* them changes it. The configuration of the test runner and its own code read
|
|
7
|
+
* variables in the main process, where nothing tracks which, and what they read
|
|
8
|
+
* goes into the settings and the variables a replay takes from the saved run.
|
|
9
|
+
*
|
|
10
|
+
* @param names - Names test code read; `*` is added if missing.
|
|
11
|
+
* @param environment - Environment variables of the main process.
|
|
12
|
+
* @returns Name and SHA-256 in hex of each value, or null when unset, sorted by
|
|
13
|
+
* name.
|
|
14
|
+
*/
|
|
15
|
+
export declare function listVariableHashes(names: Iterable<string>, environment: NodeJS.ProcessEnv): [string, string | null][];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VOLATILE_VARIABLES as e } from "./volatile-variables.js";
|
|
2
|
+
import { compareCodeUnits as t } from "../compare-code-units.js";
|
|
3
|
+
import { createDigest as n } from "./create-digest.js";
|
|
4
|
+
import { createHash as r } from "node:crypto";
|
|
5
|
+
function i(e, n) {
|
|
6
|
+
return [.../* @__PURE__ */ new Set([...e, "*"])].toSorted(t).map((e) => [e, e === "*" ? a(n) : o(n[e])]);
|
|
7
|
+
}
|
|
8
|
+
function a(r) {
|
|
9
|
+
return n(Object.entries(r).filter(([t, n]) => n !== void 0 && !e.has(t)).toSorted(([e], [n]) => t(e, n)));
|
|
10
|
+
}
|
|
11
|
+
function o(e) {
|
|
12
|
+
return e === void 0 ? null : r("sha256").update(e).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
export { i as listVariableHashes };
|