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
@@ -2,23 +2,24 @@ import { IsolatedPlan } from '../../types/adapter/isolated-plan.js';
2
2
  import { IsolatedRequest, RunState } from '../../types/run/run-state.js';
3
3
  import { IsolatedResult } from '../../types/adapter/isolated-result.js';
4
4
  /**
5
- * Records what an isolated run reported, unit by unit. A unit is a timeout when
6
- * it exceeded its hit limit; a hang, or a test or suite hook that ran out of
7
- * time after the mutant was reached, waits for a confirmation with doubled
8
- * bounds, or is final when the unit was one; a crash, a load error, a failed
9
- * suite hook or file teardown in a unit that reached the mutant, or a test that
10
- * failed or threw a stray error after the mutant was reached kills; a unit that
11
- * reached the mutant and passed is survived evidence. The dry run had no failed
12
- * suite hook, since one fails the dry run. Stray errors of tests and test files
13
- * that had them in the dry run prove nothing. A unit without facts is planned
14
- * once more, then gives an `Error` verdict unless another file has evidence.
15
- * The verdict of a mutant follows `decideEvidence`: the kill or timeout of its
16
- * first test file in the order of `routeIsolated` that has one, once every file
17
- * before it is done; a timeout waiting for its confirmation or a unit waiting
18
- * for its retry holds back the evidence of later files, so the verdict does not
19
- * depend on which files ran together. Kills and reached passes go to the cache
20
- * of the run, which keeps only what it may reuse. The cost of a unit counts the
21
- * start of its process too.
5
+ * Records what an isolated run reported, unit by unit. A unit that exceeded its
6
+ * hit limit, a hang, or a test or suite hook that ran out of time after the
7
+ * mutant was reached is a timeout that waits for a confirmation with doubled
8
+ * time, and past the hit limit with a raised one, or is final when the unit was
9
+ * one (`getUnitEvidence`); a crash, a load error, a failed suite hook or file
10
+ * teardown in a unit that reached the mutant, or a test that failed or threw a
11
+ * stray error after the mutant was reached kills; a unit that reached the
12
+ * mutant and passed is survived evidence. The dry run had no failed suite hook,
13
+ * since one fails the dry run. Stray errors of tests and test files that had
14
+ * them in the dry run prove nothing. A unit without facts is planned once more,
15
+ * then gives an `Error` verdict unless another file has evidence. The verdict
16
+ * of a mutant follows `decideEvidence`: the kill or timeout of its first test
17
+ * file in the order of `routeIsolated` that has one, once every file before it
18
+ * is done; a timeout waiting for its confirmation or a unit waiting for its
19
+ * retry holds back the evidence of later files, so the verdict does not depend
20
+ * on which files ran together. Kills and reached passes go to the cache of the
21
+ * run, which keeps only what it may reuse. The cost of a unit counts the start
22
+ * of its process too.
22
23
  *
23
24
  * @param state - State of the run, updated in place.
24
25
  * @param planned - The plan the run executed and the requests it was built
@@ -23,6 +23,7 @@ function i(n, r, i) {
23
23
  let h = t(m, o);
24
24
  c.survived ||= m === "survived", c.evidence.set(o.file, h), h === "confirming" && u.push({
25
25
  ...o,
26
+ raised: typeof m == "object" && m?.cause === "hit-limit",
26
27
  confirming: !0,
27
28
  retried: !1
28
29
  });
@@ -3,14 +3,15 @@ import { TryVerdict } from '../../types/run/try-verdict.js';
3
3
  import { TryFacts } from '../../types/adapter/try-facts.js';
4
4
  /**
5
5
  * Classifies the raw facts of one try. In order: more site evaluations than the
6
- * hit limit is a timeout, since only a loop through sites gets there; a try
7
- * that ran out of time is a timeout when it reached the mutant; stray errors
8
- * make a batch try doubtful, since orphaned work of an earlier try may throw
9
- * them, and kill on the isolated path when the try reached the mutant; a
10
- * failure kills when the try reached the mutant; a pass, or a skip, survives
11
- * when it reached the mutant. A try that failed, ran out of time or had stray
12
- * errors without reaching the mutant is doubtful; one that passed without
13
- * reaching it is unreached.
6
+ * hit limit is a timeout, whether a mutant made a loop through sites endless or
7
+ * only made code far hotter, which its confirmation tells apart; a try that ran
8
+ * out of time is a timeout when it reached the mutant; stray errors make a
9
+ * batch try doubtful, since orphaned work of an earlier try may throw them, and
10
+ * kill on the isolated path when the try reached the mutant; a failure kills
11
+ * when the try reached the mutant; a pass, or a skip, survives when it reached
12
+ * the mutant. A try that failed, ran out of time or had stray errors without
13
+ * reaching the mutant is doubtful; one that passed without reaching it is
14
+ * unreached.
14
15
  *
15
16
  * @param facts - Facts the adapter reported for the try.
16
17
  * @param limits - Limits the try ran with.
@@ -0,0 +1,13 @@
1
+ import { TryLimits } from '../../types/adapter/try-limits.js';
2
+ import { RunState } from '../../types/run/run-state.js';
3
+ /**
4
+ * Computes the limits of running a whole test file with a mutant, as an
5
+ * isolated unit does: those of loading the file and its suite hooks and of one
6
+ * try of every test of the file, added up.
7
+ *
8
+ * @param state - State of the run.
9
+ * @param file - Key of the test file (`getTestFileKey`).
10
+ * @param scale - 1, or 2 to confirm a timeout.
11
+ * @returns Hit limit and timeout of the whole file.
12
+ */
13
+ export declare function getTestFileLimits(state: RunState, file: string, scale: number): TryLimits;
@@ -0,0 +1,13 @@
1
+ import { getTryLimits as e } from "./get-try-limits.js";
2
+ function t(t, n, r) {
3
+ let { analysis: i, limits: a } = t, o = e(i.loads.get(n) ?? {
4
+ duration: 0,
5
+ hits: 0
6
+ }, a, r), s = i.fileTests.get(n);
7
+ if (s !== void 0) for (let t of s) {
8
+ let n = e(i.baselines.get(t), a, r);
9
+ o.hitLimit += n.hitLimit, o.timeout += n.timeout;
10
+ }
11
+ return o;
12
+ }
13
+ export { t as getTestFileLimits };
@@ -3,9 +3,12 @@ import { MutantVerdict } from '../../types/run/mutant-state.js';
3
3
  import { IsolatedRequest } from '../../types/run/run-state.js';
