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.
Files changed (244) hide show
  1. package/dist/adapters/jest/build-dry-file.d.ts +12 -12
  2. package/dist/adapters/jest/collect-jest-dependencies.d.ts +8 -7
  3. package/dist/adapters/jest/runner.d.ts +1 -1
  4. package/dist/adapters/jest/runner.js +1 -1
  5. package/dist/adapters/jest/types/jest-record.d.ts +4 -4
  6. package/dist/adapters/jest/types/unit-worker.d.ts +16 -8
  7. package/dist/adapters/jest/types/worker-session.d.ts +6 -7
  8. package/dist/adapters/jest/worker/boot-worker.d.ts +4 -3
  9. package/dist/adapters/jest/worker/run-unit.d.ts +20 -18
  10. package/dist/adapters/jest/worker/vm-setup.js +1 -1
  11. package/dist/adapters/jest/worker/worker.js +1 -1
  12. package/dist/adapters/jest/write-worker-session.d.ts +1 -2
  13. package/dist/adapters/jest/write-worker-session.js +2 -2
  14. package/dist/adapters/node-test/collect-node-dependencies.d.ts +5 -5
  15. package/dist/adapters/node-test/preload/preload.js +4 -1
  16. package/dist/adapters/node-test/run-test-file.js +1 -0
  17. package/dist/adapters/node-test/types/node-test-record.d.ts +3 -3
  18. package/dist/adapters/node-test/types/node-test-unit.d.ts +6 -1
  19. package/dist/adapters/shared/create-input-filter.d.ts +26 -0
  20. package/dist/adapters/shared/create-input-filter.js +32 -0
  21. package/dist/adapters/shared/track-file-inputs.d.ts +7 -3
  22. package/dist/adapters/shared/track-file-inputs.js +16 -7
  23. package/dist/adapters/shared/track-file-reads.d.ts +12 -8
  24. package/dist/adapters/shared/track-file-reads.js +110 -57
  25. package/dist/adapters/shared/track-inputs.d.ts +13 -6
  26. package/dist/adapters/shared/track-inputs.js +7 -7
  27. package/dist/adapters/shared/types/file-input-tracking.d.ts +6 -0
  28. package/dist/adapters/shared/types/input-tracking.d.ts +3 -3
  29. package/dist/adapters/vitest/collect-dependencies.d.ts +4 -3
  30. package/dist/adapters/vitest/collect-dependencies.js +25 -24
  31. package/dist/adapters/vitest/get-cache-inputs.js +3 -1
  32. package/dist/adapters/vitest/is-virtual-module.d.ts +11 -0
  33. package/dist/adapters/vitest/is-virtual-module.js +8 -0
  34. package/dist/adapters/vitest/read-out-files.d.ts +7 -2
  35. package/dist/adapters/vitest/read-out-files.js +5 -5
  36. package/dist/adapters/vitest/read-out-records.d.ts +17 -0
  37. package/dist/adapters/vitest/read-out-records.js +27 -0
  38. package/dist/adapters/vitest/read-strays.d.ts +20 -0
  39. package/dist/adapters/vitest/read-strays.js +53 -0
  40. package/dist/adapters/vitest/read-unit-inputs.d.ts +7 -1
  41. package/dist/adapters/vitest/read-unit-inputs.js +1 -1
  42. package/dist/adapters/vitest/run-dry.js +16 -16
  43. package/dist/adapters/vitest/run-plan.d.ts +3 -1
  44. package/dist/adapters/vitest/run-plan.js +15 -15
  45. package/dist/adapters/vitest/run-specifications.d.ts +3 -2
  46. package/dist/adapters/vitest/runner.d.ts +38 -23
  47. package/dist/adapters/vitest/runner.js +84 -85
  48. package/dist/adapters/vitest/types/stray-decisions.d.ts +8 -0
  49. package/dist/adapters/vitest/types/unit-outcome.d.ts +2 -1
  50. package/dist/adapters/vitest/types/vitest-worker.d.ts +83 -12
  51. package/dist/adapters/vitest/worker/encode-stray.d.ts +16 -0
  52. package/dist/adapters/vitest/worker/encode-stray.js +16 -0
  53. package/dist/adapters/vitest/worker/intercept-strays.d.ts +26 -0
  54. package/dist/adapters/vitest/worker/intercept-strays.js +13 -0
  55. package/dist/adapters/vitest/worker/read-try-facts.d.ts +5 -4
  56. package/dist/adapters/vitest/worker/write-out-record.d.ts +2 -2
  57. package/dist/cli/html/build-html-report.js +1 -1
  58. package/dist/cli/html/client/main.js +1 -1
  59. package/dist/cli/html/client/render-change.d.ts +3 -2
  60. package/dist/cli/html/client/render-code.d.ts +1 -1
  61. package/dist/cli/html/pack-replacement.d.ts +1 -1
  62. package/dist/cli/parse-arguments.js +1 -1
  63. package/dist/cli/report/build-list-report.js +1 -1
  64. package/dist/cli/report/build-run-report.js +1 -1
  65. package/dist/cli/report/format-file-groups.d.ts +1 -1
  66. package/dist/cli/run-mutation.js +31 -31
  67. package/dist/cli/terminal/create-spinner.d.ts +1 -1
  68. package/dist/cli/terminal/get-text-style.js +4 -4
  69. package/dist/core/cache/get-environment-key.js +2 -2
  70. package/dist/core/cache/hash-files.d.ts +7 -3
  71. package/dist/core/cache/hash-files.js +16 -17
  72. package/dist/core/cache/prepare-run-cache.d.ts +29 -7
  73. package/dist/core/cache/prepare-run-cache.js +96 -62
  74. package/dist/core/cache/save-run-cache.d.ts +8 -7
  75. package/dist/core/cache/save-run-cache.js +2 -1
  76. package/dist/core/cache/unknown-hash.d.ts +7 -0
  77. package/dist/core/cache/unknown-hash.js +2 -0
  78. package/dist/core/files/select-changed-mutants.d.ts +11 -6
  79. package/dist/core/files/select-changed-mutants.js +38 -13
  80. package/dist/core/generate/apply-solitary-rule.d.ts +8 -5
  81. package/dist/core/generate/apply-solitary-rule.js +36 -29
  82. package/dist/core/generate/collect-candidates.d.ts +18 -4
  83. package/dist/core/generate/collect-candidates.js +168 -86
  84. package/dist/core/generate/compare-targets.d.ts +14 -0
  85. package/dist/core/generate/compare-targets.js +6 -0
  86. package/dist/core/generate/deduplicate-candidates.d.ts +6 -4
  87. package/dist/core/generate/deduplicate-candidates.js +11 -9
  88. package/dist/core/generate/find-list-removal.d.ts +20 -0
  89. package/dist/core/generate/find-list-removal.js +26 -0
  90. package/dist/core/generate/generate-file-mutants.js +47 -46
  91. package/dist/core/generate/get-mutant-site.d.ts +18 -0
  92. package/dist/core/generate/get-mutant-site.js +4 -0
  93. package/dist/core/generate/get-target.d.ts +14 -0
  94. package/dist/core/generate/get-target.js +4 -0
  95. package/dist/core/generate/pick-host.d.ts +10 -0
  96. package/dist/core/generate/pick-host.js +16 -0
  97. package/dist/core/generate/validate-replacement.d.ts +15 -4
  98. package/dist/core/generate/validate-replacement.js +28 -13
  99. package/dist/core/ignore/find-ignore-rule.d.ts +8 -7
  100. package/dist/core/instrument/find-attribute-values.d.ts +12 -0
  101. package/dist/core/instrument/find-attribute-values.js +13 -0
  102. package/dist/core/instrument/get-site-syntax.d.ts +14 -0
  103. package/dist/core/instrument/get-site-syntax.js +12 -0
  104. package/dist/core/instrument/group-mutant-ranges.d.ts +7 -3
  105. package/dist/core/instrument/group-mutant-ranges.js +25 -19
  106. package/dist/core/instrument/instrument-file.d.ts +5 -3
  107. package/dist/core/instrument/instrument-file.js +10 -9
  108. package/dist/core/instrument/instrumenter-version.d.ts +1 -1
  109. package/dist/core/instrument/render-branch.d.ts +17 -0
  110. package/dist/core/instrument/render-branch.js +81 -0
  111. package/dist/core/instrument/render-mutant-range.d.ts +17 -6
  112. package/dist/core/instrument/render-mutant-range.js +39 -13
  113. package/dist/core/list-mutants.d.ts +7 -5
  114. package/dist/core/list-mutants.js +2 -2
  115. package/dist/core/mutators/array-element.d.ts +7 -6
  116. package/dist/core/mutators/array-element.js +13 -13
  117. package/dist/core/mutators/assignment-operator.js +34 -33
  118. package/dist/core/mutators/boolean-literal.d.ts +3 -2
  119. package/dist/core/mutators/number-literal.d.ts +1 -1
  120. package/dist/core/mutators/object-property.d.ts +4 -3
  121. package/dist/core/mutators/object-property.js +7 -8
  122. package/dist/core/mutators/return-value.js +65 -33
  123. package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +12 -7
  124. package/dist/core/mutators/shared/get-branch-copy-skip.js +34 -35
  125. package/dist/core/mutators/shared/get-canonical-falsy-default.d.ts +32 -0
  126. package/dist/core/mutators/shared/get-canonical-falsy-default.js +11 -0
  127. package/dist/core/mutators/shared/get-comparison-plan.js +86 -85
  128. package/dist/core/mutators/shared/get-condition-constants.d.ts +8 -8
  129. package/dist/core/mutators/shared/get-condition-constants.js +3 -3
  130. package/dist/core/mutators/shared/get-endless-value.d.ts +20 -0
  131. package/dist/core/mutators/shared/get-endless-value.js +25 -0
  132. package/dist/core/mutators/shared/get-forced-test-justifier.d.ts +44 -0
  133. package/dist/core/mutators/shared/get-forced-test-justifier.js +25 -0
  134. package/dist/core/mutators/shared/get-group-constant.d.ts +4 -4
  135. package/dist/core/mutators/shared/get-group-constant.js +2 -2
  136. package/dist/core/mutators/shared/get-literal-skip.d.ts +6 -6
  137. package/dist/core/mutators/shared/get-literal-skip.js +2 -2
  138. package/dist/core/mutators/shared/get-logical-drops.d.ts +8 -8
  139. package/dist/core/mutators/shared/get-logical-drops.js +80 -82
  140. package/dist/core/mutators/shared/get-owner-constant.d.ts +3 -1
  141. package/dist/core/mutators/shared/get-running-value.d.ts +5 -4
  142. package/dist/core/mutators/shared/get-toward-mutant.d.ts +10 -2
  143. package/dist/core/mutators/shared/get-toward-mutant.js +45 -40
  144. package/dist/core/mutators/shared/has-other-exit.js +16 -36
  145. package/dist/core/mutators/shared/is-loop-exit.d.ts +20 -0
  146. package/dist/core/mutators/shared/is-loop-exit.js +32 -0
  147. package/dist/core/mutators/shared/is-read-only.d.ts +26 -0
  148. package/dist/core/mutators/shared/is-read-only.js +53 -0
  149. package/dist/core/mutators/statement-removal.d.ts +4 -3
  150. package/dist/core/mutators/statement-removal.js +69 -73
  151. package/dist/core/mutators/string-literal.d.ts +15 -5
  152. package/dist/core/mutators/string-literal.js +79 -50
  153. package/dist/core/presets/recommended.d.ts +2 -2
  154. package/dist/core/presets/strict.d.ts +4 -2
  155. package/dist/core/run/apply-batch-result.d.ts +23 -22
  156. package/dist/core/run/apply-batch-result.js +5 -5
  157. package/dist/core/run/apply-isolated-result.d.ts +18 -17
  158. package/dist/core/run/apply-isolated-result.js +1 -0
  159. package/dist/core/run/classify-try.d.ts +9 -8
  160. package/dist/core/run/get-test-file-limits.d.ts +13 -0
  161. package/dist/core/run/get-test-file-limits.js +13 -0
  162. package/dist/core/run/get-unit-evidence.d.ts +6 -3
  163. package/dist/core/run/get-unit-evidence.js +1 -1
  164. package/dist/core/run/plan-batch.d.ts +6 -3
  165. package/dist/core/run/plan-batch.js +36 -31
  166. package/dist/core/run/plan-isolated.d.ts +3 -1
  167. package/dist/core/run/plan-isolated.js +8 -14
  168. package/dist/core/run/read-isolated-unit.d.ts +4 -4
  169. package/dist/core/run/run-batch-phases.d.ts +4 -3
  170. package/dist/core/run/run-dry-phase.d.ts +35 -19
  171. package/dist/core/run/run-dry-phase.js +127 -77
  172. package/dist/core/run/run-isolated-rounds.d.ts +6 -5
  173. package/dist/core/run/run-isolated-rounds.js +1 -0
  174. package/dist/core/run-mutants.d.ts +26 -21
  175. package/dist/core/run-mutants.js +72 -64
  176. package/dist/core/runtime/create-hit-limit-error.d.ts +5 -3
  177. package/dist/core/runtime/create-hit-limit-error.js +1 -1
  178. package/dist/core/runtime/install-mutant-runtime.js +23 -6
  179. package/dist/core/runtime/runtime-version.d.ts +4 -4
  180. package/dist/core/skips/skip-rules.d.ts +4 -0
  181. package/dist/core/skips/skip-rules.js +4 -0
  182. package/dist/core/syntax/is-brace-sensitive-attribute.d.ts +18 -0
  183. package/dist/core/syntax/is-brace-sensitive-attribute.js +28 -0
  184. package/dist/core/syntax/is-spread-safe-member.d.ts +18 -0
  185. package/dist/core/syntax/is-spread-safe-member.js +18 -0
  186. package/dist/core/syntax/is-value-position.d.ts +3 -1
  187. package/dist/core/text/get-list-removal-range.d.ts +22 -0
  188. package/dist/core/text/get-list-removal-range.js +46 -0
  189. package/dist/core/text/is-plain-attribute-string.d.ts +10 -0
  190. package/dist/core/text/is-plain-attribute-string.js +5 -0
  191. package/dist/core/text/parse-expression.d.ts +8 -4
  192. package/dist/core/text/parse-expression.js +1 -0
  193. package/dist/core/text/remove-list-element.d.ts +2 -4
  194. package/dist/core/text/remove-list-element.js +4 -45
  195. package/dist/docs/styles/colors.js +1 -1
  196. package/dist/package.js +1 -1
  197. package/dist/types/adapter/dry-file.d.ts +2 -1
  198. package/dist/types/adapter/dry-run-request.d.ts +5 -4
  199. package/dist/types/adapter/mutant-runtime.d.ts +30 -1
  200. package/dist/types/cli/text-style.d.ts +1 -1
  201. package/dist/types/config/preset-settings.d.ts +2 -2
  202. package/dist/types/config/run-config.d.ts +12 -4
  203. package/dist/types/html/indexed-mutant.d.ts +4 -2
  204. package/dist/types/html/shown-change.d.ts +4 -3
  205. package/dist/types/mutant/list-removal.d.ts +37 -0
  206. package/dist/types/mutant/mutant-candidate.d.ts +11 -17
  207. package/dist/types/mutant/mutant-host.d.ts +49 -0
  208. package/dist/types/mutant/mutant-kind.d.ts +18 -0
  209. package/dist/types/mutant/mutant-range.d.ts +15 -8
  210. package/dist/types/mutant/mutant.d.ts +9 -15
  211. package/dist/types/mutant/site-syntax.d.ts +14 -0
  212. package/dist/types/mutant/skip-justifier.d.ts +3 -1
  213. package/dist/types/mutant/skipped-candidate.d.ts +13 -10
  214. package/dist/types/mutant/skipped-mutant.d.ts +9 -6
  215. package/dist/types/mutator/replacement.d.ts +14 -3
  216. package/dist/types/report/html-report.d.ts +10 -7
  217. package/dist/types/report/list-report-focus.d.ts +3 -2
  218. package/dist/types/report/list-report-justifier.d.ts +4 -2
  219. package/dist/types/report/list-report-mutant.d.ts +15 -9
  220. package/dist/types/report/list-report-skipped.d.ts +3 -2
  221. package/dist/types/report/list-report.d.ts +1 -1
  222. package/dist/types/report/run-report.d.ts +2 -2
  223. package/dist/types/report/slim-list-report.d.ts +6 -3
  224. package/dist/types/report/slim-run-report.d.ts +1 -1
  225. package/dist/types/run/isolated-reason.d.ts +4 -3
  226. package/dist/types/run/mutant-state.d.ts +1 -1
  227. package/dist/types/run/run-event.d.ts +1 -1
  228. package/dist/types/run/run-kind.d.ts +3 -2
  229. package/dist/types/run/run-result.d.ts +6 -3
  230. package/dist/types/run/run-state.d.ts +9 -1
  231. package/dist/types/run/run-status.d.ts +2 -2
  232. package/dist/types/run/try-cause.d.ts +8 -6
  233. package/dist/types/syntax/syntax-helpers.d.ts +5 -3
  234. package/package.json +5 -5
  235. package/skills/mootant/SKILL.md +14 -12
  236. package/skills/mootant/references/mutators.md +3 -1
  237. package/dist/core/instrument/get-site-check.d.ts +0 -9
  238. package/dist/core/instrument/get-site-check.js +0 -5
  239. package/dist/core/instrument/get-template-site-check.d.ts +0 -12
  240. package/dist/core/instrument/get-template-site-check.js +0 -5
  241. /package/dist/cli/{built-in-adapters.d.ts → get-built-in-adapters.d.ts} +0 -0
  242. /package/dist/cli/{built-in-adapters.js → get-built-in-adapters.js} +0 -0
  243. /package/dist/cli/terminal/{colors.d.ts → create-colors.d.ts} +0 -0
  244. /package/dist/cli/terminal/{colors.js → create-colors.js} +0 -0
