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
|
@@ -11,138 +11,173 @@ async function o(e, t) {
|
|
|
11
11
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
12
12
|
if (t.switched.length === 0) return {
|
|
13
13
|
unrepeatableFiles: /* @__PURE__ */ new Set(),
|
|
14
|
-
dry:
|
|
14
|
+
dry: S(),
|
|
15
15
|
diagnostics: r,
|
|
16
16
|
runs: 0,
|
|
17
17
|
errors: n
|
|
18
18
|
};
|
|
19
|
-
let i = t.switched.map((e) => e.file);
|
|
20
19
|
t.report({
|
|
21
|
-
files:
|
|
20
|
+
files: t.switched.length,
|
|
22
21
|
kind: "dry-start"
|
|
23
22
|
});
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
let i = await s(e, t, {
|
|
24
|
+
related: t.related,
|
|
25
|
+
diagnostics: r
|
|
26
|
+
}), a = [i.dry], o = b(i.dry);
|
|
27
|
+
if (o.failing.length > 0 || o.unloaded.length > 0) {
|
|
28
|
+
let s = await l(e, t, {
|
|
29
|
+
files: i.dry.files,
|
|
30
|
+
tests: i.dry.tests,
|
|
27
31
|
diagnostics: r,
|
|
28
|
-
failures:
|
|
29
|
-
related: i,
|
|
32
|
+
failures: o,
|
|
30
33
|
errors: n
|
|
31
34
|
});
|
|
32
|
-
|
|
35
|
+
a.push(s.dry), i = {
|
|
33
36
|
...s,
|
|
34
|
-
runs:
|
|
37
|
+
runs: i.runs + s.runs
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
|
-
return
|
|
38
|
-
instrumented:
|
|
40
|
+
return d(t, {
|
|
41
|
+
instrumented: a,
|
|
39
42
|
diagnostics: r,
|
|
40
43
|
errors: n
|
|
41
44
|
}), {
|
|
42
|
-
...
|
|
45
|
+
...i,
|
|
43
46
|
diagnostics: r,
|
|
44
47
|
errors: n
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
50
|
async function s(t, r, a) {
|
|
48
|
-
let o = await
|
|
49
|
-
repeat:
|
|
51
|
+
let { diagnostics: o, related: s } = a, c = await p(t, {
|
|
52
|
+
repeat: r.repeat,
|
|
50
53
|
instrumented: !0,
|
|
51
54
|
files: null,
|
|
52
|
-
related:
|
|
53
|
-
},
|
|
54
|
-
if (
|
|
55
|
+
related: s
|
|
56
|
+
}, r.root), { unloaded: l, failing: u } = b(c);
|
|
57
|
+
if (u.length === 0 && l.length === 0) return {
|
|
55
58
|
unrepeatableFiles: /* @__PURE__ */ new Set(),
|
|
56
59
|
runs: 1,
|
|
57
|
-
dry:
|
|
60
|
+
dry: c
|
|
58
61
|
};
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
message: `${i(
|
|
62
|
+
let d = v([...u, ...l]), f = d.length === 1 ? "it" : "them";
|
|
63
|
+
r.report({
|
|
64
|
+
message: r.repeat ? `${i(d.length, "test file")} failed with each test run twice; running ${f} again with each test once.` : `${i(d.length, "test file")} failed; running ${f} again to see whether the failures repeat.`,
|
|
62
65
|
kind: "dry-again"
|
|
63
66
|
});
|
|
64
|
-
let
|
|
67
|
+
let h = await p(t, {
|
|
65
68
|
instrumented: !0,
|
|
66
69
|
repeat: !1,
|
|
67
|
-
related:
|
|
68
|
-
files:
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
related: s,
|
|
71
|
+
files: d
|
|
72
|
+
}, r.root), g = new Set(d.map((e) => n(e))), { unloaded: _, failing: y } = b(h), x = new Set([...y, ..._].map((e) => n(e))), S = new Set([...g].filter((e) => !x.has(e)));
|
|
73
|
+
if (!r.repeat) {
|
|
74
|
+
let e = [...l, ...u].filter((e) => S.has(n(e))).map((e) => m(e, r.root));
|
|
75
|
+
for (let t of e) o.some((e) => e.message === t.message && e.file === t.file && e.line === t.line) || o.push(t);
|
|
76
|
+
}
|
|
77
|
+
function w(e) {
|
|
78
|
+
return g.has(n(e));
|
|
72
79
|
}
|
|
73
80
|
return {
|
|
74
81
|
dry: {
|
|
75
|
-
tests: [...
|
|
76
|
-
files: [...
|
|
77
|
-
mismatched:
|
|
78
|
-
outside:
|
|
79
|
-
served:
|
|
80
|
-
...(
|
|
82
|
+
tests: [...c.tests.filter((e) => !w(e)), ...h.tests].toSorted(e),
|
|
83
|
+
files: [...c.files.filter((e) => !w(e)), ...h.files].toSorted(e),
|
|
84
|
+
mismatched: C(c.mismatched, h.mismatched),
|
|
85
|
+
outside: C(c.outside, h.outside),
|
|
86
|
+
served: C(c.served, h.served),
|
|
87
|
+
...(c.unserved ?? h.unserved) !== void 0 && { unserved: [...c.unserved ?? [], ...h.unserved ?? []] },
|
|
81
88
|
hung: []
|
|
82
89
|
},
|
|
83
|
-
unrepeatableFiles: new Set(
|
|
90
|
+
unrepeatableFiles: r.repeat ? S : /* @__PURE__ */ new Set(),
|
|
84
91
|
runs: 2
|
|
85
92
|
};
|
|
86
93
|
}
|
|
87
|
-
|
|
94
|
+
function c(e, t) {
|
|
95
|
+
let { failures: r, files: i } = t, a = e.switched.map((e) => e.file), o = new Set(a), s = new Map(i.map((e) => [n(e), (e.dependencies ?? []).filter((e) => o.has(e))])), c = /* @__PURE__ */ new Map();
|
|
96
|
+
function l(e, t, n) {
|
|
97
|
+
for (let r of n) c.has(r) || c.set(r, {
|
|
98
|
+
failure: e,
|
|
99
|
+
link: t
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
for (let t of r.unloaded) {
|
|
103
|
+
let r = t.covers.map((t) => e.mutantFiles.get(t)), i = s.get(n(t));
|
|
104
|
+
i.length > 0 ? l(t, "dependency", [...r, ...i]) : l(t, "sites", r);
|
|
105
|
+
}
|
|
106
|
+
for (let t of r.failing) {
|
|
107
|
+
let r = (t.tries[0].covers ?? []).map((t) => e.mutantFiles.get(t));
|
|
108
|
+
r.length > 0 ? l(t, "sites", r) : l(t, "dependency", s.get(n(t)) ?? []);
|
|
109
|
+
}
|
|
110
|
+
if (c.size === 0) {
|
|
111
|
+
let [e] = [...r.unloaded, ...r.failing];
|
|
112
|
+
return new Map(a.map((t) => [t, {
|
|
113
|
+
failure: e,
|
|
114
|
+
link: "unknown"
|
|
115
|
+
}]));
|
|
116
|
+
}
|
|
117
|
+
return new Map(a.filter((e) => c.has(e)).map((e) => [e, c.get(e)]));
|
|
118
|
+
}
|
|
119
|
+
async function l(e, t, n) {
|
|
88
120
|
await u(e, t, n);
|
|
89
|
-
let r =
|
|
90
|
-
for (let e of r) {
|
|
91
|
-
let r = t.displays.get(e),
|
|
92
|
-
n.errors.set(r,
|
|
121
|
+
let r = c(t, n);
|
|
122
|
+
for (let [e, i] of r) {
|
|
123
|
+
let r = t.displays.get(e), a = h(i, r, t.root);
|
|
124
|
+
n.errors.set(r, a), n.diagnostics.push(g("instrumentation-break", r, a));
|
|
93
125
|
}
|
|
94
126
|
let a = t.switched.filter((e) => !r.has(e.file));
|
|
95
127
|
if (t.switched.splice(0, t.switched.length, ...a), a.length === 0) return {
|
|
96
128
|
unrepeatableFiles: /* @__PURE__ */ new Set(),
|
|
97
|
-
dry:
|
|
129
|
+
dry: S(),
|
|
98
130
|
runs: 1
|
|
99
131
|
};
|
|
100
132
|
t.report({
|
|
101
133
|
message: `Running the dry run again without ${i(r.size, "file")} that broke tests.`,
|
|
102
134
|
kind: "dry-again"
|
|
103
135
|
});
|
|
104
|
-
let o = await s(e,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
136
|
+
let o = await s(e, t, {
|
|
137
|
+
related: t.related.filter((e) => !r.has(e)),
|
|
138
|
+
diagnostics: n.diagnostics
|
|
139
|
+
}), l = b(o.dry);
|
|
140
|
+
if (l.failing.length > 0 || l.unloaded.length > 0) throw y(t, [...l.failing, ...l.unloaded]), Error(f("Tests still fail with mootant's switched files after the files that broke them were dropped", {
|
|
141
|
+
files: l.unloaded,
|
|
142
|
+
tests: l.failing
|
|
108
143
|
}, t.root));
|
|
109
144
|
return {
|
|
110
145
|
...o,
|
|
111
146
|
runs: o.runs + 1
|
|
112
147
|
};
|
|
113
148
|
}
|
|
114
|
-
function
|
|
115
|
-
let
|
|
116
|
-
for (let { file: a } of e.switched) {
|
|
117
|
-
let o = e.displays.get(a);
|
|
118
|
-
if (n.has(a)) {
|
|
119
|
-
let e = `The test runner loaded ${o} with a text that differs from the listed one; its mutants are not run.`;
|
|
120
|
-
t.errors.set(o, e), t.diagnostics.push(m("instrument-error", o, e));
|
|
121
|
-
} else r.has(a) || t.diagnostics.push(m("never-served", o, `No test loaded ${o} through the test runner's transform: ${i.get(a) ?? "no test imports it, or tests import a built copy, an external or a pre-bundled dependency"}.`));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
async function u(e, t, n) {
|
|
125
|
-
let { failures: r, related: i } = n, { unloaded: a, failing: o } = r, s = new Set(o.map((e) => e.id)), c = new Set(a.map((e) => e.file));
|
|
149
|
+
async function u(e, t, r) {
|
|
150
|
+
let { failures: i, tests: a } = r, { unloaded: o, failing: s } = i, c = new Set(s.map((e) => e.id)), l = new Set(a.map((e) => e.id)), u = new Set(o.map((e) => n(e))), d = new Set([...o, ...s].map((e) => n(e)));
|
|
126
151
|
t.report({
|
|
127
152
|
message: "Some tests failed; running them again without mutants to check.",
|
|
128
153
|
kind: "dry-again"
|
|
129
154
|
});
|
|
130
|
-
let
|
|
131
|
-
files:
|
|
155
|
+
let m = b(await p(e, {
|
|
156
|
+
files: v([...s, ...o]),
|
|
157
|
+
related: t.related,
|
|
132
158
|
instrumented: !1,
|
|
133
|
-
repeat: !1
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
tests: u
|
|
159
|
+
repeat: !1
|
|
160
|
+
}, t.root)), h = m.failing.filter((e) => c.has(e.id) || !l.has(e.id) && u.has(n(e))), g = m.unloaded.filter((e) => d.has(n(e)));
|
|
161
|
+
if (h.length > 0 || g.length > 0) throw y(t, [...h, ...g]), Error(f("Tests fail without mutants; fix them first", {
|
|
162
|
+
files: g,
|
|
163
|
+
tests: h
|
|
139
164
|
}, t.root));
|
|
140
165
|
}
|
|
141
|
-
function d(e, t
|
|
166
|
+
function d(e, t) {
|
|
167
|
+
let n = new Set(t.instrumented.flatMap((e) => e.mismatched)), r = new Set(t.instrumented.flatMap((e) => e.served)), i = new Map(t.instrumented.flatMap((e) => e.unserved ?? []).map((e) => [e.file, e.reason]));
|
|
168
|
+
for (let { file: a } of e.switched) {
|
|
169
|
+
let o = e.displays.get(a);
|
|
170
|
+
if (n.has(a)) {
|
|
171
|
+
let e = `The test runner loaded ${o} with a text that differs from the listed one; its mutants are not run.`;
|
|
172
|
+
t.errors.set(o, e), t.diagnostics.push(g("instrument-error", o, e));
|
|
173
|
+
} else r.has(a) || t.diagnostics.push(g("never-served", o, `No test loaded ${o} through the test runner's transform: ${i.get(a) ?? "no test imports it, or tests import a built copy, an external or a pre-bundled dependency"}.`));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function f(e, t, n) {
|
|
142
177
|
let { files: a, tests: o } = t, s = [...a.map((e) => ` ${r(e.file, n)}: fails to load: ${e.errors[0] ?? "unknown error"}`), ...o.map((e) => ` ${r(e.file, n)} > ${e.name}: ${e.tries[0].message ?? "failed"}`)], c = `${e} (${[o.length > 0 && i(o.length, "test"), a.length > 0 && i(a.length, "test file")].filter(Boolean).join(", ")}):\n${s.slice(0, 10).join("\n")}`;
|
|
143
178
|
return s.length > 10 && (c += `\n and ${s.length - 10} more`), s.some((e) => /snapshot/iu.test(e)) && (c += "\nSnapshots may be missing or obsolete: mootant never writes or removes them, so update them with the test runner first."), c;
|
|
144
179
|
}
|
|
145
|
-
async function
|
|
180
|
+
async function p(e, t, n) {
|
|
146
181
|
let i = await e.dryRun({
|
|
147
182
|
...t,
|
|
148
183
|
timeouts: a
|
|
@@ -153,13 +188,20 @@ async function f(e, t, n) {
|
|
|
153
188
|
}
|
|
154
189
|
return i;
|
|
155
190
|
}
|
|
156
|
-
function
|
|
157
|
-
let
|
|
158
|
-
return
|
|
191
|
+
function m(e, t) {
|
|
192
|
+
let n = r(e.file, t);
|
|
193
|
+
return "tries" in e ? {
|
|
194
|
+
...g("unrepeatable-test", n, `"${e.name}" failed${x(e.tries[0].message)} in a run without mutants and passed when run again; it may be flaky and kill mutants by chance.`),
|
|
195
|
+
line: e.line
|
|
196
|
+
} : g("unrepeatable-test", n, `${n} failed outside its tests${x(e.errors[0])} in a run without mutants and passed when run again; its tests may be flaky and kill mutants by chance.`);
|
|
197
|
+
}
|
|
198
|
+
function h(e, t, n) {
|
|
199
|
+
let r = _(e.failure, n);
|
|
200
|
+
return e.link === "sites" ? `Tests that reach mutant sites of ${t} fail only with mootant's switched files, such as ${r}; its mutants are not run.` : e.link === "dependency" ? `Tests that depend on ${t} fail only with mootant's switched files, such as ${r}; its mutants are not run.` : `Tests fail only with mootant's switched files, such as ${r}, and mootant cannot tell which switched file breaks them; the mutants of every switched file are not run.`;
|
|
159
201
|
}
|
|
160
|
-
function
|
|
202
|
+
function g(e, t, n) {
|
|
161
203
|
return {
|
|
162
|
-
severity: e === "never-served" ? "warning" : "error",
|
|
204
|
+
severity: e === "never-served" || e === "unrepeatable-test" ? "warning" : "error",
|
|
163
205
|
column: null,
|
|
164
206
|
line: null,
|
|
165
207
|
message: n,
|
|
@@ -167,7 +209,11 @@ function m(e, t, n) {
|
|
|
167
209
|
code: e
|
|
168
210
|
};
|
|
169
211
|
}
|
|
170
|
-
function
|
|
212
|
+
function _(e, t) {
|
|
213
|
+
let n = r(e.file, t);
|
|
214
|
+
return "tries" in e ? `"${e.name}" in ${n}${x(e.tries[0].message)}` : `${n}, which fails outside its tests${x(e.errors[0])}`;
|
|
215
|
+
}
|
|
216
|
+
function v(e) {
|
|
171
217
|
return [...new Map(e.map(({ project: e, file: t }) => [n({
|
|
172
218
|
project: e,
|
|
173
219
|
file: t
|
|
@@ -176,19 +222,23 @@ function h(e) {
|
|
|
176
222
|
file: t
|
|
177
223
|
}])).values()];
|
|
178
224
|
}
|
|
179
|
-
function
|
|
225
|
+
function y(e, n) {
|
|
180
226
|
e.report({
|
|
181
227
|
files: [...new Set(n.map(({ file: t }) => r(t, e.root)))].toSorted(t),
|
|
182
228
|
kind: "dry-failed"
|
|
183
229
|
});
|
|
184
230
|
}
|
|
185
|
-
function
|
|
231
|
+
function b(e) {
|
|
186
232
|
return {
|
|
187
233
|
failing: e.tests.filter((e) => e.tries[0].failed),
|
|
188
234
|
unloaded: e.files.filter((e) => e.loadFailed)
|
|
189
235
|
};
|
|
190
236
|
}
|
|
191
|
-
function
|
|
237
|
+
function x(e) {
|
|
238
|
+
let t = e?.replace(/\.$/u, "") ?? "";
|
|
239
|
+
return t === "" ? "" : ` (${t})`;
|
|
240
|
+
}
|
|
241
|
+
function S() {
|
|
192
242
|
return {
|
|
193
243
|
mismatched: [],
|
|
194
244
|
outside: [],
|
|
@@ -198,7 +248,7 @@ function v() {
|
|
|
198
248
|
hung: []
|
|
199
249
|
};
|
|
200
250
|
}
|
|
201
|
-
function
|
|
251
|
+
function C(e, n) {
|
|
202
252
|
return [.../* @__PURE__ */ new Set([...e, ...n])].toSorted(t);
|
|
203
253
|
}
|
|
204
254
|
export { o as runDryPhase };
|
|
@@ -14,11 +14,12 @@ import { AdapterSession } from '../../types/adapter/adapter-session.js';
|
|
|
14
14
|
* confirmation takes no new files until the confirmation decides it. The
|
|
15
15
|
* verdict comes from the first file with evidence (`decideEvidence`), so it
|
|
16
16
|
* does not depend on the batches or the workers. A round also runs the retries
|
|
17
|
-
* and confirmations of the round before. A request lives at most
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* and confirmations of the round before. A request lives at most six rounds, as
|
|
18
|
+
* a unit missing twice gets an `Error` verdict and a timeout is confirmed once,
|
|
19
|
+
* or twice when the confirmation of a timer goes over the hit limit, so the
|
|
20
|
+
* rounds end. While a round runs, its units count in the live verdict counts as
|
|
21
|
+
* they end (`previewIsolatedUnit`), and every mutant is counted again once its
|
|
22
|
+
* result is recorded (`countVerdicts`).
|
|
22
23
|
*
|
|
23
24
|
* @param session - Live test runner.
|
|
24
25
|
* @param state - State of the run, updated in place.
|
|
@@ -56,7 +56,8 @@ interface RunMutantsOptions {
|
|
|
56
56
|
cache?: boolean;
|
|
57
57
|
/**
|
|
58
58
|
* Git revision given with `--since`: only mutants on lines changed since its
|
|
59
|
-
* merge base with `HEAD` run
|
|
59
|
+
* merge base with `HEAD` run, and the mutants that skipped candidates on
|
|
60
|
+
* those lines are left to.
|
|
60
61
|
*/
|
|
61
62
|
since?: string;
|
|
62
63
|
/**
|
|
@@ -77,26 +78,30 @@ interface RunMutantsOptions {
|
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
80
|
* Runs the mutants of the given paths against the project's tests: lists the
|
|
80
|
-
* mutants, starts the test runner through its adapter,
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
81
|
+
* mutants, starts the test runner through its adapter, hosts the mutants of
|
|
82
|
+
* every file of the paths, checking that switched Svelte and Vue components
|
|
83
|
+
* compile, switches the files of the selected mutants, runs the related tests
|
|
84
|
+
* without a mutant, then decides every covered mutant on the isolated path,
|
|
85
|
+
* where each mutant gets a fresh module graph and its whole covering test
|
|
86
|
+
* files. In fast mode, runtime mutants first take the batch path, where one
|
|
87
|
+
* test run tries many mutants and kills are accepted as heuristic verdicts; its
|
|
88
|
+
* survivors and doubtful tries still run isolated. An adapter without batch
|
|
89
|
+
* mode runs fast mode as the default mode, with a note. Mutants the test runner
|
|
90
|
+
* ran outside its workers end with `Error` unless a test killed them. Unless
|
|
91
|
+
* the cache is off, valid verdicts of earlier runs are reused before anything
|
|
92
|
+
* runs, in incremental mode also those whose mutant kept its region, with a
|
|
93
|
+
* warning that counts the mutants whose cached evidence only their region
|
|
94
|
+
* matched, and the evidence of the run is saved after it, unless it has error
|
|
95
|
+
* diagnostics. With `--since`, only the mutants on lines changed since the
|
|
96
|
+
* merge base of the revision and `HEAD` run, with the mutants that skipped
|
|
97
|
+
* candidates on those lines are left to (see `selectChangedMutants`), and when
|
|
98
|
+
* there are none the test runner does not start. With `--since` or `--mutant`,
|
|
99
|
+
* the dry run still relates tests to the same files as a run of every mutant,
|
|
100
|
+
* not only to the files of the mutants that run. A run that writes an HTML
|
|
101
|
+
* report also lists the candidates its mutators skipped. The adapter is closed
|
|
102
|
+
* and the work directory removed whatever happens; what the adapter tells of
|
|
103
|
+
* its close, such as a global teardown that failed, joins the diagnostics of a
|
|
104
|
+
* run that went through, after its cache was saved.
|
|
100
105
|
*
|
|
101
106
|
* @param options - Paths, configuration, adapters and run settings.
|
|
102
107
|
* @returns Verdicts, diagnostics and timings, before they are formatted.
|