4
4
  /**
5
5
  * Turns the outcome of an isolated unit into the evidence of its test file: a
6
- * timer or hang timeout of a unit that does not confirm one yet waits for its
7
- * confirmation, a reached pass and a unit that decided nothing are done without
8
- * a verdict, and any other verdict stands.
6
+ * timeout waits for its confirmation, unless the unit confirmed one with what
7
+ * stopped it: a timer or a hang in any confirming unit, the hit limit only in
8
+ * one with the raised limit, since a mutant that only makes code hotter goes
9
+ * over the hit limit too, also when the doubled time of a timer's confirmation
10
+ * lets it reach its hot code; a reached pass and a unit that decided nothing
11
+ * are done without a verdict, and any other verdict stands.
9
12
  *
10
13
  * @param verdict - Outcome of the unit (`readIsolatedUnit`).
11
14
  * @param request - Mutant and test file of the unit.
@@ -1,4 +1,4 @@
1
1
  function e(e, t) {
2
- return e === "survived" || e === null ? "none" : e.status === "Timeout" && (e.cause === "time-limit" || e.cause === "hang") && !t.confirming ? "confirming" : e;
2
+ return e === "survived" || e === null ? "none" : !(e.cause === "hit-limit" ? t.raised : t.confirming) && e.status === "Timeout" ? "confirming" : e;
3
3
  }
4
4
  export { e as getUnitEvidence };
@@ -5,12 +5,15 @@ import { PlannedTry, RunState } from '../../types/run/run-state.js';
5
5
  * with limits from the dry run, one unit per test file. The adapter never runs
6
6
  * two units of one test file at once, as a plain run of the test runner never
7
7
  * runs a test file twice at once, so splitting a file would only load it more
8
- * often. A run that confirms timeouts gets doubled bounds and half the workers,
9
- * so the tries compete less for the processor.
8
+ * often. A run that confirms timeouts gives each test twice the time limit of
9
+ * its whole test file (`getTestFileLimits`), as an isolated unit that confirms
10
+ * a timeout has: a test slowed past its own limit may still fit in the time of
11
+ * its file and pass there. It also gets half the workers, so the tries compete
12
+ * less for the processor.
10
13
  *
11
14
  * @param state - State of the run.
12
15
  * @param tries - Mutants to try in tests.
13
- * @param scale - 1, or 2 to confirm timeouts with doubled bounds.
16
+ * @param scale - 1, or 2 to confirm timeouts.
14
17
  * @returns Units sorted by test file, and the workers the run may use.
15
18
  */