@@ -30,12 +30,12 @@ import { getCachePath as O } from "./cache/get-cache-path.js";
30
30
  import { countVerdicts as k } from "./run/count-verdicts.js";
31
31
  import { decideResults as A } from "./run/decide-results.js";
32
32
  import { getHtmlPath as j } from "./run/get-html-path.js";
33
- import { runDryPhase as M } from "./run/run-dry-phase.js";
34
- import { prepareRun as N } from "./config/prepare-run.js";
35
- import { readDryRun as P } from "./run/read-dry-run.js";
36
- import { availableParallelism as F } from "node:os";
37
- async function I(e) {
38
- let t = performance.now(), r = Date.now(), a = await N(e), { root: c, run: l } = a, { fast: u, ...d } = i(e, l), { threshold: f } = d, p = j(e.html, l.html, {
33
+ import { runDryPhase as ee } from "./run/run-dry-phase.js";
34
+ import { prepareRun as M } from "./config/prepare-run.js";
35
+ import { readDryRun as te } from "./run/read-dry-run.js";
36
+ import { availableParallelism as ne } from "node:os";
37
+ async function N(e) {
38
+ let t = performance.now(), r = Date.now(), a = await M(e), { root: c, run: l } = a, { fast: u, ...d } = i(e, l), { threshold: f } = d, p = j(e.html, l.html, {
39
39
  picked: (e.mutantIds?.length ?? 0) > 0,
40
40
  root: c
41
41
  }), m = e.paths.length === 0, h = m ? l.paths ?? [] : e.paths;
@@ -44,16 +44,16 @@ async function I(e) {
44
44
  ref: e.since,
45
45
  base: v.base
46
46
  }, b = await g({
47
+ skipped: p !== null || v !== null,
47
48
  knownMutatorIds: a.knownMutatorIds,
48
49
  cwd: m ? c : e.cwd,
49
50
  regions: d.cache,
50
51
  settings: a.settings,
51
52
  mutators: a.mutators,
52
- skipped: p !== null,
53
53
  paths: h,
54
54
  root: c
55
- }), x = z({
56
- changed: v === null ? b.files : n(b.files, v.files),
55
+ }), x = F({
56
+ changed: v === null ? b.files : n(b.files, v.files, p !== null),
57
57
  ids: e.mutantIds,
58
58
  listed: b.files,
59
59
  since: y
@@ -129,7 +129,7 @@ async function I(e) {
129
129
  root: c
130
130
  }), l;
131
131
  try {
132
- l = await L({
132
+ l = await P({
133
133
  diagnostics: b.diagnostics,
134
134
  listed: b.files,
135
135
  runSettings: d,
@@ -159,75 +159,83 @@ async function I(e) {
159
159
  await A.remove();
160
160
  }
161
161
  }
162
- async function L(n) {
163
- let { runSettings: i, session: o, options: s, setup: c, fast: u } = n, { limits: g } = i, { root: _ } = c, y = O(_), C = i.cache ? D(y) : null, T = await o.listTestFiles(), j = w(n.files, T, a()), N = [
162
+ async function P(n) {
163
+ let { runSettings: i, session: o, options: s, setup: c, fast: u } = n, { limits: g } = i, { root: _ } = c, y = O(_), C = i.cache ? D(y) : null, T = await o.listTestFiles(), j = a(), M = w(n.files, T, j), N = w(n.listed, T, j), P = [
164
164
  ...n.diagnostics,
165
165
  ...o.diagnostics ?? [],
166
- ...j.diagnostics
167
- ], I = new Set(j.files.map((e) => t(e.file))), L = new Map(n.listed.map((e) => [e.absolute, e])), z = j.files.map((e) => L.get(e.absolute)), B = e(z, {
168
- svelte: I.has("svelte") ? await r() : null,
169
- vue: I.has("vue") ? await m() : null
170
- });
171
- n.switched.push(...B.switched), N.push(...B.diagnostics);
172
- let V = /* @__PURE__ */ new Map();
173
- for (let e of B.diagnostics) V.set(e.file, e.message);
174
- let H = j.files.flatMap((e) => e.mutants), ne = H.filter((e) => e.status === "Pending"), U = z.flatMap((e) => e.mutants).filter((e) => e.status === "Pending"), re = new Map(j.files.map((e) => [e.absolute, e.file])), ie = new Map(j.files.map((e) => [e.file, e.absolute])), W = performance.now(), G = await M(o, {
175
- mutantFiles: new Map(U.map((e) => [e.id, ie.get(e.file)])),
166
+ ...M.diagnostics
167
+ ], F = new Set(N.files.map((e) => t(e.file))), I = e(N.files, {
168
+ svelte: F.has("svelte") ? await r() : null,
169
+ vue: F.has("vue") ? await m() : null
170
+ }), L = new Map(M.files.map((e) => [e.absolute, e.file])), R = new Map(M.files.map((e) => [e.file, e.absolute]));
171
+ n.switched.push(...I.switched.filter((e) => L.has(e.file)));
172
+ let z = I.diagnostics.filter((e) => R.has(e.file));
173
+ P.push(...z);
174
+ let B = /* @__PURE__ */ new Map();
175
+ for (let e of z) B.set(e.file, e.message);
176
+ let V = M.files.flatMap((e) => e.mutants), oe = V.filter((e) => e.status === "Pending"), H = N.files.filter((e) => L.has(e.absolute)).flatMap((e) => e.mutants).filter((e) => e.status === "Pending"), U = performance.now(), W = await ee(o, {
177
+ mutantFiles: new Map(H.map((e) => [e.id, R.get(e.file)])),
178
+ related: I.switched.map((e) => e.file),
176
179
  report: (e) => s.onProgress?.(e),
177
180
  switched: n.switched,
178
181
  repeat: u,
179
- displays: re,
182
+ displays: L,
180
183
  root: _
181
184
  });
182
185
  s.onProgress?.({
183
- duration: performance.now() - W,
184
- tests: G.dry.tests.length,
186
+ duration: performance.now() - U,
187
+ tests: W.dry.tests.length,
185
188
  kind: "dry-end"
186
- }), N.push(...G.diagnostics);
187
- for (let [e, t] of G.errors) V.set(e, t);
188
- let K = P(G.dry, G.unrepeatableFiles);
189
- u && N.push(...R({
190
- unrepeatableFiles: G.unrepeatableFiles,
191
- files: G.dry.files,
192
- analysis: K,
189
+ }), P.push(...W.diagnostics);
190
+ for (let [e, t] of W.errors) B.set(e, t);
191
+ let G = te(W.dry, W.unrepeatableFiles);
192
+ u && P.push(...re({
193
+ unrepeatableFiles: W.unrepeatableFiles,
194
+ files: W.dry.files,
195
+ analysis: G,
193
196
  root: _
194
197
  }));
195
- let q = Date.now(), J = C === null ? null : await h({
196
- files: w(n.listed, T, a()).files,
198
+ let K = Date.now(), { warning: q, cache: J } = C === null ? {
199
+ warning: null,
200
+ cache: null
201
+ } : await h({
197
202
  incremental: i.incremental,
198
203
  started: n.startedAt,
199
204
  adapter: n.adapter,
200
- dry: G.dry,
201
- analysis: K,
205
+ files: N.files,
206
+ dry: W.dry,
207
+ analysis: G,
202
208
  session: o,
203
209
  stored: C,
204
210
  limits: g,
205
211
  setup: c,
206
212
  root: _,
207
- now: q
208
- }), Y = S({
209
- workers: o.workers ?? i.concurrency ?? Math.max(1, F() - 1),
210
- imports: await v([...K.testFiles.values()].map((e) => e.file)),
213
+ now: K
214
+ });
215
+ q !== null && P.push(q);
216
+ let Y = S({
217
+ workers: o.workers ?? i.concurrency ?? Math.max(1, ne() - 1),
218
+ imports: await v([...G.testFiles.values()].map((e) => e.file)),
211
219
  batch: n.adapter.batch,
212
220
  report: s.onProgress,
213
- mutants: ne,
214
- analysis: K,
215
- hosted: U,
221
+ mutants: oe,
222
+ analysis: G,
223
+ hosted: H,
216
224
  limits: g,
217
- errors: V,
225
+ errors: B,
218
226
  fast: u,
219
227
  root: _
220
228
  });
221
- G.runs > 0 && (Y.runs.dry = G.runs), Y.cache = J, Y.live !== null && (Y.live.outside = new Set(G.dry.outside)), n.live.state = Y, u && K.unrepeatable.size > 0 && s.onProgress?.({
222
- message: ee(Y),
229
+ W.runs > 0 && (Y.runs.dry = W.runs), Y.cache = J, Y.live !== null && (Y.live.outside = new Set(W.dry.outside)), n.live.state = Y, u && G.unrepeatable.size > 0 && s.onProgress?.({
230
+ message: ie(Y),
223
231
  kind: "note"
224
- }), te(Y, u);
232
+ }), ae(Y, u);
225
233
  let X = performance.now();
226
234
  u && (await x(o, Y), d(Y));
227
235
  let Z = performance.now();
228
- await f(o, Y), l(Y, G.dry.outside), k(Y), N.push(...Y.diagnostics);
236
+ await f(o, Y), l(Y, W.dry.outside), k(Y), P.push(...Y.diagnostics);
229
237
  let Q = J?.regional.size ?? 0;
230
- if (Q > 0 && N.push({
238
+ if (Q > 0 && P.push({
231
239
  message: Q === 1 ? "1 mutant has cached evidence that only its region matched, which a change elsewhere may have made stale; run with --no-incremental to check it." : `${Q} mutants have cached evidence that only their region matched, which a change elsewhere may have made stale; run with --no-incremental to check them.`,
232
240
  code: "incremental-reuse",
233
241
  severity: "warning",
@@ -236,45 +244,45 @@ async function L(n) {
236
244
  line: null
237
245
  }), J !== null) {
238
246
  let e = await E({
239
- failed: [...N, ...n.files.flatMap((e) => e.diagnostics)].some((e) => e.severity === "error"),
247
+ failed: [...P, ...n.files.flatMap((e) => e.diagnostics)].some((e) => e.severity === "error"),
240
248
  started: n.startedAt,
241
249
  file: y,
242
250
  cache: J,
243
251
  root: _,
244
- now: q
252
+ now: K
245
253
  });
246
- e !== null && N.push(e);
254
+ e !== null && P.push(e);
247
255
  }
248
256
  let $ = performance.now();
249
257
  return {
250
258
  timing: {
251
259
  batch: u ? Z - X : null,
252
- startup: W - n.started,
260
+ startup: U - n.started,
253
261
  isolated: $ - Z,
254
- dryRun: X - W,
262
+ dryRun: X - U,
255
263
  total: $ - n.started
256
264
  },
257
- unrepeatable: u ? [...K.unrepeatable].toSorted(b) : null,
258
- results: A(Y, H),
265
+ unrepeatable: u ? [...G.unrepeatable].toSorted(b) : null,
266
+ results: A(Y, V),
259
267
  runnerVersion: o.version ?? null,
260
268
  staticCost: p(Y),
261
269
  mode: u ? "fast" : "isolated",
262
270
  threshold: i.threshold,
263
271
  listedIds: n.listedIds,
264
272
  runner: n.adapter.name,
265
- tests: G.dry.tests,
273
+ tests: W.dry.tests,
266
274
  mutators: c.mutators,
267
275
  cache: J !== null,
268
- files: j.files,
276
+ files: M.files,
269
277
  since: n.since,
270
278
  preset: c.preset,
271
279
  html: n.html,
272
280
  runs: Y.runs,
273
- diagnostics: N,
281
+ diagnostics: P,
274
282
  root: _
275
283
  };
276
284
  }
277
- function R(e) {
285
+ function re(e) {
278
286
  let { unrepeatableFiles: t, analysis: n, root: r } = e, i = [];
279
287
  for (let t of e.files) if (t.concurrent) {
280
288
  let e = C(t.file, r);
@@ -300,7 +308,7 @@ function R(e) {
300
308
  }
301
309
  return i;
302
310
  }
303
- function z(e) {
311
+ function F(e) {
304
312
  let { changed: t, listed: n, since: r, ids: i } = e;
305
313
  if (i === void 0 || i.length === 0) return t;
306
314
  let a = c(i, n.flatMap((e) => e.mutants)), o = new Set(t.flatMap((e) => e.mutants.map((e) => e.id)));
@@ -311,11 +319,11 @@ function z(e) {
311
319
  mutants: e.mutants.filter((e) => s.has(e.id))
312
320
  })).filter((e) => e.mutants.length > 0);
313
321
  }
314
- function ee(e) {
322
+ function ie(e) {
315
323
  let t = e.analysis.unrepeatable.size, n = [...e.mutants.values()].filter((e) => e.isolatedBecause === "unrepeatable").length, r = t === 1 ? "1 test is" : `${t} tests are`, i = t === 1 ? "it reaches" : "they reach";
316
324
  return n === 1 ? `${r} not repeatable; the 1 mutant ${i} runs isolated.` : `${r} not repeatable; the ${n} mutants ${i} run isolated.`;
317
325
  }
318
- function te(e, t) {
326
+ function ae(e, t) {
319
327
  t && u(e), d(e);
320
328
  let n = [...e.mutants.values()].filter((e) => e.cached).length;
321
329
  n > 0 && e.report({
@@ -323,4 +331,4 @@ function te(e, t) {
323
331
  kind: "note"
324
332
  });
325
333
  }
326
- export { I as runMutants };
334
+ export { N as runMutants };
@@ -1,9 +1,11 @@
1
1
  /**
2
- * Creates the error that stops a try whose code evaluated more mutant sites
3
- * than its hit limit allows, such as a loop that a mutant made endless.
2
+ * Creates the error that stops a batch try, or a test file run with a mutant,
3
+ * whose code evaluated more mutant sites than allowed: a loop that a mutant
4
+ * made endless, or code that a mutant made far hotter, such as a cache turned
5
+ * off.
4
6
  *
5
7
  * @param id - Id of the mutant whose site went over the limit.
6
- * @param limit - Site evaluations the try was allowed.
8
+ * @param limit - Site evaluations allowed.
7
9
  * @returns Error named `MootantHitLimitError`.
8
10
  */
9
11
  export declare function createHitLimitError(id: string, limit: number): Error;
@@ -2,6 +2,6 @@ var e = class extends Error {
2
2
  name = "MootantHitLimitError";
3
3
  };
4
4
  function t(t, n) {
5
- return new e(`mootant stopped the test after ${n} evaluations of mutant sites, at mutant ${t}; the code is likely stuck in a loop.`);
5
+ return new e(`mootant stopped the test after ${n} evaluations of mutant sites, at mutant ${t}; the code may loop endlessly or do far more work than without mutants (see run.hitLimit).`);
6
6
  }
7
7
  export { t as createHitLimitError };
@@ -11,17 +11,34 @@ function r() {
11
11
  }), e;
12
12
  }
13
13
  function i() {
14
- let t = {
15
- hit(n) {
16
- if (t.hits += 1, t.hits > t.hitLimit) throw e(n, t.hitLimit);
17
- return t.coverage !== null && t.coverage.add(n), t.active === n && (t.reached = !0, !0);
14
+ let t = Symbol("mootant gap"), n = {
15
+ hit(t) {
16
+ if (n.hits += 1, n.hits > n.hitLimit) throw e(t, n.hitLimit);
17
+ return n.coverage !== null && n.coverage.add(t), n.active === t && (n.reached = !0, !0);
18
18
  },
19
+ hitAny(e) {
20
+ for (let t = 0; t < e.length; t++) if (n.hit(e[t])) return !0;
21
+ return !1;
22
+ },
23
+ cut(e) {
24
+ let n = 0;
25
+ for (let r = 0; r < e.length; r++) {
26
+ let i = e[r];
27
+ i !== t && (e[n] = i, n += 1);
28
+ }
29
+ return e.length = n, e;
30
+ },
31
+ none: { [Symbol.iterator]: () => ({ next: () => ({
32
+ value: void 0,
33
+ done: !0
34
+ }) }) },
19
35
  hitLimit: Infinity,
20
36
  coverage: null,
21
37
  reached: !1,
22
38
  active: null,
23
- hits: 0
39
+ hits: 0,
40
+ gap: t
24
41
  };
25
- return t;
42
+ return n;
26
43
  }
27
44
  export { r as installMutantRuntime };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Version of the mutant runtime semantics: what `hit` counts and when it
3
- * reaches a mutant or stops at the hit limit. Part of the cache key; bump it
4
- * when they change.
2
+ * Version of the mutant runtime semantics: what `hit` and `hitAny` count, when
3
+ * they reach a mutant or stop at the hit limit, and how the helpers that remove
4
+ * an array element work. Part of the cache key; bump it when they change.
5
5
  */
6
- export declare const RUNTIME_VERSION = 1;
6
+ export declare const RUNTIME_VERSION = 2;
@@ -189,6 +189,10 @@ export declare let skipRules: {
189
189
  category: "equivalent";
190
190
  heuristic: true;
191
191
  };
192
+ 'literal-copies': {
193
+ category: "invalid";
194
+ heuristic: false;
195
+ };
192
196
  'shifted-literal': {
193
197
  category: "owned";
194
198
  heuristic: false;
@@ -183,6 +183,10 @@ let e = {
183
183
  category: "equivalent",
184
184
  heuristic: !0
185
185
  },
186
+ "literal-copies": {
187
+ category: "invalid",
188
+ heuristic: !1
189
+ },
186
190
  "shifted-literal": {
187
191
  category: "owned",
188
192
  heuristic: !1
@@ -0,0 +1,18 @@
1
+ import { JSXOpeningElement, JSXAttribute } from 'oxc-parser';
2
+ /**
3
+ * Tells whether a compiler may read the value of a JSX attribute another way
4
+ * once the mutant switch moves it into braces than while it is quoted. The
5
+ * compiler of Solid reads by its own rules, on any element, an attribute of its
6
+ * namespaces, such as `bool:`, of `solidNames`, such as `ref`, and one whose
7
+ * name starts with `on`, such as `onclick`. In braces it also sets a name of
8
+ * `propertyAttributes` on a built-in element and any attribute of a custom
9
+ * element, whose tag has a `-` or which has an `is` attribute, as a property,
10
+ * which can read the same text another way, as `disabled` reads `""` as false.
11
+ * Other props of a component stay the same either way; so do the attributes of
12
+ * other namespaces, such as `xlink:href`.
13
+ *
14
+ * @param attribute - Attribute with a quoted value.
15
+ * @param element - Opening element of the attribute.
16
+ * @returns Whether braces may change what the value does.
17
+ */
18
+ export declare function isBraceSensitiveAttribute(attribute: JSXAttribute, element: JSXOpeningElement): boolean;
@@ -0,0 +1,28 @@
1
+ let e = new Set((/* @__PURE__ */ "allowFullscreen.async.autofocus.autoplay.checked.controls.default.defaultChecked.defaultMuted.defaultSelected.defer.disabled.disablePictureInPicture.disableRemotePlayback.formNoValidate.hidden.indeterminate.inert.isMap.loop.multiple.muted.noModule.noValidate.open.playsInline.preservesPitch.readOnly.required.reversed.selected.shadowRootClonable.shadowRootDelegatesFocus.shadowRootSerializable.value".split(".")).map((e) => e.toLowerCase())), t = /* @__PURE__ */ new Set([
2
+ "oncapture",
3
+ "class",
4
+ "style",
5
+ "bool",
6
+ "prop",
7
+ "attr",
8
+ "use",
9
+ "on"
10
+ ]), n = /* @__PURE__ */ new Set([
11
+ "textContent",
12
+ "className",
13
+ "classList",
14
+ "innerHTML",
15
+ "innerText",
16
+ "children",
17
+ "class",
18
+ "style",
19
+ "ref"
20
+ ]);
21
+ const r = /^on/u, i = /^[a-z]/u;
22
+ function a(a, o) {
23
+ let { name: s } = a;
24
+ if (s.type === "JSXNamespacedName" ? t.has(s.namespace.name) : n.has(s.name) || r.test(s.name)) return !0;
25
+ let c = o.name;
26
+ return c.type !== "JSXIdentifier" || !i.test(c.name) ? !1 : c.name.includes("-") || o.attributes.some((e) => e.type === "JSXAttribute" && e.name.type === "JSXIdentifier" && e.name.name === "is") || s.type === "JSXIdentifier" && e.has(s.name.toLowerCase());
27
+ }
28
+ export { a as isBraceSensitiveAttribute };
@@ -0,0 +1,18 @@
1
+ import { ObjectPropertyKind } from 'oxc-parser';
2
+ /**
3
+ * Tells whether a member of an object literal behaves the same when it is
4
+ * spread from an object literal of its own, as the copy of a literal that the
5
+ * mutant switch runs while the removal of a member is active writes every
6
+ * member with a removal: `{ a, ...(removed ? {} : { b }), c }`. A spread, a
7
+ * data property and a method that cannot reach `super` do. An accessor does
8
+ * not, since a spread reads it and copies its value, nor does a method that
9
+ * uses `super` or calls `eval`, whose code may use it, since its home object
10
+ * would change. A member keyed `__proto__` in any form does not either: written
11
+ * plainly it sets the prototype, which a spread does not copy, and code that
12
+ * lowers spreads to assignments, such as `Object.assign`, turns the other forms
13
+ * into a prototype change too.
14
+ *
15
+ * @param member - Property or spread of an object literal.
16
+ * @returns Whether spreading the member keeps its meaning.
17
+ */
18
+ export declare function isSpreadSafeMember(member: ObjectPropertyKind): boolean;
@@ -0,0 +1,18 @@
1
+ import { unwrapExpression as e } from "../tree/unwrap-expression.js";
2
+ import { walkTree as t } from "../tree/walk-tree.js";
3
+ const n = "__proto__";
4
+ function r(e) {
5
+ return e.type === "SpreadElement" ? !0 : e.kind !== "init" || i(e) ? !1 : !e.method || !a(e.value);
6
+ }
7
+ function i(t) {
8
+ let r = e(t.key);
9
+ return r.type === "Identifier" ? !t.computed && r.name === n : r.type === "TemplateLiteral" ? r.expressions.length === 0 && r.quasis[0].value.cooked === n : r.type === "Literal" && r.value === n;
10
+ }
11
+ function a(n) {
12
+ let r = !1;
13
+ return t(n, (t) => {
14
+ let n = t.type === "CallExpression" ? e(t.callee) : null;
15
+ return r ||= t.type === "Super" || n?.type === "Identifier" && n.name === "eval", !r;
16
+ }), r;
17
+ }
18
+ export { r as isSpreadSafeMember };
@@ -8,7 +8,9 @@ import { TreeIndex } from '../../types/syntax/tree-index.js';
8
8
  * shorthand property values, method values, `delete` operands, `typeof`
9
9
  * identifiers, template parts of tagged templates, callee or tag expressions
10
10
  * that carry `this`, short-circuiting elements of optional chains, JSX
11
- * attribute values and JSX children are rejected.
11
+ * attribute values and JSX children are rejected. A quoted attribute value may
12
+ * still be replaced with a plain string, which the switch hosts in braces (see
13
+ * `validateReplacement`).
12
14
  *
13
15
  * @param tree - Runtime tree of the file.
14
16
  * @param node - Node of the runtime tree.
@@ -0,0 +1,22 @@
1
+ import { ListExpression } from '../../types/syntax/list-expression.js';
2
+ import { SourceRange } from '../../types/source/source-range.js';
3
+ import { ParsedFile } from '../../types/source/parsed-file.js';
4
+ /**
5
+ * Finds the text that removing one element of a list expression deletes: an
6
+ * array element, an object member or a call argument, with one comma next to
7
+ * it, so the list stays well formed. Removing the only element deletes
8
+ * everything between the delimiters, removing an element that is not the last
9
+ * deletes up to the start of the next one (its indentation is kept), and
10
+ * removing the last element deletes from the comma before it, or, when a comma
11
+ * follows it at once, from just after the comma before it through the one after
12
+ * it, which leaves the same text. The comma of a hole before the last element
13
+ * is kept. Removing either of two equal neighbors written alike leaves the same
14
+ * text.
15
+ *
16
+ * @param parsed - File the node belongs to.
17
+ * @param node - Array, object, call or `new` expression.
18
+ * @param index - Position of the element to remove; it must not be a hole.
19
+ * @returns Range of the deleted text.
20
+ * @throws RangeError - When no element exists at the index.
21
+ */
22
+ export declare function getListRemovalRange(parsed: ParsedFile, node: ListExpression, index: number): SourceRange;
@@ -0,0 +1,46 @@
1
+ import { findTokenStart as e } from "./find-token-start.js";
2
+ function t(t, a, o) {
3
+ let s = i(a), c = s[o];
4
+ if (!c) throw RangeError(`List element ${o} does not exist.`);
5
+ let l = n(t, a);
6
+ if (s.length === 1) return {
7
+ start: l.start + 1,
8
+ end: l.end
9
+ };
10
+ if (o < s.length - 1) return {
11
+ end: s[o + 1]?.start ?? r(t, s, l)[o + 1],
12
+ start: c.start
13
+ };
14
+ let u = s[o - 1], d = u ? e(t, u.end, l.end) : r(t, s, l)[o - 1];
15
+ return t.text[c.end] === "," ? {
16
+ end: c.end + 1,
17
+ start: d + 1
18
+ } : {
19
+ start: u ? d : d + 1,
20
+ end: c.end
21
+ };
22
+ }
23
+ function n(e, t) {
24
+ if (t.type === "ArrayExpression" || t.type === "ObjectExpression") return {
25
+ start: t.start,
26
+ end: t.end - 1
27
+ };
28
+ let n = (t.typeArguments ?? t.callee).end;
29
+ for (; e.text[n] !== "(";) n = e.commentEnds.get(n) ?? n + 1;
30
+ return {
31
+ end: t.end - 1,
32
+ start: n
33
+ };
34
+ }
35
+ function r(t, n, r) {
36
+ let i = [], a = r.start + 1;
37
+ for (let o of n) {
38
+ let n = o?.start ?? e(t, a, r.end);
39
+ i.push(n), a = e(t, o?.end ?? n, r.end) + 1;
40
+ }
41
+ return i;
42
+ }
43
+ function i(e) {
44
+ return e.type === "ArrayExpression" ? e.elements : e.type === "ObjectExpression" ? e.properties : e.arguments;
45
+ }
46
+ export { t as getListRemovalRange };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Tells whether a text is a string literal that means the same string as a
3
+ * quoted JSX attribute value and as JavaScript: one string in double or single
4
+ * quotes without a backslash, a control character or a character reference. The
5
+ * mutant switch can move such a value into braces as it is written.
6
+ *
7
+ * @param text - Text of a string literal or of a quoted attribute value.
8
+ * @returns Whether JSX and JavaScript read the text as the same string.
9
+ */
10
+ export declare function isPlainAttributeString(text: string): boolean;
@@ -0,0 +1,5 @@
1
+ const e = /^(?:"[^\p{Cc}"\\]*"|'[^\p{Cc}'\\]*')$/u, t = /&(?:#|\w+;)/u;
2
+ function n(n) {
3
+ return e.test(n) && !t.test(n);
4
+ }
5
+ export { n as isPlainAttributeString };
@@ -2,10 +2,14 @@ import { Node } from 'oxc-parser';
2
2
  /**
3
3
  * Parses the text of a single expression, such as the text of a replacement, in
4
4
  * parentheses. In a `method` context the text is the value that an async
5
- * generator method returns, so `await`, `yield`, `super` and `new.target` parse
6
- * as they do there; in a `script` context it is a statement of a sloppy script,
7
- * where `await` and `yield` are names. A text that closes the parentheses and
8
- * adds a statement or a member is not one expression.
5
+ * generator method of a module returns, so `await`, `yield`, `super`,
6
+ * `new.target` and `import.meta` parse as they do there. The source type is set
7
+ * to module rather than detected: oxc, which takes a text with `import.meta`
8
+ * for a module, reads a regular expression that starts with `<!--` right after
9
+ * a `(` of a detected module as an HTML comment. In a `script` context the text
10
+ * is a statement of a sloppy script, where `await` and `yield` are names. A
11
+ * text that closes the parentheses and adds a statement or a member is not one
12
+ * expression.
9
13
  *
10
14
  * @param text - Source text of the expression, without parentheses.
11
15
  * @param lang - Language of the expression.
@@ -11,6 +11,7 @@ function t(t, n, r = "method") {
11
11
  return a.expression;
12
12
  }
13
13
  let { program: i, errors: a } = e(`expression.${n}`, `class Expression { async *read() { return (${t}) } }`, {
14
+ sourceType: "module",
14
15
  preserveParens: !0,
15
16
  lang: n
16
17
  });
@@ -2,10 +2,8 @@ import { ListExpression } from '../../types/syntax/list-expression.js';
2
2
  import { ParsedFile } from '../../types/source/parsed-file.js';
3
3
  /**
4
4
  * Builds the text of a list expression with one element removed: an array
5
- * element, an object member or a call argument. Removing the only element
6
- * empties the delimiters, removing an element that is not the last deletes up
7
- * to the start of the next one (its indentation is kept), and removing the last
8
- * element deletes from the comma before it.
5
+ * element, an object member or a call argument, with the comma next to it (see
6
+ * `getListRemovalRange`).
9
7
  *
10
8
  * @param parsed - File the node belongs to.
11
9
  * @param node - Array, object, call or `new` expression.
@@ -1,47 +1,6 @@
1
- import { findTokenStart as e } from "./find-token-start.js";
2
- function t(t, a, o) {
3
- let s = i(a), c = s[o];
4
- if (!c) throw RangeError(`List element ${o} does not exist.`);
5
- let l = n(t, a), u = r(t, s, l), d;
6
- if (s.length === 1) d = {
7
- start: l.start + 1,
8
- end: l.end
9
- };
10
- else if (o < s.length - 1) d = {
11
- end: u[o + 1],
12
- start: c.start
13
- };
14
- else {
15
- let n = s[o - 1];
16
- d = {
17
- start: n ? e(t, n.end, l.end) : u[o - 1] + 1,
18
- end: c.end
19
- };
20
- }
21
- let { text: f } = t;
22
- return f.slice(a.start, d.start) + f.slice(d.end, a.end);
23
- }
24
- function n(e, t) {
25
- if (t.type === "ArrayExpression" || t.type === "ObjectExpression") return {
26
- start: t.start,
27
- end: t.end - 1
28
- };
29
- let n = (t.typeArguments ?? t.callee).end;
30
- for (; e.text[n] !== "(";) n = e.commentEnds.get(n) ?? n + 1;
31
- return {
32
- end: t.end - 1,
33
- start: n
34
- };
35
- }
36
- function r(t, n, r) {
37
- let i = [], a = r.start + 1;
38
- for (let o of n) {
39
- let n = o?.start ?? e(t, a, r.end);
40
- i.push(n), a = e(t, o?.end ?? n, r.end) + 1;
41
- }
42
- return i;
43
- }
44
- function i(e) {
45
- return e.type === "ArrayExpression" ? e.elements : e.type === "ObjectExpression" ? e.properties : e.arguments;
1
+ import { getListRemovalRange as e } from "./get-list-removal-range.js";
2
+ function t(t, n, r) {
3
+ let i = e(t, n, r), { text: a } = t;
4
+ return a.slice(n.start, i.start) + a.slice(i.end, n.end);
46
5
  }
47
6
  export { t as removeListElement };