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,13 @@
|
|
|
1
|
+
import { findTsconfigProperty as e } from "./find-tsconfig-property.js";
|
|
2
|
+
import { parseTsconfig as t } from "./parse-tsconfig.js";
|
|
3
|
+
import n from "node:path";
|
|
4
|
+
function r(r) {
|
|
5
|
+
let i = e(t(r), "references"), a = i?.type === "ArrayExpression" ? i.elements : [], o = n.dirname(r);
|
|
6
|
+
return a.flatMap((t) => {
|
|
7
|
+
let r = e(t, "path");
|
|
8
|
+
if (r?.type !== "Literal" || typeof r.value != "string") return [];
|
|
9
|
+
let i = n.resolve(o, r.value);
|
|
10
|
+
return [i.endsWith(".json") ? i : n.join(i, "tsconfig.json")];
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export { r as readTsconfigReferences };
|
|
@@ -23,18 +23,19 @@ export interface FileAccessReceiver {
|
|
|
23
23
|
* `open` reads unless its flags create, empty or append to the file, as `w`,
|
|
24
24
|
* `a` or `O_CREAT` do; `r+` reads. The source of a copy, a move or a link is
|
|
25
25
|
* read, and so is every file and directory in a directory `cp` copies, outside
|
|
26
|
-
* `node_modules`
|
|
27
|
-
* `filter`, `force: false` or
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* directory where each pattern's fixed
|
|
35
|
-
*
|
|
36
|
-
* the asynchronous work of `glob` and
|
|
37
|
-
*
|
|
26
|
+
* `.git`, and outside `node_modules` too with a `filter`, whose copies it
|
|
27
|
+
* writes once it succeeded, unless a `filter`, `force: false` or
|
|
28
|
+
* `verbatimSymlinks` may make a copy other than its source (`listCopies`);
|
|
29
|
+
* `mkdir` writes only the directories that did not exist. `mkdtemp` and
|
|
30
|
+
* `mkdtempDisposable` write the directory they made once they give it. A
|
|
31
|
+
* recursive `readdir` or `opendir` reads the directory and every directory in
|
|
32
|
+
* it, each listed by its own names, so adding a file anywhere in the tree
|
|
33
|
+
* changes what was read; `readdir` also reads the directories behind the links
|
|
34
|
+
* it follows. `glob` reads the same of the directory where each pattern's fixed
|
|
35
|
+
* part ends. Calls of `node:fs` that a wrapped function makes while it runs
|
|
36
|
+
* report nothing, and neither do those of the asynchronous work of `glob` and
|
|
37
|
+
* `cp`, but those of their callbacks do. Descriptors and file handles are not
|
|
38
|
+
* paths and are not reported.
|
|
38
39
|
*
|
|
39
40
|
* @param receiver - Receives the paths while it is the current receiver; the
|
|
40
41
|
* next call replaces it, and null stops recording.
|
|
@@ -34,10 +34,10 @@ const a = /* @__PURE__ */ new Set([
|
|
|
34
34
|
"rename",
|
|
35
35
|
"link",
|
|
36
36
|
"cp"
|
|
37
|
-
]), c = /* @__PURE__ */ new Set(["mkdtempDisposable", "mkdtemp"]), l = /* @__PURE__ */ new Set(["glob", "cp"]), u = /* @__PURE__ */ new Set(["
|
|
38
|
-
let
|
|
39
|
-
function
|
|
40
|
-
let r = globalThis, s = r[
|
|
37
|
+
]), c = /* @__PURE__ */ new Set(["mkdtempDisposable", "mkdtemp"]), l = /* @__PURE__ */ new Set(["glob", "cp"]), u = /* @__PURE__ */ new Set([".git"]), d = /* @__PURE__ */ new Set([...u, "node_modules"]), f = /[!()*+?@[\\\]{}]/u, p = t.constants.O_WRONLY | t.constants.O_APPEND | t.constants.O_CREAT | t.constants.O_TRUNC, m = Symbol.for("mootant.file-reads");
|
|
38
|
+
let h = n.resolve, g = n.dirname, _ = n.join, v = r;
|
|
39
|
+
function y(n) {
|
|
40
|
+
let r = globalThis, s = r[m];
|
|
41
41
|
if (s === void 0) {
|
|
42
42
|
s = {
|
|
43
43
|
original: {
|
|
@@ -49,7 +49,7 @@ function v(n) {
|
|
|
49
49
|
walking: new i(),
|
|
50
50
|
receiver: null,
|
|
51
51
|
inside: !1
|
|
52
|
-
}, r[
|
|
52
|
+
}, r[m] = s;
|
|
53
53
|
let n = [
|
|
54
54
|
...a,
|
|
55
55
|
...Object.keys(o),
|
|
@@ -57,13 +57,13 @@ function v(n) {
|
|
|
57
57
|
].flatMap((e) => [e, `${e}Sync`]);
|
|
58
58
|
for (let e of [t, t.promises]) for (let t of n) {
|
|
59
59
|
let n = Reflect.get(e, t);
|
|
60
|
-
typeof n == "function" && Reflect.set(e, t,
|
|
60
|
+
typeof n == "function" && Reflect.set(e, t, b(n, t, s));
|
|
61
61
|
}
|
|
62
62
|
e();
|
|
63
63
|
}
|
|
64
64
|
s.receiver = n;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function b(e, t, n) {
|
|
67
67
|
let r = t.replace(/Sync$/u, "");
|
|
68
68
|
function i(...i) {
|
|
69
69
|
if (n.inside || n.walking.getStore() === !0) return e.apply(this, i);
|
|
@@ -72,33 +72,33 @@ function y(e, t, n) {
|
|
|
72
72
|
let e = a;
|
|
73
73
|
try {
|
|
74
74
|
if (c.has(r)) o = (t) => {
|
|
75
|
-
let n = t.path ?? t, r =
|
|
75
|
+
let n = t.path ?? t, r = h(Buffer.isBuffer(n) ? n.toString() : String(n));
|
|
76
76
|
e.write(r);
|
|
77
77
|
};
|
|
78
78
|
else {
|
|
79
|
-
let t =
|
|
79
|
+
let t = j(r, i, n);
|
|
80
80
|
for (let n of t.read) e.read(n);
|
|
81
81
|
for (let n of t.written) e.write(n);
|
|
82
|
-
let a = r === "cp" ?
|
|
82
|
+
let a = r === "cp" ? T(i, t.read, n) : [];
|
|
83
83
|
a.length > 0 && (o = () => {
|
|
84
84
|
for (let t of a) e.write(t);
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
} catch {}
|
|
88
88
|
}
|
|
89
|
-
let s = (t) => o === null ? e.apply(this, t) :
|
|
89
|
+
let s = (t) => o === null ? e.apply(this, t) : x((...t) => e.apply(this, t), t, o);
|
|
90
90
|
n.inside = !0;
|
|
91
91
|
try {
|
|
92
92
|
if (!l.has(t)) return s(i);
|
|
93
|
-
let e =
|
|
94
|
-
return t === "glob" ?
|
|
93
|
+
let e = M(i, n), r = n.walking.run(!0, () => s(e));
|
|
94
|
+
return t === "glob" ? k(r, n) : r;
|
|
95
95
|
} finally {
|
|
96
96
|
n.inside = !1;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
return Object.defineProperties(i, Object.getOwnPropertyDescriptors(e)), i;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function x(e, t, n) {
|
|
102
102
|
function r(e) {
|
|
103
103
|
try {
|
|
104
104
|
n(e);
|
|
@@ -117,7 +117,7 @@ function b(e, t, n) {
|
|
|
117
117
|
let o = e(...t);
|
|
118
118
|
return o instanceof Promise ? a(o) : (r(o), o);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function S(e, t, n) {
|
|
121
121
|
let r = [e], i = /* @__PURE__ */ new Set(), a = [e];
|
|
122
122
|
for (; a.length > 0;) {
|
|
123
123
|
let e = a.shift(), o = [];
|
|
@@ -125,7 +125,7 @@ function x(e, t, n) {
|
|
|
125
125
|
i.add(t.original.realpathSync(e)), o = t.original.readdirSync(e, { withFileTypes: !0 });
|
|
126
126
|
} catch {}
|
|
127
127
|
for (let s of o) {
|
|
128
|
-
let o =
|
|
128
|
+
let o = _(e, s.name), c = s.isDirectory();
|
|
129
129
|
if (n && s.isSymbolicLink()) try {
|
|
130
130
|
if (c = t.original.statSync(o).isDirectory(), c && i.has(t.original.realpathSync(o))) {
|
|
131
131
|
r.push(o);
|
|
@@ -137,70 +137,70 @@ function x(e, t, n) {
|
|
|
137
137
|
}
|
|
138
138
|
return r;
|
|
139
139
|
}
|
|
140
|
-
function S(e, t, n) {
|
|
141
|
-
let [r] = t, i = M(e[1]), a = e[2] ?? {};
|
|
142
|
-
return r === void 0 || i === null || a.filter !== void 0 || a.force === !1 || a.verbatimSymlinks === !0 ? [] : t.map((e) => `${i}${e.slice(r.length)}`).filter((e) => {
|
|
143
|
-
try {
|
|
144
|
-
return !n.original.statSync(e).isDirectory();
|
|
145
|
-
} catch {
|
|
146
|
-
return !0;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
140
|
function C(e, t, n) {
|
|
151
|
-
|
|
152
|
-
let r = [];
|
|
141
|
+
let r = [e], i = [];
|
|
153
142
|
try {
|
|
154
|
-
t.original.statSync(e).isDirectory() &&
|
|
143
|
+
t.original.statSync(e).isDirectory() && i.push(e);
|
|
155
144
|
} catch {}
|
|
156
|
-
for (;
|
|
157
|
-
let e =
|
|
145
|
+
for (; i.length > 0;) {
|
|
146
|
+
let e = i.shift(), a = [];
|
|
158
147
|
try {
|
|
159
|
-
|
|
148
|
+
a = t.original.readdirSync(e, { withFileTypes: !0 });
|
|
160
149
|
} catch {}
|
|
161
|
-
for (let t of
|
|
162
|
-
let
|
|
163
|
-
|
|
150
|
+
for (let t of a) if (!n.has(t.name)) {
|
|
151
|
+
let n = _(e, t.name);
|
|
152
|
+
r.push(n), t.isDirectory() && i.push(n);
|
|
164
153
|
}
|
|
165
154
|
}
|
|
155
|
+
return r;
|
|
166
156
|
}
|
|
167
157
|
function w(e, t, n) {
|
|
168
|
-
let r =
|
|
169
|
-
written: [],
|
|
170
|
-
read: []
|
|
171
|
-
}, i = M(t[0]);
|
|
172
|
-
return i === null || (e === "open" && !P(t[1]) ? r.written.push(i) : (e === "readdir" || e === "opendir") && t[1]?.recursive ? r.read.push(...x(i, n, e === "readdir")) : r.read.push(i)), r;
|
|
173
|
-
}
|
|
174
|
-
function T(e, t, n) {
|
|
175
|
-
let r = M(t[0]);
|
|
158
|
+
let r = N(t[0]);
|
|
176
159
|
if (r === null || !s.has(e)) return [];
|
|
177
160
|
if (e === "symlink") {
|
|
178
|
-
let e =
|
|
179
|
-
return [e === null || typeof t[0] != "string" ? r :
|
|
161
|
+
let e = N(t[1]);
|
|
162
|
+
return [e === null || typeof t[0] != "string" ? r : h(g(e), t[0])];
|
|
180
163
|
}
|
|
181
164
|
if (e === "cp") {
|
|
182
|
-
let e = [];
|
|
183
|
-
return C(r, n, e
|
|
165
|
+
let e = t[2];
|
|
166
|
+
return C(r, n, typeof e == "object" && e && Reflect.get(e, "filter") !== void 0 ? d : u);
|
|
184
167
|
}
|
|
185
168
|
return [r];
|
|
186
169
|
}
|
|
187
|
-
function
|
|
188
|
-
let
|
|
189
|
-
|
|
170
|
+
function T(e, t, n) {
|
|
171
|
+
let [r] = t, i = N(e[1]), a = e[2] ?? {};
|
|
172
|
+
return r === void 0 || i === null || a.filter !== void 0 || a.force === !1 || a.verbatimSymlinks === !0 ? [] : t.map((e) => `${i}${e.slice(r.length)}`).filter((e) => {
|
|
173
|
+
try {
|
|
174
|
+
return !n.original.statSync(e).isDirectory();
|
|
175
|
+
} catch {
|
|
176
|
+
return !0;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function E(e, t, n) {
|
|
181
|
+
let r = {
|
|
182
|
+
written: [],
|
|
183
|
+
read: []
|
|
184
|
+
}, i = N(t[0]);
|
|
185
|
+
return i === null || (e === "open" && !F(t[1]) ? r.written.push(i) : (e === "readdir" || e === "opendir") && t[1]?.recursive ? r.read.push(...S(i, n, e === "readdir")) : r.read.push(i)), r;
|
|
186
|
+
}
|
|
187
|
+
function D(e, t) {
|
|
188
|
+
let n = [], r = [e[0]].flat(), i = e[1], a = typeof i == "object" ? N(i.cwd) : null;
|
|
189
|
+
for (let e of r) typeof e == "string" && n.push(...S(A(e, a ?? process.cwd()), t, !1));
|
|
190
190
|
return n;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function O(e, t, n) {
|
|
193
193
|
let r = [], i = o[e];
|
|
194
194
|
for (let a of i) {
|
|
195
|
-
let i =
|
|
195
|
+
let i = N(t[a]);
|
|
196
196
|
if (i !== null) {
|
|
197
|
-
if (e === "mkdir") for (; !n.original.existsSync(i);) r.push(i), i =
|
|
197
|
+
if (e === "mkdir") for (; !n.original.existsSync(i);) r.push(i), i = g(i);
|
|
198
198
|
else r.push(i);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
return r;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function k(e, t) {
|
|
204
204
|
if (e === void 0) return e;
|
|
205
205
|
let n = e, r = {
|
|
206
206
|
return: (e) => t.walking.run(!0, () => n.return(e)),
|
|
@@ -209,35 +209,35 @@ function O(e, t) {
|
|
|
209
209
|
};
|
|
210
210
|
return r;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
let n = e.split("/"), r = n.findIndex((e) =>
|
|
214
|
-
if (r === -1) return
|
|
215
|
-
let i =
|
|
216
|
-
for (let e of n.slice(r)) e === ".." && (i =
|
|
212
|
+
function A(e, t) {
|
|
213
|
+
let n = e.split("/"), r = n.findIndex((e) => f.test(e));
|
|
214
|
+
if (r === -1) return h(t, e);
|
|
215
|
+
let i = h(t, n.slice(0, r).join("/"));
|
|
216
|
+
for (let e of n.slice(r)) e === ".." && (i = g(i));
|
|
217
217
|
return i;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function j(e, t, n) {
|
|
220
220
|
return e === "glob" ? {
|
|
221
|
-
read:
|
|
221
|
+
read: D(t, n),
|
|
222
222
|
written: []
|
|
223
|
-
} : a.has(e) ?
|
|
224
|
-
read:
|
|
225
|
-
written:
|
|
223
|
+
} : a.has(e) ? E(e, t, n) : {
|
|
224
|
+
read: w(e, t, n),
|
|
225
|
+
written: O(e, t, n)
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function M(e, t) {
|
|
229
229
|
let n = e.at(-1);
|
|
230
230
|
return typeof n == "function" ? [...e.slice(0, -1), (...e) => t.walking.exit(() => Reflect.apply(n, void 0, e))] : e;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function N(e) {
|
|
233
233
|
let t = null;
|
|
234
|
-
return typeof e == "string" ? t = e :
|
|
234
|
+
return typeof e == "string" ? t = e : P(e) ? t = e.protocol === "file:" ? v(e) : null : e instanceof Buffer && (t = e.toString()), t === null ? null : h(t);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function P(e) {
|
|
237
237
|
let t = e;
|
|
238
238
|
return !!t?.href && !!t?.protocol && t?.auth === void 0 && t?.path === void 0;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
return typeof e == "number" ? (e &
|
|
240
|
+
function F(e) {
|
|
241
|
+
return typeof e == "number" ? (e & p) === 0 : typeof e != "string" || !/[aw]/u.test(e);
|
|
242
242
|
}
|
|
243
|
-
export {
|
|
243
|
+
export { y as trackFileReads };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Remembers a test process, which leads a process group of its own and so gets
|
|
3
3
|
* no signal the terminal sends, until it ends: while any is remembered, this
|
|
4
|
-
* process stops them all when it exits or gets SIGINT or
|
|
4
|
+
* process stops them all when it exits or gets SIGHUP, SIGINT, SIGQUIT or
|
|
5
|
+
* SIGTERM.
|
|
5
6
|
*
|
|
6
7
|
* @param pid - Process id of the test process.
|
|
7
8
|
* @returns Function that forgets the process once it ended.
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { stopLiveProcessGroups as e } from "./stop-live-process-groups.js";
|
|
2
2
|
import { LIVE_PROCESS_GROUPS as t } from "./live-process-groups.js";
|
|
3
|
-
const n = [
|
|
3
|
+
const n = [
|
|
4
|
+
"SIGHUP",
|
|
5
|
+
"SIGINT",
|
|
6
|
+
"SIGQUIT",
|
|
7
|
+
"SIGTERM"
|
|
8
|
+
];
|
|
4
9
|
function r(r) {
|
|
5
10
|
if (!process.listeners("exit").includes(e)) {
|
|
6
11
|
process.on("exit", e);
|
|
@@ -11,7 +16,7 @@ function r(r) {
|
|
|
11
16
|
};
|
|
12
17
|
}
|
|
13
18
|
function i(t) {
|
|
14
|
-
e(), a(), process.listenerCount(t) === 0 && process.kill(process.pid, t);
|
|
19
|
+
e(), a(), process.listenerCount(t) === 0 && process.kill(process.pid, process.platform === "win32" ? "SIGINT" : t);
|
|
15
20
|
}
|
|
16
21
|
function a() {
|
|
17
22
|
process.off("exit", e);
|
|
@@ -7,9 +7,10 @@ import { UnitOutcome } from './types/unit-outcome.js';
|
|
|
7
7
|
* stopped its worker, else `crash`. A failed cleanup of worker-scoped fixtures
|
|
8
8
|
* or a failed teardown of the test environment is the unit's hook error; a
|
|
9
9
|
* suite hook that hit Vitest's hook timeout marks the unit as timed out. A unit
|
|
10
|
-
* that ended reports how long its process took to start: from the moment
|
|
11
|
-
*
|
|
12
|
-
* waited for its turn
|
|
10
|
+
* that ended reports how long its process took to start: from the moment its
|
|
11
|
+
* task got the worker from the pool, a spare one included, to the moment the
|
|
12
|
+
* worker began the unit, before it waited for its turn, both on the wall
|
|
13
|
+
* clock.
|
|
13
14
|
*
|
|
14
15
|
* @param handle - Live Vitest instance of the session.
|
|
15
16
|
* @param unit - Index of the unit in the plan.
|
|
@@ -6,11 +6,17 @@ import { TestProject } from 'vitest/node';
|
|
|
6
6
|
* module graph, transitively, which takes in files plugins watch and literal
|
|
7
7
|
* dynamic imports that did not run, with all they import: modules that were
|
|
8
8
|
* never transformed are transformed first, so their imports are known. Each
|
|
9
|
-
* directory of those files
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* directory of those files, of TypeScript files only under `node_modules`, adds
|
|
10
|
+
* the `tsconfig.json` files that may decide how Vite transforms it
|
|
11
|
+
* (`listTsconfigFiles`). Virtual modules (`isVirtualModule`) are followed but
|
|
12
|
+
* not listed, so the files plugins watch for them are in; files under
|
|
13
|
+
* `node_modules` are listed but not followed, as Vite transforms none of the
|
|
14
|
+
* packages Node loads, so what they import is in only when the worker reported
|
|
15
|
+
* it, each with the `package.json` files that decide its format and its `#`
|
|
16
|
+
* imports (`listPackageFiles`) and the `package.json` of its package, which
|
|
17
|
+
* decides what an import of the package resolves to (`getPackageManifest`), as
|
|
18
|
+
* Node, not Vite, resolves and loads what Vitest leaves to it. The test file
|
|
19
|
+
* itself is always in.
|
|
14
20
|
*
|
|
15
21
|
* @param input - Test file, its project and what its worker reported.
|
|
16
22
|
* @param input.project - Project the test file ran in.
|
|
@@ -1,39 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import i from "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { getPackageManifest as e } from "../../core/files/get-package-manifest.js";
|
|
2
|
+
import { listPackageFiles as t } from "../../core/files/list-package-files.js";
|
|
3
|
+
import { listTsconfigFiles as n } from "../shared/list-tsconfig-files.js";
|
|
4
|
+
import { compareCodeUnits as r } from "../../core/compare-code-units.js";
|
|
5
|
+
import { isVirtualModule as i } from "./is-virtual-module.js";
|
|
6
|
+
import { getModuleFile as a } from "./get-module-file.js";
|
|
7
|
+
import o from "node:path";
|
|
8
|
+
const s = /[/\\]node_modules[/\\]/u, c = /\.[cm]?tsx?$/u;
|
|
9
|
+
async function l(l) {
|
|
10
|
+
let { reported: u, project: d } = l;
|
|
11
|
+
if (u == null) return null;
|
|
12
|
+
let f = /* @__PURE__ */ new Set([l.file]);
|
|
13
|
+
function p(e) {
|
|
14
|
+
let t = a(e);
|
|
15
|
+
return t === null ? i(e) : (f.add(t), !s.test(t));
|
|
13
16
|
}
|
|
14
|
-
let
|
|
15
|
-
async function
|
|
17
|
+
let m = Object.values(d.vite.environments), h = /* @__PURE__ */ new Set();
|
|
18
|
+
async function g(e, t) {
|
|
16
19
|
if (e.transformResult === null) try {
|
|
17
20
|
await t.transformRequest(e.url);
|
|
18
21
|
} catch {}
|
|
19
|
-
let n = [...e.importedModules].filter((e) => !
|
|
20
|
-
for (let e of n)
|
|
21
|
-
await Promise.all(n.map((e) =>
|
|
22
|
+
let n = [...e.importedModules].filter((e) => !h.has(e) && p(e.file ?? e.id ?? ""));
|
|
23
|
+
for (let e of n) h.add(e);
|
|
24
|
+
await Promise.all(n.map((e) => g(e, t)));
|
|
22
25
|
}
|
|
23
|
-
let
|
|
24
|
-
for (let e of
|
|
26
|
+
let _ = [];
|
|
27
|
+
for (let e of u) if (p(e)) for (let t of m) {
|
|
25
28
|
let n = t.moduleGraph.getModuleById(e);
|
|
26
29
|
if (n !== void 0) {
|
|
27
|
-
|
|
30
|
+
h.has(n) || (h.add(n), _.push(g(n, t)));
|
|
28
31
|
break;
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
|
-
await Promise.all(
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
let
|
|
35
|
-
|
|
34
|
+
await Promise.all(_);
|
|
35
|
+
let v = /* @__PURE__ */ new Map(), y = [...f].flatMap((n) => {
|
|
36
|
+
if (!s.test(n)) return [];
|
|
37
|
+
let r = e(n);
|
|
38
|
+
return [...t(o.dirname(n), v), ...r === null ? [] : [r]];
|
|
39
|
+
});
|
|
40
|
+
for (let e of y) f.add(e);
|
|
41
|
+
let b = new Set([...f].filter((e) => !s.test(e) || c.test(e)).map(o.dirname));
|
|
42
|
+
for (let e of b) {
|
|
43
|
+
let t = n(e, l.tsconfigs, { references: !0 });
|
|
44
|
+
for (let e of t) f.add(e);
|
|
36
45
|
}
|
|
37
|
-
return [...
|
|
46
|
+
return [...f].toSorted(r);
|
|
38
47
|
}
|
|
39
|
-
export {
|
|
48
|
+
export { l as collectDependencies };
|
|
@@ -7,8 +7,9 @@ import { VitestSessionState } from './types/vitest-session-state.js';
|
|
|
7
7
|
* no shuffled tests, so runs follow the dry run's order (concurrency, retries
|
|
8
8
|
* and repeats stay; the runner makes tests sequential where it switches mutants
|
|
9
9
|
* between tries); snapshots are never written; transformed modules are not
|
|
10
|
-
* cached on disk
|
|
11
|
-
*
|
|
10
|
+
* cached on disk. Test locations keep the project's setting: the runner turns
|
|
11
|
+
* them on in dry runs only. Changing the pool or isolation adds a
|
|
12
|
+
* `config-overridden` warning. An unsupported setting is recorded as the
|
|
12
13
|
* session error instead. Typecheck-only projects are left alone.
|
|
13
14
|
*
|
|
14
15
|
* @param project - Vitest project as resolved from the user's configuration.
|
|
@@ -9,7 +9,7 @@ function n(n, i) {
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
let s = t(n);
|
|
12
|
-
a.pool !== "forks" && i.diagnostics.push(r(s, "pool: 'forks'", `pool: '${a.pool}'`)), a.isolate || i.diagnostics.push(r(s, "isolate: true", "isolate: false")), a.pool = i.pool.name, a.poolRunner = i.pool, a.isolate = !0, a.runner = i.runnerPath, a.sequence.shuffle = !1, a.snapshotOptions.updateSnapshot = "none", n.globalConfig.snapshotOptions.updateSnapshot = "none", n.vitest.snapshot.options.updateSnapshot = "none", a.fsModuleCache = !1
|
|
12
|
+
a.pool !== "forks" && i.diagnostics.push(r(s, "pool: 'forks'", `pool: '${a.pool}'`)), a.isolate || i.diagnostics.push(r(s, "isolate: true", "isolate: false")), a.pool = i.pool.name, a.poolRunner = i.pool, a.isolate = !0, a.runner = i.runnerPath, a.sequence.shuffle = !1, a.snapshotOptions.updateSnapshot = "none", n.globalConfig.snapshotOptions.updateSnapshot = "none", n.vitest.snapshot.options.updateSnapshot = "none", a.fsModuleCache = !1;
|
|
13
13
|
}
|
|
14
14
|
function r(e, t, n) {
|
|
15
15
|
return {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ForksPoolWorker } from 'vitest/node';
|
|
2
|
+
import { MootantForksPool } from './types/mootant-forks-pool.js';
|
|
2
3
|
/**
|
|
3
4
|
* Creates the custom pool mootant runs every project with: Vitest's own forks
|
|
4
|
-
* workers, through Vitest's public pool API, with
|
|
5
|
+
* workers, through Vitest's public pool API, with two changes. Vitest asks a
|
|
5
6
|
* worker to stop with a `stop` message and waits for its `stopped` answer, up
|
|
6
7
|
* to a minute, without watching the process meanwhile. A worker that hangs in
|
|
7
8
|
* its teardown never answers, and the watchdog kills it; so when the process of
|
|
@@ -10,13 +11,39 @@ import { PoolRunnerInitializer, ForksPoolWorker } from 'vitest/node';
|
|
|
10
11
|
* process that exited is not stopped again: Vitest's forks worker waits for an
|
|
11
12
|
* `exit` event that a process killed by a signal has already sent. Should
|
|
12
13
|
* Vitest change its stop messages, the stop simply waits for Vitest's timer as
|
|
13
|
-
* before.
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
14
|
+
* before.
|
|
15
|
+
*
|
|
16
|
+
* The pool also keeps spare workers for the tasks of the run it is told of
|
|
17
|
+
* (`prepare`): their processes start ahead and load Vitest's worker, but get
|
|
18
|
+
* the project, the test environment and the test file only once a task takes
|
|
19
|
+
* them, as messages of Vitest, so a task skips the start of a process, while no
|
|
20
|
+
* code of the project runs before. After each task takes its worker, spares
|
|
21
|
+
* start in the background for the tasks of its project still to come, as many
|
|
22
|
+
* in all as `getSpareLimit` allows for the project's `maxWorkers`; a task takes
|
|
23
|
+
* a spare whose process runs and whose key matches its own (`getSpareKey`),
|
|
24
|
+
* else starts a worker of its own. A spare that fails or ends is dropped; one
|
|
25
|
+
* that cannot start ends the spares of its project for the run. The spares left
|
|
26
|
+
* stop when the run is over (`drain`). Without spares (`MOOTANT_PREFORK=0`),
|
|
27
|
+
* with a worker whose flags rule them out, or should Vitest stop exposing the
|
|
28
|
+
* process of its first worker, every task starts its own worker.
|
|
29
|
+
*
|
|
30
|
+
* The pool notes when each task got its worker process, so the cost of a unit
|
|
31
|
+
* can include the start of its process.
|
|
32
|
+
*
|
|
33
|
+
* Once the run is interrupted (`interrupt`), the pool stops the process of
|
|
34
|
+
* every worker and spare it started that still runs, with `SIGKILL` through the
|
|
35
|
+
* process itself, which cannot stand for another process before it ended, and
|
|
36
|
+
* starts none: the start of a task fails at once, and a worker refused so has
|
|
37
|
+
* no process to stop. Vitest ends the run then as after a watchdog's kill.
|
|
38
|
+
* Should Vitest stop exposing the processes of its workers, an interrupted run
|
|
39
|
+
* waits until they end or the watchdog stops them. The watchdog stops a hung
|
|
40
|
+
* worker the same way (`stopWorker`); a process id that is none of the pool's
|
|
41
|
+
* running processes is left.
|
|
16
42
|
*
|
|
17
43
|
* @param Worker - Forks worker class of the project's Vitest.
|
|
18
|
-
* @param spawns - Receives the epoch milliseconds at which
|
|
44
|
+
* @param spawns - Receives the epoch milliseconds at which a task got its
|
|
19
45
|
* worker process, by process id.
|
|
46
|
+
* @param prefork - Whether the pool may keep spare workers.
|
|
20
47
|
* @returns Pool to set as the projects' `poolRunner`.
|
|
21
48
|
*/
|
|
22
|
-
export declare function createForksPool(Worker: typeof ForksPoolWorker, spawns: Map<number, number
|
|
49
|
+
export declare function createForksPool(Worker: typeof ForksPoolWorker, spawns: Map<number, number>, prefork: boolean): MootantForksPool;
|