mootant 0.1.0 → 0.2.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/dist/adapters/jest/build-dry-file.d.ts +12 -12
- package/dist/adapters/jest/collect-jest-dependencies.d.ts +8 -7
- package/dist/adapters/jest/runner.d.ts +1 -1
- package/dist/adapters/jest/runner.js +1 -1
- package/dist/adapters/jest/types/jest-record.d.ts +4 -4
- package/dist/adapters/jest/types/unit-worker.d.ts +16 -8
- package/dist/adapters/jest/types/worker-session.d.ts +6 -7
- package/dist/adapters/jest/worker/boot-worker.d.ts +4 -3
- package/dist/adapters/jest/worker/run-unit.d.ts +20 -18
- package/dist/adapters/jest/worker/vm-setup.js +1 -1
- package/dist/adapters/jest/worker/worker.js +1 -1
- package/dist/adapters/jest/write-worker-session.d.ts +1 -2
- package/dist/adapters/jest/write-worker-session.js +2 -2
- package/dist/adapters/node-test/collect-node-dependencies.d.ts +5 -5
- package/dist/adapters/node-test/preload/preload.js +4 -1
- package/dist/adapters/node-test/run-test-file.js +1 -0
- package/dist/adapters/node-test/types/node-test-record.d.ts +3 -3
- package/dist/adapters/node-test/types/node-test-unit.d.ts +6 -1
- package/dist/adapters/shared/create-input-filter.d.ts +26 -0
- package/dist/adapters/shared/create-input-filter.js +32 -0
- package/dist/adapters/shared/track-file-inputs.d.ts +7 -3
- package/dist/adapters/shared/track-file-inputs.js +16 -7
- package/dist/adapters/shared/track-file-reads.d.ts +12 -8
- package/dist/adapters/shared/track-file-reads.js +110 -57
- package/dist/adapters/shared/track-inputs.d.ts +13 -6
- package/dist/adapters/shared/track-inputs.js +7 -7
- package/dist/adapters/shared/types/file-input-tracking.d.ts +6 -0
- package/dist/adapters/shared/types/input-tracking.d.ts +3 -3
- package/dist/adapters/vitest/collect-dependencies.d.ts +4 -3
- package/dist/adapters/vitest/collect-dependencies.js +25 -24
- package/dist/adapters/vitest/get-cache-inputs.js +3 -1
- package/dist/adapters/vitest/is-virtual-module.d.ts +11 -0
- package/dist/adapters/vitest/is-virtual-module.js +8 -0
- package/dist/adapters/vitest/read-out-files.d.ts +7 -2
- package/dist/adapters/vitest/read-out-files.js +5 -5
- package/dist/adapters/vitest/read-out-records.d.ts +17 -0
- package/dist/adapters/vitest/read-out-records.js +27 -0
- package/dist/adapters/vitest/read-strays.d.ts +20 -0
- package/dist/adapters/vitest/read-strays.js +53 -0
- package/dist/adapters/vitest/read-unit-inputs.d.ts +7 -1
- package/dist/adapters/vitest/read-unit-inputs.js +1 -1
- package/dist/adapters/vitest/run-dry.js +16 -16
- package/dist/adapters/vitest/run-plan.d.ts +3 -1
- package/dist/adapters/vitest/run-plan.js +15 -15
- package/dist/adapters/vitest/run-specifications.d.ts +3 -2
- package/dist/adapters/vitest/runner.d.ts +38 -23
- package/dist/adapters/vitest/runner.js +84 -85
- package/dist/adapters/vitest/types/stray-decisions.d.ts +8 -0
- package/dist/adapters/vitest/types/unit-outcome.d.ts +2 -1
- package/dist/adapters/vitest/types/vitest-worker.d.ts +83 -12
- package/dist/adapters/vitest/worker/encode-stray.d.ts +16 -0
- package/dist/adapters/vitest/worker/encode-stray.js +16 -0
- package/dist/adapters/vitest/worker/intercept-strays.d.ts +26 -0
- package/dist/adapters/vitest/worker/intercept-strays.js +13 -0
- package/dist/adapters/vitest/worker/read-try-facts.d.ts +5 -4
- package/dist/adapters/vitest/worker/write-out-record.d.ts +2 -2
- package/dist/cli/html/build-html-report.js +1 -1
- package/dist/cli/html/client/main.js +1 -1
- package/dist/cli/html/client/render-change.d.ts +3 -2
- package/dist/cli/html/client/render-code.d.ts +1 -1
- package/dist/cli/html/pack-replacement.d.ts +1 -1
- package/dist/cli/parse-arguments.js +1 -1
- package/dist/cli/report/build-list-report.js +1 -1
- package/dist/cli/report/build-run-report.js +1 -1
- package/dist/cli/report/format-file-groups.d.ts +1 -1
- package/dist/cli/run-mutation.js +31 -31
- package/dist/cli/terminal/create-spinner.d.ts +1 -1
- package/dist/cli/terminal/get-text-style.js +4 -4
- package/dist/core/cache/get-environment-key.js +2 -2
- package/dist/core/cache/hash-files.d.ts +7 -3
- package/dist/core/cache/hash-files.js +16 -17
- package/dist/core/cache/prepare-run-cache.d.ts +29 -7
- package/dist/core/cache/prepare-run-cache.js +96 -62
- package/dist/core/cache/save-run-cache.d.ts +8 -7
- package/dist/core/cache/save-run-cache.js +2 -1
- package/dist/core/cache/unknown-hash.d.ts +7 -0
- package/dist/core/cache/unknown-hash.js +2 -0
- package/dist/core/files/select-changed-mutants.d.ts +11 -6
- package/dist/core/files/select-changed-mutants.js +38 -13
- package/dist/core/generate/apply-solitary-rule.d.ts +8 -5
- package/dist/core/generate/apply-solitary-rule.js +36 -29
- package/dist/core/generate/collect-candidates.d.ts +18 -4
- package/dist/core/generate/collect-candidates.js +168 -86
- package/dist/core/generate/compare-targets.d.ts +14 -0
- package/dist/core/generate/compare-targets.js +6 -0
- package/dist/core/generate/deduplicate-candidates.d.ts +6 -4
- package/dist/core/generate/deduplicate-candidates.js +11 -9
- package/dist/core/generate/find-list-removal.d.ts +20 -0
- package/dist/core/generate/find-list-removal.js +26 -0
- package/dist/core/generate/generate-file-mutants.js +47 -46
- package/dist/core/generate/get-mutant-site.d.ts +18 -0
- package/dist/core/generate/get-mutant-site.js +4 -0
- package/dist/core/generate/get-target.d.ts +14 -0
- package/dist/core/generate/get-target.js +4 -0
- package/dist/core/generate/pick-host.d.ts +10 -0
- package/dist/core/generate/pick-host.js +16 -0
- package/dist/core/generate/validate-replacement.d.ts +15 -4
- package/dist/core/generate/validate-replacement.js +28 -13
- package/dist/core/ignore/find-ignore-rule.d.ts +8 -7
- package/dist/core/instrument/find-attribute-values.d.ts +12 -0
- package/dist/core/instrument/find-attribute-values.js +13 -0
- package/dist/core/instrument/get-site-syntax.d.ts +14 -0
- package/dist/core/instrument/get-site-syntax.js +12 -0
- package/dist/core/instrument/group-mutant-ranges.d.ts +7 -3
- package/dist/core/instrument/group-mutant-ranges.js +25 -19
- package/dist/core/instrument/instrument-file.d.ts +5 -3
- package/dist/core/instrument/instrument-file.js +10 -9
- package/dist/core/instrument/instrumenter-version.d.ts +1 -1
- package/dist/core/instrument/render-branch.d.ts +17 -0
- package/dist/core/instrument/render-branch.js +81 -0
- package/dist/core/instrument/render-mutant-range.d.ts +17 -6
- package/dist/core/instrument/render-mutant-range.js +39 -13
- package/dist/core/list-mutants.d.ts +7 -5
- package/dist/core/list-mutants.js +2 -2
- package/dist/core/mutators/array-element.d.ts +7 -6
- package/dist/core/mutators/array-element.js +13 -13
- package/dist/core/mutators/assignment-operator.js +34 -33
- package/dist/core/mutators/boolean-literal.d.ts +3 -2
- package/dist/core/mutators/number-literal.d.ts +1 -1
- package/dist/core/mutators/object-property.d.ts +4 -3
- package/dist/core/mutators/object-property.js +7 -8
- package/dist/core/mutators/return-value.js +65 -33
- package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +12 -7
- package/dist/core/mutators/shared/get-branch-copy-skip.js +34 -35
- package/dist/core/mutators/shared/get-canonical-falsy-default.d.ts +32 -0
- package/dist/core/mutators/shared/get-canonical-falsy-default.js +11 -0
- package/dist/core/mutators/shared/get-comparison-plan.js +86 -85
- package/dist/core/mutators/shared/get-condition-constants.d.ts +8 -8
- package/dist/core/mutators/shared/get-condition-constants.js +3 -3
- package/dist/core/mutators/shared/get-endless-value.d.ts +20 -0
- package/dist/core/mutators/shared/get-endless-value.js +25 -0
- package/dist/core/mutators/shared/get-forced-test-justifier.d.ts +44 -0
- package/dist/core/mutators/shared/get-forced-test-justifier.js +25 -0
- package/dist/core/mutators/shared/get-group-constant.d.ts +4 -4
- package/dist/core/mutators/shared/get-group-constant.js +2 -2
- package/dist/core/mutators/shared/get-literal-skip.d.ts +6 -6
- package/dist/core/mutators/shared/get-literal-skip.js +2 -2
- package/dist/core/mutators/shared/get-logical-drops.d.ts +8 -8
- package/dist/core/mutators/shared/get-logical-drops.js +80 -82
- package/dist/core/mutators/shared/get-owner-constant.d.ts +3 -1
- package/dist/core/mutators/shared/get-running-value.d.ts +5 -4
- package/dist/core/mutators/shared/get-toward-mutant.d.ts +10 -2
- package/dist/core/mutators/shared/get-toward-mutant.js +45 -40
- package/dist/core/mutators/shared/has-other-exit.js +16 -36
- package/dist/core/mutators/shared/is-loop-exit.d.ts +20 -0
- package/dist/core/mutators/shared/is-loop-exit.js +32 -0
- package/dist/core/mutators/shared/is-read-only.d.ts +26 -0
- package/dist/core/mutators/shared/is-read-only.js +53 -0
- package/dist/core/mutators/statement-removal.d.ts +4 -3
- package/dist/core/mutators/statement-removal.js +69 -73
- package/dist/core/mutators/string-literal.d.ts +15 -5
- package/dist/core/mutators/string-literal.js +79 -50
- package/dist/core/presets/recommended.d.ts +2 -2
- package/dist/core/presets/strict.d.ts +4 -2
- package/dist/core/run/apply-batch-result.d.ts +23 -22
- package/dist/core/run/apply-batch-result.js +5 -5
- package/dist/core/run/apply-isolated-result.d.ts +18 -17
- package/dist/core/run/apply-isolated-result.js +1 -0
- package/dist/core/run/classify-try.d.ts +9 -8
- package/dist/core/run/get-test-file-limits.d.ts +13 -0
- package/dist/core/run/get-test-file-limits.js +13 -0
- package/dist/core/run/get-unit-evidence.d.ts +6 -3
- package/dist/core/run/get-unit-evidence.js +1 -1
- package/dist/core/run/plan-batch.d.ts +6 -3
- package/dist/core/run/plan-batch.js +36 -31
- package/dist/core/run/plan-isolated.d.ts +3 -1
- package/dist/core/run/plan-isolated.js +8 -14
- package/dist/core/run/read-isolated-unit.d.ts +4 -4
- package/dist/core/run/run-batch-phases.d.ts +4 -3
- package/dist/core/run/run-dry-phase.d.ts +35 -19
- package/dist/core/run/run-dry-phase.js +127 -77
- package/dist/core/run/run-isolated-rounds.d.ts +6 -5
- package/dist/core/run/run-isolated-rounds.js +1 -0
- package/dist/core/run-mutants.d.ts +26 -21
- package/dist/core/run-mutants.js +72 -64
- package/dist/core/runtime/create-hit-limit-error.d.ts +5 -3
- package/dist/core/runtime/create-hit-limit-error.js +1 -1
- package/dist/core/runtime/install-mutant-runtime.js +23 -6
- package/dist/core/runtime/runtime-version.d.ts +4 -4
- package/dist/core/skips/skip-rules.d.ts +4 -0
- package/dist/core/skips/skip-rules.js +4 -0
- package/dist/core/syntax/is-brace-sensitive-attribute.d.ts +18 -0
- package/dist/core/syntax/is-brace-sensitive-attribute.js +28 -0
- package/dist/core/syntax/is-spread-safe-member.d.ts +18 -0
- package/dist/core/syntax/is-spread-safe-member.js +18 -0
- package/dist/core/syntax/is-value-position.d.ts +3 -1
- package/dist/core/text/get-list-removal-range.d.ts +22 -0
- package/dist/core/text/get-list-removal-range.js +46 -0
- package/dist/core/text/is-plain-attribute-string.d.ts +10 -0
- package/dist/core/text/is-plain-attribute-string.js +5 -0
- package/dist/core/text/parse-expression.d.ts +8 -4
- package/dist/core/text/parse-expression.js +1 -0
- package/dist/core/text/remove-list-element.d.ts +2 -4
- package/dist/core/text/remove-list-element.js +4 -45
- package/dist/docs/styles/colors.js +1 -1
- package/dist/package.js +1 -1
- package/dist/types/adapter/dry-file.d.ts +2 -1
- package/dist/types/adapter/dry-run-request.d.ts +5 -4
- package/dist/types/adapter/mutant-runtime.d.ts +30 -1
- package/dist/types/cli/text-style.d.ts +1 -1
- package/dist/types/config/preset-settings.d.ts +2 -2
- package/dist/types/config/run-config.d.ts +12 -4
- package/dist/types/html/indexed-mutant.d.ts +4 -2
- package/dist/types/html/shown-change.d.ts +4 -3
- package/dist/types/mutant/list-removal.d.ts +37 -0
- package/dist/types/mutant/mutant-candidate.d.ts +11 -17
- package/dist/types/mutant/mutant-host.d.ts +49 -0
- package/dist/types/mutant/mutant-kind.d.ts +18 -0
- package/dist/types/mutant/mutant-range.d.ts +15 -8
- package/dist/types/mutant/mutant.d.ts +9 -15
- package/dist/types/mutant/site-syntax.d.ts +14 -0
- package/dist/types/mutant/skip-justifier.d.ts +3 -1
- package/dist/types/mutant/skipped-candidate.d.ts +13 -10
- package/dist/types/mutant/skipped-mutant.d.ts +9 -6
- package/dist/types/mutator/replacement.d.ts +14 -3
- package/dist/types/report/html-report.d.ts +10 -7
- package/dist/types/report/list-report-focus.d.ts +3 -2
- package/dist/types/report/list-report-justifier.d.ts +4 -2
- package/dist/types/report/list-report-mutant.d.ts +15 -9
- package/dist/types/report/list-report-skipped.d.ts +3 -2
- package/dist/types/report/list-report.d.ts +1 -1
- package/dist/types/report/run-report.d.ts +2 -2
- package/dist/types/report/slim-list-report.d.ts +6 -3
- package/dist/types/report/slim-run-report.d.ts +1 -1
- package/dist/types/run/isolated-reason.d.ts +4 -3
- package/dist/types/run/mutant-state.d.ts +1 -1
- package/dist/types/run/run-event.d.ts +1 -1
- package/dist/types/run/run-kind.d.ts +3 -2
- package/dist/types/run/run-result.d.ts +6 -3
- package/dist/types/run/run-state.d.ts +9 -1
- package/dist/types/run/run-status.d.ts +2 -2
- package/dist/types/run/try-cause.d.ts +8 -6
- package/dist/types/syntax/syntax-helpers.d.ts +5 -3
- package/package.json +5 -5
- package/skills/mootant/SKILL.md +14 -12
- package/skills/mootant/references/mutators.md +3 -1
- package/dist/core/instrument/get-site-check.d.ts +0 -9
- package/dist/core/instrument/get-site-check.js +0 -5
- package/dist/core/instrument/get-template-site-check.d.ts +0 -12
- package/dist/core/instrument/get-template-site-check.js +0 -5
- /package/dist/cli/{built-in-adapters.d.ts → get-built-in-adapters.d.ts} +0 -0
- /package/dist/cli/{built-in-adapters.js → get-built-in-adapters.js} +0 -0
- /package/dist/cli/terminal/{colors.d.ts → create-colors.d.ts} +0 -0
- /package/dist/cli/terminal/{colors.js → create-colors.js} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { realpathSync as e } from "node:fs";
|
|
2
|
+
import t from "node:path";
|
|
3
|
+
import { tmpdir as n, userInfo as r } from "node:os";
|
|
4
|
+
let { sep: i } = t;
|
|
5
|
+
function a(e) {
|
|
6
|
+
let { root: a } = e, u = l(t.resolve(n())), d = c(l(e.directory)), { geteuid: f } = process, p = f === void 0 ? r().username : f(), m = c(u.flatMap((e) => [t.join(e, `tsx-${p}`), t.join(e, "tsx")])), h = new Set(o(a, u).flatMap((e) => [...s(e)])), g = `${i}node_modules`, _ = `${g}${i}`;
|
|
7
|
+
return (e) => !e.includes(_) && !e.endsWith(g) && !h.has(e) && !d(e) && !m(e);
|
|
8
|
+
}
|
|
9
|
+
function o(e, t) {
|
|
10
|
+
let n = l(e), r = n.flatMap((e) => {
|
|
11
|
+
let n = t.find((t) => c([t])(e));
|
|
12
|
+
return n === void 0 ? [] : t.map((t) => `${t}${e.slice(n.length)}`);
|
|
13
|
+
});
|
|
14
|
+
return [.../* @__PURE__ */ new Set([...n, ...r])];
|
|
15
|
+
}
|
|
16
|
+
function s(e) {
|
|
17
|
+
let n = /* @__PURE__ */ new Set(), r = e, i = t.dirname(r);
|
|
18
|
+
for (; i !== r;) n.add(i), r = i, i = t.dirname(r);
|
|
19
|
+
return n;
|
|
20
|
+
}
|
|
21
|
+
function c(e) {
|
|
22
|
+
let t = e.map((e) => `${e}${i}`);
|
|
23
|
+
return (n) => e.includes(n) || t.some((e) => n.startsWith(e));
|
|
24
|
+
}
|
|
25
|
+
function l(t) {
|
|
26
|
+
try {
|
|
27
|
+
return [t, e(t)];
|
|
28
|
+
} catch {
|
|
29
|
+
return [t];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export { a as createInputFilter };
|
|
@@ -3,10 +3,14 @@ import { FileInputTracking } from './types/file-input-tracking.js';
|
|
|
3
3
|
* Starts recording the files and directories code reads through `node:fs`, and
|
|
4
4
|
* which of them it changed itself: the path it wrote or the directory that path
|
|
5
5
|
* is in. A read counts unless the code wrote that path earlier, since then it
|
|
6
|
-
* reads its own output and not an input
|
|
6
|
+
* reads its own output and not an input, as with a directory `mkdtemp` made or
|
|
7
|
+
* a copy `cp` wrote; anything else in a directory the code made counts, as it
|
|
8
|
+
* may come from what no read names, such as a child process or a link. A path
|
|
9
|
+
* written is taken as given and by the real path of its directory, so a read or
|
|
10
|
+
* a module that names it by that path, as `require` does, is the same.
|
|
7
11
|
*
|
|
8
12
|
* @param accept - Tells whether a path counts when it is read.
|
|
9
|
-
* @returns The files read so far
|
|
10
|
-
* returns what was read.
|
|
13
|
+
* @returns The files read so far, whether a path is one the code wrote, and the
|
|
14
|
+
* function that stops recording and returns what was read.
|
|
11
15
|
*/
|
|
12
16
|
export declare function trackFileInputs(accept: (file: string) => boolean): FileInputTracking;
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { trackFileReads as e } from "./track-file-reads.js";
|
|
2
|
-
import t from "node:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { realpathSync as t } from "node:fs";
|
|
3
|
+
import n from "node:path";
|
|
4
|
+
let r = n.dirname, i = n.basename, a = n.join, o = t;
|
|
5
|
+
function s(t) {
|
|
6
|
+
let n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
6
7
|
return e({
|
|
7
8
|
write: (e) => {
|
|
8
|
-
|
|
9
|
+
for (let t of [e, c(e)]) n.add(t), i.add(t), i.add(r(t));
|
|
9
10
|
},
|
|
10
11
|
read: (e) => {
|
|
11
|
-
t(e) && !
|
|
12
|
+
t(e) && !n.has(e) && a.add(e);
|
|
12
13
|
}
|
|
13
14
|
}), {
|
|
14
15
|
stop: () => (e(null), {
|
|
15
16
|
modified: [...a].filter((e) => i.has(e)).toSorted(),
|
|
16
17
|
files: [...a].toSorted()
|
|
17
18
|
}),
|
|
19
|
+
owns: (e) => n.has(e),
|
|
18
20
|
files: a
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
function c(e) {
|
|
24
|
+
try {
|
|
25
|
+
return a(o(r(e)), i(e));
|
|
26
|
+
} catch {
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export { s as trackFileInputs };
|
|
@@ -23,14 +23,18 @@ 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` and `.git
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
26
|
+
* `node_modules` and `.git`, whose copies it writes once it succeeded, unless a
|
|
27
|
+
* `filter`, `force: false` or `verbatimSymlinks` may make a copy other than its
|
|
28
|
+
* source (`listCopies`); `mkdir` writes only the directories that did not
|
|
29
|
+
* exist. `mkdtemp` and `mkdtempDisposable` write the directory they made once
|
|
30
|
+
* they give it. A recursive `readdir` or `opendir` reads the directory and
|
|
31
|
+
* every directory in it, each listed by its own names, so adding a file
|
|
32
|
+
* anywhere in the tree changes what was read; `readdir` also reads the
|
|
33
|
+
* directories behind the links it follows. `glob` reads the same of the
|
|
34
|
+
* directory where each pattern's fixed part ends. Calls of `node:fs` that a
|
|
35
|
+
* wrapped function makes while it runs report nothing, and neither do those of
|
|
36
|
+
* the asynchronous work of `glob` and `cp`, but those of their callbacks do.
|
|
37
|
+
* Descriptors and file handles are not paths and are not reported.
|
|
34
38
|
*
|
|
35
39
|
* @param receiver - Receives the paths while it is the current receiver; the
|
|
36
40
|
* next call replaces it, and null stops recording.
|
|
@@ -26,18 +26,18 @@ const a = /* @__PURE__ */ new Set([
|
|
|
26
26
|
rmdir: [0],
|
|
27
27
|
mkdir: [0],
|
|
28
28
|
link: [1],
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
rm: [0],
|
|
30
|
+
cp: []
|
|
31
31
|
}, s = /* @__PURE__ */ new Set([
|
|
32
32
|
"copyFile",
|
|
33
33
|
"symlink",
|
|
34
34
|
"rename",
|
|
35
35
|
"link",
|
|
36
36
|
"cp"
|
|
37
|
-
]), c = /* @__PURE__ */ new Set(["node_modules", ".git"]),
|
|
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(["node_modules", ".git"]), d = /[!()*+?@[\\\]{}]/u, f = t.constants.O_WRONLY | t.constants.O_APPEND | t.constants.O_CREAT | t.constants.O_TRUNC, p = Symbol.for("mootant.file-reads");
|
|
38
|
+
let m = n.resolve, h = n.dirname, g = n.join, _ = r;
|
|
39
|
+
function v(n) {
|
|
40
|
+
let r = globalThis, s = r[p];
|
|
41
41
|
if (s === void 0) {
|
|
42
42
|
s = {
|
|
43
43
|
original: {
|
|
@@ -46,39 +46,78 @@ function g(n) {
|
|
|
46
46
|
existsSync: t.existsSync,
|
|
47
47
|
statSync: t.statSync
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
walking: new i(),
|
|
50
50
|
receiver: null,
|
|
51
51
|
inside: !1
|
|
52
|
-
}, r[
|
|
53
|
-
let n = [
|
|
52
|
+
}, r[p] = s;
|
|
53
|
+
let n = [
|
|
54
|
+
...a,
|
|
55
|
+
...Object.keys(o),
|
|
56
|
+
...c
|
|
57
|
+
].flatMap((e) => [e, `${e}Sync`]);
|
|
54
58
|
for (let e of [t, t.promises]) for (let t of n) {
|
|
55
59
|
let n = Reflect.get(e, t);
|
|
56
|
-
typeof n == "function" && Reflect.set(e, t,
|
|
60
|
+
typeof n == "function" && Reflect.set(e, t, y(n, t, s));
|
|
57
61
|
}
|
|
58
62
|
e();
|
|
59
63
|
}
|
|
60
64
|
s.receiver = n;
|
|
61
65
|
}
|
|
62
|
-
function
|
|
66
|
+
function y(e, t, n) {
|
|
63
67
|
let r = t.replace(/Sync$/u, "");
|
|
64
68
|
function i(...i) {
|
|
65
|
-
if (n.inside || n.
|
|
66
|
-
let a = n.receiver;
|
|
67
|
-
if (a !== null)
|
|
68
|
-
let e =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
if (n.inside || n.walking.getStore() === !0) return e.apply(this, i);
|
|
70
|
+
let a = n.receiver, o = null;
|
|
71
|
+
if (a !== null) {
|
|
72
|
+
let e = a;
|
|
73
|
+
try {
|
|
74
|
+
if (c.has(r)) o = (t) => {
|
|
75
|
+
let n = t.path ?? t, r = m(Buffer.isBuffer(n) ? n.toString() : String(n));
|
|
76
|
+
e.write(r);
|
|
77
|
+
};
|
|
78
|
+
else {
|
|
79
|
+
let t = A(r, i, n);
|
|
80
|
+
for (let n of t.read) e.read(n);
|
|
81
|
+
for (let n of t.written) e.write(n);
|
|
82
|
+
let a = r === "cp" ? S(i, t.read, n) : [];
|
|
83
|
+
a.length > 0 && (o = () => {
|
|
84
|
+
for (let t of a) e.write(t);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
} catch {}
|
|
88
|
+
}
|
|
89
|
+
let s = (t) => o === null ? e.apply(this, t) : b((...t) => e.apply(this, t), t, o);
|
|
72
90
|
n.inside = !0;
|
|
73
91
|
try {
|
|
74
|
-
|
|
92
|
+
if (!l.has(t)) return s(i);
|
|
93
|
+
let e = j(i, n), r = n.walking.run(!0, () => s(e));
|
|
94
|
+
return t === "glob" ? O(r, n) : r;
|
|
75
95
|
} finally {
|
|
76
96
|
n.inside = !1;
|
|
77
97
|
}
|
|
78
98
|
}
|
|
79
99
|
return Object.defineProperties(i, Object.getOwnPropertyDescriptors(e)), i;
|
|
80
100
|
}
|
|
81
|
-
function
|
|
101
|
+
function b(e, t, n) {
|
|
102
|
+
function r(e) {
|
|
103
|
+
try {
|
|
104
|
+
n(e);
|
|
105
|
+
} catch {}
|
|
106
|
+
}
|
|
107
|
+
let i = t.at(-1);
|
|
108
|
+
if (typeof i == "function") return e(...t.slice(0, -1), (e, t, ...n) => (e ?? r(t), Reflect.apply(i, void 0, [
|
|
109
|
+
e,
|
|
110
|
+
t,
|
|
111
|
+
...n
|
|
112
|
+
])));
|
|
113
|
+
async function a(e) {
|
|
114
|
+
let t = await e;
|
|
115
|
+
return r(t), t;
|
|
116
|
+
}
|
|
117
|
+
let o = e(...t);
|
|
118
|
+
return o instanceof Promise ? a(o) : (r(o), o);
|
|
119
|
+
}
|
|
120
|
+
function x(e, t, n) {
|
|
82
121
|
let r = [e], i = /* @__PURE__ */ new Set(), a = [e];
|
|
83
122
|
for (; a.length > 0;) {
|
|
84
123
|
let e = a.shift(), o = [];
|
|
@@ -86,7 +125,7 @@ function v(e, t, n) {
|
|
|
86
125
|
i.add(t.original.realpathSync(e)), o = t.original.readdirSync(e, { withFileTypes: !0 });
|
|
87
126
|
} catch {}
|
|
88
127
|
for (let s of o) {
|
|
89
|
-
let o =
|
|
128
|
+
let o = g(e, s.name), c = s.isDirectory();
|
|
90
129
|
if (n && s.isSymbolicLink()) try {
|
|
91
130
|
if (c = t.original.statSync(o).isDirectory(), c && i.has(t.original.realpathSync(o))) {
|
|
92
131
|
r.push(o);
|
|
@@ -98,7 +137,17 @@ function v(e, t, n) {
|
|
|
98
137
|
}
|
|
99
138
|
return r;
|
|
100
139
|
}
|
|
101
|
-
function
|
|
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
|
+
function C(e, t, n) {
|
|
102
151
|
n.push(e);
|
|
103
152
|
let r = [];
|
|
104
153
|
try {
|
|
@@ -109,82 +158,86 @@ function y(e, t, n) {
|
|
|
109
158
|
try {
|
|
110
159
|
i = t.original.readdirSync(e, { withFileTypes: !0 });
|
|
111
160
|
} catch {}
|
|
112
|
-
for (let t of i) if (!
|
|
113
|
-
let i =
|
|
161
|
+
for (let t of i) if (!u.has(t.name)) {
|
|
162
|
+
let i = g(e, t.name);
|
|
114
163
|
n.push(i), t.isDirectory() && r.push(i);
|
|
115
164
|
}
|
|
116
165
|
}
|
|
117
166
|
}
|
|
118
|
-
function
|
|
167
|
+
function w(e, t, n) {
|
|
119
168
|
let r = {
|
|
120
169
|
written: [],
|
|
121
170
|
read: []
|
|
122
|
-
}, i =
|
|
123
|
-
return i === null || (e === "open" && !
|
|
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;
|
|
124
173
|
}
|
|
125
|
-
function
|
|
126
|
-
let r =
|
|
174
|
+
function T(e, t, n) {
|
|
175
|
+
let r = M(t[0]);
|
|
127
176
|
if (r === null || !s.has(e)) return [];
|
|
128
177
|
if (e === "symlink") {
|
|
129
|
-
let e =
|
|
130
|
-
return [e === null || typeof t[0] != "string" ? r :
|
|
178
|
+
let e = M(t[1]);
|
|
179
|
+
return [e === null || typeof t[0] != "string" ? r : m(h(e), t[0])];
|
|
131
180
|
}
|
|
132
181
|
if (e === "cp") {
|
|
133
182
|
let e = [];
|
|
134
|
-
return
|
|
183
|
+
return C(r, n, e), e;
|
|
135
184
|
}
|
|
136
185
|
return [r];
|
|
137
186
|
}
|
|
138
|
-
function
|
|
139
|
-
let n = [], r = [e[0]].flat(), i = e[1], a = typeof i == "object" ?
|
|
140
|
-
for (let e of r) typeof e == "string" && n.push(...
|
|
187
|
+
function E(e, t) {
|
|
188
|
+
let n = [], r = [e[0]].flat(), i = e[1], a = typeof i == "object" ? M(i.cwd) : null;
|
|
189
|
+
for (let e of r) typeof e == "string" && n.push(...x(k(e, a ?? process.cwd()), t, !1));
|
|
141
190
|
return n;
|
|
142
191
|
}
|
|
143
|
-
function
|
|
192
|
+
function D(e, t, n) {
|
|
144
193
|
let r = [], i = o[e];
|
|
145
194
|
for (let a of i) {
|
|
146
|
-
let i =
|
|
195
|
+
let i = M(t[a]);
|
|
147
196
|
if (i !== null) {
|
|
148
|
-
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 = h(i);
|
|
149
198
|
else r.push(i);
|
|
150
199
|
}
|
|
151
200
|
}
|
|
152
201
|
return r;
|
|
153
202
|
}
|
|
154
|
-
function
|
|
203
|
+
function O(e, t) {
|
|
155
204
|
if (e === void 0) return e;
|
|
156
205
|
let n = e, r = {
|
|
157
|
-
return: (e) => t.
|
|
158
|
-
next: () => t.
|
|
206
|
+
return: (e) => t.walking.run(!0, () => n.return(e)),
|
|
207
|
+
next: () => t.walking.run(!0, () => n.next()),
|
|
159
208
|
[Symbol.asyncIterator]: () => r
|
|
160
209
|
};
|
|
161
210
|
return r;
|
|
162
211
|
}
|
|
163
|
-
function
|
|
164
|
-
let n = e.split("/"), r = n.findIndex((e) =>
|
|
165
|
-
if (r === -1) return
|
|
166
|
-
let i =
|
|
167
|
-
for (let e of n.slice(r)) e === ".." && (i =
|
|
212
|
+
function k(e, t) {
|
|
213
|
+
let n = e.split("/"), r = n.findIndex((e) => d.test(e));
|
|
214
|
+
if (r === -1) return m(t, e);
|
|
215
|
+
let i = m(t, n.slice(0, r).join("/"));
|
|
216
|
+
for (let e of n.slice(r)) e === ".." && (i = h(i));
|
|
168
217
|
return i;
|
|
169
218
|
}
|
|
170
|
-
function
|
|
219
|
+
function A(e, t, n) {
|
|
171
220
|
return e === "glob" ? {
|
|
172
|
-
read:
|
|
221
|
+
read: E(t, n),
|
|
173
222
|
written: []
|
|
174
|
-
} : a.has(e) ?
|
|
175
|
-
read:
|
|
176
|
-
written:
|
|
223
|
+
} : a.has(e) ? w(e, t, n) : {
|
|
224
|
+
read: T(e, t, n),
|
|
225
|
+
written: D(e, t, n)
|
|
177
226
|
};
|
|
178
227
|
}
|
|
179
|
-
function
|
|
228
|
+
function j(e, t) {
|
|
229
|
+
let n = e.at(-1);
|
|
230
|
+
return typeof n == "function" ? [...e.slice(0, -1), (...e) => t.walking.exit(() => Reflect.apply(n, void 0, e))] : e;
|
|
231
|
+
}
|
|
232
|
+
function M(e) {
|
|
180
233
|
let t = null;
|
|
181
|
-
return typeof e == "string" ? t = e :
|
|
234
|
+
return typeof e == "string" ? t = e : N(e) ? t = e.protocol === "file:" ? _(e) : null : e instanceof Buffer && (t = e.toString()), t === null ? null : m(t);
|
|
182
235
|
}
|
|
183
|
-
function
|
|
236
|
+
function N(e) {
|
|
184
237
|
let t = e;
|
|
185
238
|
return !!t?.href && !!t?.protocol && t?.auth === void 0 && t?.path === void 0;
|
|
186
239
|
}
|
|
187
|
-
function
|
|
188
|
-
return typeof e == "number" ? (e &
|
|
240
|
+
function P(e) {
|
|
241
|
+
return typeof e == "number" ? (e & f) === 0 : typeof e != "string" || !/[aw]/u.test(e);
|
|
189
242
|
}
|
|
190
|
-
export {
|
|
243
|
+
export { v as trackFileReads };
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { InputTracking } from './types/input-tracking.js';
|
|
2
2
|
import { trackEnvironment } from './track-environment.js';
|
|
3
3
|
/**
|
|
4
|
-
* Starts recording what the code of a test process or worker reads: the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Starts recording what the code of a test process or worker reads: the files
|
|
5
|
+
* and directories read through `node:fs` that count as inputs, inside the
|
|
6
|
+
* project root or outside it (`createInputFilter`), those of them it changed
|
|
7
|
+
* itself, and the environment variables, apart from those the test runner reads
|
|
8
|
+
* on its own.
|
|
8
9
|
*
|
|
9
|
-
* @param
|
|
10
|
+
* @param places - Project root and work directory of the run, which decide what
|
|
11
|
+
* counts.
|
|
12
|
+
* @param places.directory - Work directory of the run.
|
|
13
|
+
* @param places.root - Project root.
|
|
10
14
|
* @param environment - Variables the test runner reads on its own and the
|
|
11
15
|
* holder of its `metaEnv`, if any, as `trackEnvironment` takes them; passed
|
|
12
16
|
* to both of its calls.
|
|
13
17
|
* @returns The files read so far, `process.env` as Node made it, and the
|
|
14
18
|
* function that stops recording and returns what was read.
|
|
15
19
|
*/
|
|
16
|
-
export declare function trackInputs(
|
|
20
|
+
export declare function trackInputs(places: {
|
|
21
|
+
directory: string;
|
|
22
|
+
root: string;
|
|
23
|
+
}, environment: Parameters<typeof trackEnvironment>[0]): InputTracking;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import n from "
|
|
1
|
+
import { createInputFilter as e } from "./create-input-filter.js";
|
|
2
|
+
import { trackEnvironment as t } from "./track-environment.js";
|
|
3
|
+
import { trackFileInputs as n } from "./track-file-inputs.js";
|
|
4
4
|
function r(r, i) {
|
|
5
|
-
let a = /* @__PURE__ */ new Set(), o =
|
|
5
|
+
let a = /* @__PURE__ */ new Set(), o = n(e(r)), s = t(i, (e) => {
|
|
6
6
|
a.add(e);
|
|
7
7
|
});
|
|
8
8
|
return {
|
|
9
9
|
stop: () => {
|
|
10
|
-
let { modified:
|
|
11
|
-
return
|
|
10
|
+
let { modified: e, files: n } = o.stop();
|
|
11
|
+
return t(i, null), {
|
|
12
12
|
environment: [...a].toSorted(),
|
|
13
|
-
modified:
|
|
13
|
+
modified: e,
|
|
14
14
|
files: n
|
|
15
15
|
};
|
|
16
16
|
},
|
|
@@ -11,6 +11,12 @@ export interface FileInputTracking {
|
|
|
11
11
|
*/
|
|
12
12
|
stop(): { modified: string[]; files: string[] }
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Tells whether the code wrote a path itself, by the path it gave or by the
|
|
16
|
+
* real path of its directory, also after `stop`.
|
|
17
|
+
*/
|
|
18
|
+
owns(file: string): boolean
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* Files and directories read so far, a missing one included, that the filter
|
|
16
22
|
* accepted and the code had not written before; the set stays live until
|
|
@@ -13,9 +13,9 @@ export interface InputTracking {
|
|
|
13
13
|
stop(): { environment: string[]; modified: string[]; files: string[] }
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* included, that the code had not
|
|
18
|
-
* `stop`.
|
|
16
|
+
* Files and directories read so far through `node:fs` that count as inputs
|
|
17
|
+
* (`createInputFilter`), a missing one included, that the code had not
|
|
18
|
+
* written before; the set stays live until `stop`.
|
|
19
19
|
*/
|
|
20
20
|
files: ReadonlySet<string>
|
|
21
21
|
|
|
@@ -7,9 +7,10 @@ import { TestProject } from 'vitest/node';
|
|
|
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
9
|
* directory of those files adds the `tsconfig.json` files that may decide how
|
|
10
|
-
* Vite transforms it (`listTsconfigFiles`). Virtual modules
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Vite transforms it (`listTsconfigFiles`). Virtual modules (`isVirtualModule`)
|
|
11
|
+
* are followed but not listed, so the files plugins watch for them are in;
|
|
12
|
+
* files under `node_modules`, which the lockfile stands for, are left out with
|
|
13
|
+
* what they import. The test file itself is always in.
|
|
13
14
|
*
|
|
14
15
|
* @param input - Test file, its project and what its worker reported.
|
|
15
16
|
* @param input.project - Project the test file ran in.
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { listTsconfigFiles as e } from "../shared/list-tsconfig-files.js";
|
|
2
2
|
import { compareCodeUnits as t } from "../../core/compare-code-units.js";
|
|
3
|
-
import {
|
|
4
|
-
import r from "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import { isVirtualModule as n } from "./is-virtual-module.js";
|
|
4
|
+
import { getModuleFile as r } from "./get-module-file.js";
|
|
5
|
+
import i from "node:path";
|
|
6
|
+
async function a(a) {
|
|
7
|
+
let { reported: o, project: s } = a;
|
|
8
|
+
if (o == null) return null;
|
|
9
|
+
let c = /* @__PURE__ */ new Set([a.file]);
|
|
10
|
+
function l(e) {
|
|
11
|
+
let t = r(e);
|
|
12
|
+
return t === null ? n(e) : (c.add(t), !0);
|
|
12
13
|
}
|
|
13
|
-
let
|
|
14
|
-
async function
|
|
14
|
+
let u = Object.values(s.vite.environments), d = /* @__PURE__ */ new Set();
|
|
15
|
+
async function f(e, t) {
|
|
15
16
|
if (e.transformResult === null) try {
|
|
16
17
|
await t.transformRequest(e.url);
|
|
17
18
|
} catch {}
|
|
18
|
-
let n = [...e.importedModules].filter((e) => !
|
|
19
|
-
for (let e of n)
|
|
20
|
-
await Promise.all(n.map((e) =>
|
|
19
|
+
let n = [...e.importedModules].filter((e) => !d.has(e) && l(e.file ?? e.id ?? ""));
|
|
20
|
+
for (let e of n) d.add(e);
|
|
21
|
+
await Promise.all(n.map((e) => f(e, t)));
|
|
21
22
|
}
|
|
22
|
-
let
|
|
23
|
-
for (let e of
|
|
23
|
+
let p = [];
|
|
24
|
+
for (let e of o) if (l(e)) for (let t of u) {
|
|
24
25
|
let n = t.moduleGraph.getModuleById(e);
|
|
25
26
|
if (n !== void 0) {
|
|
26
|
-
|
|
27
|
+
d.has(n) || (d.add(n), p.push(f(n, t)));
|
|
27
28
|
break;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
await Promise.all(
|
|
31
|
-
let
|
|
32
|
-
for (let t of
|
|
33
|
-
let n = e(t,
|
|
34
|
-
for (let e of n)
|
|
31
|
+
await Promise.all(p);
|
|
32
|
+
let m = new Set([...c].map(i.dirname));
|
|
33
|
+
for (let t of m) {
|
|
34
|
+
let n = e(t, a.tsconfigs);
|
|
35
|
+
for (let e of n) c.add(e);
|
|
35
36
|
}
|
|
36
|
-
return [...
|
|
37
|
+
return [...c].toSorted(t);
|
|
37
38
|
}
|
|
38
|
-
export {
|
|
39
|
+
export { a as collectDependencies };
|
|
@@ -23,7 +23,7 @@ function c(e, r) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
function l(t, n) {
|
|
26
|
-
let { config: r } = t;
|
|
26
|
+
let { config: r } = t, i = t.vitest.state.onUnhandledError;
|
|
27
27
|
return {
|
|
28
28
|
values: a([
|
|
29
29
|
t.vite.config.define ?? null,
|
|
@@ -38,6 +38,8 @@ function l(t, n) {
|
|
|
38
38
|
hooks: r.sequence.hooks
|
|
39
39
|
},
|
|
40
40
|
variables: Object.entries(n).filter(([t]) => e.test(t)),
|
|
41
|
+
dangerouslyIgnoreUnhandledErrors: t.globalConfig.dangerouslyIgnoreUnhandledErrors,
|
|
42
|
+
onUnhandledError: i ? String(i) : null,
|
|
41
43
|
environmentOptions: r.environmentOptions,
|
|
42
44
|
update: r.snapshotOptions.updateSnapshot,
|
|
43
45
|
maxConcurrency: r.maxConcurrency,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells whether a Vite module id names a virtual module, which a plugin makes
|
|
3
|
+
* up instead of loading a file, such as `\0virtual:limits` or `virtual:limits`:
|
|
4
|
+
* an id that, without its query or hash, is neither empty, nor an absolute
|
|
5
|
+
* path, nor a Node built-in, nor under `node_modules`, which the lockfile
|
|
6
|
+
* stands for.
|
|
7
|
+
*
|
|
8
|
+
* @param id - Module id, as a worker reports it or Vite's module graph has it.
|
|
9
|
+
* @returns Whether the id names a virtual module.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isVirtualModule(id: string): boolean;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { Vitest } from 'vitest/node';
|
|
2
|
+
import { StrayDecisions } from './types/stray-decisions.js';
|
|
1
3
|
import { VitestOutRecord } from './types/vitest-worker.js';
|
|
2
4
|
/**
|
|
3
|
-
* Reads the records workers wrote in a run (`
|
|
5
|
+
* Reads the records workers wrote in a run (`readOutRecords`).
|
|
4
6
|
*
|
|
7
|
+
* @param vitest - Vitest instance of the session.
|
|
5
8
|
* @param directory - Work directory of the session.
|
|
9
|
+
* @param decisions - Decisions of the unhandled errors of the run, which
|
|
10
|
+
* receives the new ones.
|
|
6
11
|
* @returns Records of each out file in the order they were written, by file
|
|
7
12
|
* name without the extension (`<hash>-<n>`).
|
|
8
13
|
*/
|
|
9
|
-
export declare function readOutFiles(directory: string): Map<string, VitestOutRecord[]>;
|
|
14
|
+
export declare function readOutFiles(vitest: Vitest, directory: string, decisions: StrayDecisions): Map<string, VitestOutRecord[]>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readOutRecords as e } from "./read-out-records.js";
|
|
2
2
|
import { readdirSync as t } from "node:fs";
|
|
3
3
|
import n from "node:path";
|
|
4
|
-
function r(r) {
|
|
5
|
-
let
|
|
6
|
-
for (let
|
|
7
|
-
return
|
|
4
|
+
function r(r, i, a) {
|
|
5
|
+
let o = n.join(i, "out"), s = /* @__PURE__ */ new Map();
|
|
6
|
+
for (let i of t(o).toSorted()) s.set(n.basename(i, ".jsonl"), e(r, n.join(o, i), a));
|
|
7
|
+
return s;
|
|
8
8
|
}
|
|
9
9
|
export { r as readOutFiles };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vitest } from 'vitest/node';
|
|
2
|
+
import { VitestOutRecord } from './types/vitest-worker.js';
|
|
3
|
+
import { StrayDecisions } from './types/stray-decisions.js';
|
|
4
|
+
/**
|
|
5
|
+
* Reads the records a worker wrote in one out file (`readOutFile`), with the
|
|
6
|
+
* first lines of only those unhandled errors that count (`readStrays`); a late
|
|
7
|
+
* error that does not count leaves no record. An end record tells whether
|
|
8
|
+
* `onUnhandledError` of the root configuration decided an unhandled error of
|
|
9
|
+
* the file.
|
|
10
|
+
*
|
|
11
|
+
* @param vitest - Vitest instance of the session.
|
|
12
|
+
* @param file - Absolute path of the out file.
|
|
13
|
+
* @param decisions - Decisions of the unhandled errors of the run, which
|
|
14
|
+
* receives those of this file.
|
|
15
|
+
* @returns Records in the order they were written.
|
|
16
|
+
*/
|
|
17
|
+
export declare function readOutRecords(vitest: Vitest, file: string, decisions: StrayDecisions): VitestOutRecord[];
|