16
19
  export declare function planBatch(state: RunState, tries: readonly PlannedTry[], scale: number): BatchPlan;
@@ -1,48 +1,53 @@
1
- import { compareCodeUnits as e } from "../compare-code-units.js";
2
- import { getTestFileKey as t } from "./get-test-file-key.js";
3
- import { getTryLimits as n } from "./get-try-limits.js";
4
- function r(n, r, a) {
5
- let { analysis: o } = n, s = /* @__PURE__ */ new Map();
6
- for (let { mutant: e, test: n } of r) {
7
- let r = t(o.tests.get(n)), i = s.get(r) ?? /* @__PURE__ */ new Map();
1
+ import { getTestFileLimits as e } from "./get-test-file-limits.js";
2
+ import { compareCodeUnits as t } from "../compare-code-units.js";
3
+ import { getTestFileKey as n } from "./get-test-file-key.js";
4
+ import { getTryLimits as r } from "./get-try-limits.js";
5
+ function i(e, r, i) {
6
+ let { analysis: o } = e, s = /* @__PURE__ */ new Map();
7
+ for (let { mutant: e, test: t } of r) {
8
+ let r = n(o.tests.get(t)), i = s.get(r) ?? /* @__PURE__ */ new Map();
8
9
  s.set(r, i);
9
- let a = i.get(n) ?? [];
10
- i.set(n, a), a.includes(e) || a.push(e);
10
+ let a = i.get(t) ?? [];
11
+ i.set(t, a), a.includes(e) || a.push(e);
11
12
  }
12
- let c = [...s].toSorted(([t], [n]) => e(t, n)).map(([e, t]) => i(n, {
13
- tests: [...t].map(([e, t]) => ({
13
+ let c = [...s].toSorted(([e], [n]) => t(e, n)).map(([t, n]) => a(e, {
14
+ tests: [...n].map(([e, t]) => ({
14
15
  mutants: t,
15
16
  id: e
16
17
  })).toSorted((e, t) => o.order.get(e.id) - o.order.get(t.id)),
17
- key: e
18
- }, a));
18
+ key: t
19
+ }, i));
19
20
  return {
20
- concurrency: a > 1 ? Math.max(1, Math.floor(n.workers / 2)) : n.workers,
21
+ concurrency: i > 1 ? Math.max(1, Math.floor(e.workers / 2)) : e.workers,
21
22
  units: c
22
23
  };
23
24
  }
24
- function i(e, t, r) {
25
- let { analysis: i, limits: a } = e, { tests: o, key: s } = t, c = n(i.loads.get(s) ?? {
25
+ function a(t, n, i) {
26
+ let { analysis: a, limits: o } = t, { tests: s, key: c } = n, l = r(a.loads.get(c) ?? {
26
27
  duration: 0,
27
28
  hits: 0
28
- }, a, r), l = o.map((e) => ({
29
- ...n(i.baselines.get(e.id), a, r),
30
- mutants: e.mutants,
31
- id: e.id
32
- })), u = i.fileTests.get(s), d = u.indexOf(o.at(-1).id), f = c.timeout, p = u.slice(0, d + 1);
33
- for (let e of p) {
34
- let t = l.find((t) => t.id === e);
35
- f += t === void 0 ? n(i.baselines.get(e), a, r).timeout : t.timeout * (2 * t.mutants.length + 1);
29
+ }, o, i), u = i > 1 ? e(t, c, i) : null, d = s.map((e) => {
30
+ let t = r(a.baselines.get(e.id), o, i);
31
+ return {
32
+ timeout: u?.timeout ?? t.timeout,
33
+ hitLimit: t.hitLimit,
34
+ mutants: e.mutants,
35
+ id: e.id
36
+ };
37
+ }), f = a.fileTests.get(c), p = f.indexOf(s.at(-1).id), m = l.timeout, h = f.slice(0, p + 1);
38
+ for (let e of h) {
39
+ let t = d.find((t) => t.id === e);
40
+ m += t === void 0 ? r(a.baselines.get(e), o, i).timeout : t.timeout * (2 * t.mutants.length + 1);
36
41
  }
37
- let { project: m, file: h } = i.testFiles.get(s);
42
+ let { project: g, file: _ } = a.testFiles.get(c);
38
43
  return {
39
44
  limits: {
40
- total: f,
41
- load: c
45
+ total: m,
46
+ load: l
42
47
  },
43
- project: m,
44
- tests: l,
45
- file: h
48
+ project: g,
49
+ tests: d,
50
+ file: _
46
51
  };
47
52
  }
48
- export { r as planBatch };
53
+ export { i as planBatch };
@@ -4,7 +4,9 @@ import { IsolatedPlan } from '../../types/adapter/isolated-plan.js';
4
4
  * Plans one isolated run: a unit per request on its whole test file, with
5
5
  * limits that add up the work outside tries (loading the file and its suite
6
6
  * hooks) and one try of every test of the file. Units that confirm a timeout
7
- * get doubled bounds.
7
+ * get doubled time, and one that confirms a hit-limit timeout `factor × floor`
8
+ * more site evaluations, the same room for any test, as the time a test took,
9
+ * its hooks and waits included, does not tell how fast it evaluates sites.
8
10
  *
9
11
  * @param state - State of the run.
10
12
  * @param requests - Mutants and test files to run, in order.
@@ -1,21 +1,15 @@
1
- import { getTryLimits as e } from "./get-try-limits.js";
1
+ import { getTestFileLimits as e } from "./get-test-file-limits.js";
2
2
  function t(t, n) {
3
3
  let { analysis: r, limits: i } = t;
4
- return { units: n.map((t) => {
5
- let n = t.confirming ? 2 : 1, a = e(r.loads.get(t.file) ?? {
6
- duration: 0,
7
- hits: 0
8
- }, i, n), o = r.fileTests.get(t.file);
9
- if (o !== void 0) for (let t of o) {
10
- let o = e(r.baselines.get(t), i, n);
11
- a.hitLimit += o.hitLimit, a.timeout += o.timeout;
12
- }
13
- let { project: s, file: c } = r.testFiles.get(t.file);
4
+ return { units: n.map((n) => {
5
+ let a = e(t, n.file, n.confirming ? 2 : 1);
6
+ n.raised && (a.hitLimit += i.hitLimit.factor * i.hitLimit.floor);
7
+ let { project: o, file: s } = r.testFiles.get(n.file);
14
8
  return {
15
- mutant: t.mutant,
9
+ mutant: n.mutant,
16
10
  limits: a,
17
- project: s,
18
- file: c
11
+ project: o,
12
+ file: s
19
13
  };
20
14
  }) };
21
15
  }
@@ -8,10 +8,10 @@ import { IsolatedUnit } from '../../types/adapter/isolated-plan.js';
8
8
  * mutant, once the unit reached it anywhere. A unit past its hit limit is a
9
9
  * timeout of the failed test with the most hits, the first of them on a tie:
10
10
  * that one ran into the limit, while a test that failed before it says nothing
11
- * of the loop, and one after it throws at its first site, as the count of the
12
- * unit stays over the limit. With no failed test, the limit stopped the load or
13
- * a hook, whose error is the message. A hang names no test, as no adapter
14
- * reports the try that hung.
11
+ * of the overrun, and one after it throws at its first site, as the count of
12
+ * the unit stays over the limit. With no failed test, the limit stopped the
13
+ * load or a hook, whose error is the message. A hang names no test, as no
14
+ * adapter reports the try that hung.
15
15
  *
16
16
  * @param state - State of the run.
17
17
  * @param mutant - State of the unit's mutant.
@@ -6,9 +6,10 @@ import { RunState } from '../../types/run/run-state.js';
6
6
  * all their other covering tests. Tries that go missing are planned again in at
7
7
  * most two recovery runs per phase, then the mutant runs isolated. A mutant
8
8
  * that only ran out of time skips phase 2; the confirmation run tries those
9
- * again with doubled bounds and half the workers. Batch decides kills and
10
- * timeouts only: every mutant left undecided runs isolated, as a
11
- * `batch-survivor` when a batch try reached it and passed, else as `doubtful`.
9
+ * again with twice the time of their whole test file and half the workers.
10
+ * Batch decides kills and timer or hang timeouts only: every mutant left
11
+ * undecided runs isolated, as a `batch-survivor` when a batch try reached it
12
+ * and passed, else as `doubtful`.
12
13
  *
13
14
  * @param session - Live test runner.
14
15
  * @param state - State of the run, updated in place.
@@ -12,8 +12,8 @@ interface DryPhaseInput {
12
12
  */
13
13
  mutantFiles: Map<string, string>;
14
14
  /**
15
- * Receives `dry-start` as the dry phase starts and a `note` as each later dry
16
- * run starts.
15
+ * Receives `dry-start` as the dry phase starts, a `dry-again` before each
16
+ * later dry run, and `dry-failed` before failing tests stop the run.
17
17
  */
18
18
  report(event: RunEvent): void;
19
19
  /**
@@ -25,6 +25,13 @@ interface DryPhaseInput {
25
25
  * place before the dry run is repeated.
26
26
  */
27
27
  switched: SwitchedFile[];
28
+ /**
29
+ * Absolute paths of the files the dry runs relate tests to: the switched
30
+ * files and, in a run of some mutants, the other files a run of every mutant
31
+ * would switch, which are served as they are. Files that break tests are left
32
+ * out of the repeated dry run.
33
+ */
34
+ related: string[];
28
35
  /**
29
36
  * Whether every test is tried twice in a row, as fast mode needs to tell
30
37
  * stable mutants and repeatable tests; otherwise each test runs once.
@@ -50,7 +57,9 @@ interface DryPhase {
50
57
  */
51
58
  errors: Map<string, string>;
52
59
  /**
53
- * `instrumentation-break`, `instrument-error` and `never-served` diagnostics.
60
+ * `instrumentation-break`, `instrument-error` and `never-served` diagnostics,
61
+ * and outside fast mode an `unrepeatable-test` warning for each failure of a
62
+ * test file that passed when it ran again.
54
63
  */
55
64
  diagnostics: Diagnostic[];
56
65
  /**
@@ -63,24 +72,31 @@ interface DryPhase {
63
72
  runs: number;
64
73
  }
65
74
  /**
66
- * Runs the tests related to the switched files without a mutant, each once, or
67
- * in fast mode (`repeat`) twice in a row. In fast mode, when tests fail or
68
- * files fail to load, their test files run again with each test once, as a
69
- * plain run of the test runner does: a try can leave state, such as a counter
70
- * or collected results, that fails the next test or a suite hook only because
71
- * the tests were repeated. Test files that pass then keep the results of that
72
- * run and are unrepeatable: every mutant their tests reach runs isolated.
73
- * Failures that remain run again without the switched files: failures that
74
- * remain are real and stop the run; the others come from the instrumentation,
75
- * so the switched files they reached are dropped with an
76
- * `instrumentation-break` error and the dry run is repeated once. Files whose
77
- * loaded text differed get an `instrument-error`, files never served a
78
- * `never-served` warning. Without related tests the dry run is empty, so every
79
- * mutant ends without coverage. A dry run whose worker hung past its budget
80
- * (`DRY_TIMEOUTS`) stops the run with the test it hung in.
75
+ * Runs the tests related to the given files (`related`) without a mutant, each
76
+ * once, or in fast mode (`repeat`) twice in a row. When tests fail or files
77
+ * fail to load, their test files run again with the same switched files and
78
+ * each test once, as a plain run of the test runner does. In fast mode a try
79
+ * can leave state, such as a counter or collected results, that fails the next
80
+ * test or a suite hook only because the tests were repeated: test files that
81
+ * pass then keep the results of that run and are unrepeatable, so every mutant
82
+ * their tests reach runs isolated. Outside fast mode a test file that passes
83
+ * then may be flaky, such as one that waits for a port or a resource: it keeps
84
+ * the results of that run, and each of its failures gets an `unrepeatable-test`
85
+ * warning. Failures that remain run again without the switched files: failures
86
+ * that remain are real and stop the run; the others come from the
87
+ * instrumentation (`findBrokenFiles`). The switched files they break are
88
+ * dropped with an `instrumentation-break` error that names a failure, and while
89
+ * switched files are left the dry run is repeated once, with its own second run
90
+ * of failed test files. So the phase takes one dry run when nothing fails, and
91
+ * at most five. Files whose loaded text differed get an `instrument-error`,
92
+ * files never served a `never-served` warning. Without related tests the dry
93
+ * run is empty, so every mutant ends without coverage. A dry run whose worker
94
+ * hung past its budget (`DRY_TIMEOUTS`) stops the run with the test it hung
95
+ * in.
81
96
  *
82
97
  * @param session - Live test runner.
83
- * @param input - Switched files, mutant files, display paths and progress.
98
+ * @param input - Switched and related files, mutant files, display paths and
99
+ * progress.
84
100
  * @returns Final dry run, failed files, unrepeatable test files, diagnostics
85
101
  * and the number of runs.
86
102
  * @throws Error - When tests fail without the switched files, when tests still