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
@@ -3,6 +3,7 @@ import { ListReportMutator } from './list-report-mutator.js';
3
3
  import { IsolatedReason } from '../run/isolated-reason.js';
4
4
  import { IgnoreSource } from '../mutant/ignore-source.js';
5
5
  import { SkipCategory } from '../mutant/skip-category.js';
6
+ import { MutantKind } from '../mutant/mutant-kind.js';
6
7
  import { Diagnostic } from '../mutant/diagnostic.js';
7
8
  import { RunStatus } from '../run/run-status.js';
8
9
  import { TryCause } from '../run/try-cause.js';
@@ -15,7 +16,8 @@ import { TryCause } from '../run/try-cause.js';
15
16
  export interface HtmlReportMutant {
16
17
  /**
17
18
  * Part of the range the change amounts to, as offsets and the text written in
18
- * its place, when the mutator names one.
19
+ * its place, when the mutator names one or the mutant removes an array
20
+ * element or an object member.
19
21
  */
20
22
  focus?: { replacement: string; start: number; end: number }
21
23
 
@@ -26,6 +28,11 @@ export interface HtmlReportMutant {
26
28
  */
27
29
  testFiles?: [file: number, tests: number][]
28
30
 
31
+ /**
32
+ * How the mutant is switched on (see `MutantKind`); absent for an expression.
33
+ */
34
+ kind?: Exclude<MutantKind, 'expression'>
35
+
29
36
  /**
30
37
  * Lengths of the start and the end of the original that the replacement
31
38
  * keeps, when storing only the text between them is shorter.
@@ -111,11 +118,6 @@ export interface HtmlReportMutant {
111
118
  */
112
119
  scope?: number
113
120
 
114
- /**
115
- * `block` for a mutant that replaces a block; absent for an expression.
116
- */
117
- kind?: 'block'
118
-
119
121
  /**
120
122
  * Whether the verdict came from the cache.
121
123
  */
@@ -156,7 +158,8 @@ export interface HtmlReportSkipped {
156
158
 
157
159
  /**
158
160
  * Part of the range the change amounts to, as offsets and the text written in
159
- * its place, when the mutator names one.
161
+ * its place, when the mutator names one or the mutant removes an array
162
+ * element or an object member.
160
163
  */
161
164
  focus?: { replacement: string; start: number; end: number }
162
165
 
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Part of a mutant's range that the mutant changes, such as the edited part of
3
- * a regular expression pattern. Apply the mutant with `original` and
4
- * `replacement` of the mutant; the focus only says where to look.
3
+ * a regular expression pattern or a removed array element without its comma.
4
+ * Apply the mutant with `original` and `replacement` of the mutant; the focus
5
+ * only says where to look.
5
6
  */
6
7
  export interface ListReportFocus {
7
8
  /**
@@ -15,12 +15,14 @@ export interface ListReportJustifier {
15
15
  mutator: string
16
16
 
17
17
  /**
18
- * 1-based UTF-16 column of the node the justifying mutant replaces.
18
+ * 1-based UTF-16 column of the justifying mutant: of its focus, or of the
19
+ * range it replaces when it has none.
19
20
  */
20
21
  column: number
21
22
 
22
23
  /**
23
- * 1-based line of the node the justifying mutant replaces.
24
+ * 1-based line of the justifying mutant: of its focus, or of the range it
25
+ * replaces when it has none.
24
26
  */
25
27
  line: number
26
28
  }
@@ -2,6 +2,7 @@ import { IgnoreSource } from '../mutant/ignore-source.js';
2
2
  import { MutantStatus } from '../mutant/mutant-status.js';
3
3
  import { ListReportFocus } from './list-report-focus.js';
4
4
  import { ListReportDiff } from './list-report-diff.js';
5
+ import { MutantKind } from '../mutant/mutant-kind.js';
5
6
  /**
6
7
  * Mutant as an agent needs it, without reading the file, with its source lines
7
8
  * before and after it is applied.
@@ -13,14 +14,10 @@ export interface ListReportMutant extends ListReportDiff {
13
14
  ignoredBy: IgnoreSource | null
14
15
 
15
16
  /**
16
- * How the mutant will be switched on, and so how to apply it: wrap the
17
- * replacement in parentheses for `expression`, in braces for `block`.
18
- */
19
- kind: 'expression' | 'block'
20
-
21
- /**
22
- * Part of the range the change amounts to, present when the mutator names
23
- * one; text reports show its position and texts.
17
+ * Part of the range the change amounts to, present when the mutator names one
18
+ * and on every mutant of kind `element` or `property`; text reports show its
19
+ * position and texts, and ignore directives cover a mutant of those kinds at
20
+ * its line.
24
21
  */
25
22
  focus?: ListReportFocus
26
23
 
@@ -50,13 +47,22 @@ export interface ListReportMutant extends ListReportDiff {
50
47
  */
51
48
  endColumn: number
52
49
 
50
+ /**
51
+ * How the mutant will be switched on, and so how to apply it: wrap the
52
+ * replacement in parentheses for `expression`, and these in braces in place
53
+ * of a quoted JSX attribute value, as in `type={("")}`; in braces for
54
+ * `block`; and write it as is for `element` and `property`, which remove an
55
+ * array element or an object member with its comma.
56
+ */
57
+ kind: MutantKind
58
+
53
59
  /**
54
60
  * Source text the mutant replaces.
55
61
  */
56
62
  original: string
57
63
 
58
64
  /**
59
- * 1-based line of the last replaced character.
65
+ * 1-based line of the offset just past the last replaced character.
60
66
  */
61
67
  endLine: number
62
68
 
@@ -11,8 +11,9 @@ export interface ListReportSkipped {
11
11
  by: ListReportJustifier | null
12
12
 
13
13
  /**
14
- * Part of the range the change amounts to, present when the mutator names
15
- * one; text reports show its position and texts.
14
+ * Part of the range the change amounts to, present when the mutator names one
15
+ * and on every removal of an array element or an object member with its
16
+ * comma; text reports show its position and texts.
16
17
  */
17
18
  focus?: ListReportFocus
18
19
 
@@ -52,7 +52,7 @@ export interface ListReport {
52
52
  * Version of this schema. It changes when a field changes meaning or is
53
53
  * removed; new fields do not change it.
54
54
  */
55
- schemaVersion: 3
55
+ schemaVersion: 4
56
56
 
57
57
  /**
58
58
  * Command that produced the report.
@@ -117,7 +117,7 @@ export interface RunReportSummary {
117
117
 
118
118
  /**
119
119
  * Tests whose two dry tries differed in pass/fail or stray errors, or null
120
- * outside fast mode, which does not check.
120
+ * outside fast mode.
121
121
  */
122
122
  totalUnrepeatableTests: number | null
123
123
 
@@ -289,7 +289,7 @@ export interface RunReport {
289
289
  * Version of the report shape. It changes when a field changes meaning or is
290
290
  * removed; new fields do not change it.
291
291
  */
292
- schemaVersion: 3
292
+ schemaVersion: 4
293
293
 
294
294
  /**
295
295
  * Command that produced the report.
@@ -40,7 +40,7 @@ export interface SlimListReport {
40
40
  /**
41
41
  * Version of the report shape, the same as of the full report.
42
42
  */
43
- schemaVersion: 3
43
+ schemaVersion: 4
44
44
 
45
45
  /**
46
46
  * Command that produced the report.
@@ -70,7 +70,9 @@ export interface SlimListReportMutant extends Pick<
70
70
  ignoredBy?: NonNullable<ListReportMutant['ignoredBy']>
71
71
 
72
72
  /**
73
- * Part of the range the change amounts to, when the mutator names one.
73
+ * Part of the range the change amounts to, when the mutator names one or the
74
+ * mutant removes an array element or an object member with its comma, which
75
+ * ignore directives then cover at the line of the focus.
74
76
  */
75
77
  focus?: SlimReportFocus
76
78
 
@@ -99,7 +101,8 @@ export interface SlimListReportSkipped extends Omit<
99
101
  by?: NonNullable<ListReportSkipped['by']>
100
102
 
101
103
  /**
102
- * Part of the range the change amounts to, when the mutator names one.
104
+ * Part of the range the change amounts to, when the mutator names one or the
105
+ * change removes an array element or an object member with its comma.
103
106
  */
104
107
  focus?: SlimReportFocus
105
108
  }
@@ -141,7 +141,7 @@ export interface SlimRunReport extends Pick<
141
141
  /**
142
142
  * Version of the report shape, the same as of the full report.
143
143
  */
144
- schemaVersion: 3
144
+ schemaVersion: 4
145
145
 
146
146
  /**
147
147
  * Command that produced the report.
@@ -6,9 +6,10 @@
6
6
  * tries;
7
7
  * - `unrepeatable`: in fast mode, a covering test passed once and failed once
8
8
  * without a mutant, or had stray errors;
9
- * - `doubtful`: a batch try could not decide it (see `TryVerdict`), a control try
10
- * next to its kill failed, a late error followed its try, a suite hook of its
11
- * batch unit failed, or no batch try reached it;
9
+ * - `doubtful`: a batch try could not decide it (see `TryVerdict`) or went over
10
+ * its hit limit, a control try next to its kill failed, a late error followed
11
+ * its try, a suite hook of its batch unit failed, or no batch try reached
12
+ * it;
12
13
  * - `batch-survivor`: it passed every batch try that reached it; batch passes are
13
14
  * not trusted, so a fresh module graph with its whole covering test files
14
15
  * decides whether it survives;
@@ -8,7 +8,7 @@ import { TryCause } from './try-cause.js';
8
8
  export interface MutantState {
9
9
  /**
10
10
  * Batch tries that ran out of time with it and wait for a confirmation with
11
- * doubled bounds.
11
+ * twice the time of their whole test file.
12
12
  */
13
13
  confirm: { cause: 'time-limit' | 'hang'; test: string }[]
14
14
 
@@ -221,7 +221,7 @@ export type RunEvent =
221
221
  kind: 'dry-start'
222
222
 
223
223
  /**
224
- * Mutated files whose related tests run.
224
+ * Switched files of the dry run.
225
225
  */
226
226
  files: number
227
227
  }
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * Kind of a run of the test runner:
3
3
  *
4
- * - `dry`: the tests without a mutant, each twice;
4
+ * - `dry`: the tests without a mutant, and the reruns of failed test files;
5
5
  * - `batch`: a batch phase;
6
6
  * - `recovery`: batch tries that went missing, planned again;
7
- * - `confirmation`: batch timeouts tried again with doubled bounds;
7
+ * - `confirmation`: batch timeouts tried again with twice the time of their whole
8
+ * test file;
8
9
  * - `isolated`: isolated units.
9
10
  */
10
11
  export type RunKind = 'confirmation' | 'recovery' | 'isolated' | 'batch' | 'dry'
@@ -19,8 +19,7 @@ export interface RunResult {
19
19
 
20
20
  /**
21
21
  * Ids of the tests whose two dry tries differed in pass/fail or had stray
22
- * errors, sorted; null outside fast mode, which tries each test once and does
23
- * not check.
22
+ * errors, sorted; null outside fast mode, which tries each test once.
24
23
  */
25
24
  unrepeatable: string[] | null
26
25
 
@@ -90,7 +89,11 @@ export interface RunResult {
90
89
 
91
90
  /**
92
91
  * Whether verdicts were reused from and saved to the cache: false with
93
- * `--no-cache`, `run.cache: false`, or an adapter without cache support.
92
+ * `--no-cache`, `run.cache: false`, an adapter without cache support, and
93
+ * when no test file has a key, as when after the dry run a file every verdict
94
+ * depends on, other than one the tests read and wrote themselves, has a
95
+ * modification time at or after the start of the run, which a `cache-skipped`
96
+ * warning names.
94
97
  */
95
98
  cache: boolean
96
99
 
@@ -90,6 +90,12 @@ export interface IsolatedRequest {
90
90
  */
91
91
  retried: boolean
92
92
 
93
+ /**
94
+ * Whether the unit confirms a hit-limit timeout, with `factor × floor` more
95
+ * site evaluations than planned.
96
+ */
97
+ raised: boolean
98
+
93
99
  /**
94
100
  * Id of the mutant.
95
101
  */
@@ -112,7 +118,9 @@ export interface LimitSettings {
112
118
  timeout: { constant: number; factor: number }
113
119
 
114
120
  /**
115
- * Hit limit per try: `max(floor, factor × dry hits)`.
121
+ * Hit limit of a try or of loading a test file: `max(floor, factor × dry
122
+ * hits)`. A unit that confirms a hit-limit timeout gets `factor × floor`
123
+ * more.
116
124
  */
117
125
  hitLimit: { factor: number; floor: number }
118
126
  }
@@ -2,8 +2,8 @@
2
2
  * Final state of a mutant after a run:
3
3
  *
4
4
  * - `Killed`: a test failed with the mutant active (`cause` tells how);
5
- * - `Timeout`: a test did not finish (hit limit, or timer or hang confirmed with
6
- * doubled bounds); counts as detected;
5
+ * - `Timeout`: a test did not finish (hit limit, timer or hang, each confirmed by
6
+ * a second run); counts as detected;
7
7
  * - `Survived`: every test of the test files that cover it passed in a fresh
8
8
  * module graph, and one of them reached it (always the isolated path);
9
9
  * - `NoCoverage`: no test reached it;
@@ -2,18 +2,20 @@
2
2
  * How a mutant was detected:
3
3
  *
4
4
  * - `assertion`: a test or hook failed;
5
- * - `stray-error`: an unhandled error (isolated path only; in batch it makes the
6
- * try doubtful);
5
+ * - `stray-error`: an unhandled error that the test runner counts (isolated path
6
+ * only; in batch it makes the try doubtful);
7
7
  * - `load-error`: the test file failed to load with the mutant active;
8
8
  * - `hook-error`: a suite hook (such as `beforeAll`/`before`, `afterAll`/`after`,
9
9
  * `aroundAll`) or the file teardown, such as the cleanup of a worker-scoped
10
10
  * fixture or the teardown of the test environment, failed with the mutant
11
11
  * active, or the test file failed outside its tests (isolated path);
12
12
  * - `crash`: the worker died with the mutant active (isolated path);
13
- * - `hit-limit`: the hit counter stopped a loop;
14
- * - `time-limit`: a timer fired (confirmed with doubled bounds);
15
- * - `hang`: the watchdog stopped a worker stuck with the mutant active (confirmed
16
- * like `time-limit`).
13
+ * - `hit-limit`: the hit counter stopped a loop or far hotter code (confirmed
14
+ * with doubled time and `factor × floor` more evaluations);
15
+ * - `time-limit`: a timer stopped stuck or far slower code (confirmed with
16
+ * doubled time);
17
+ * - `hang`: the watchdog stopped a worker that was stuck or far slower with the
18
+ * mutant active (confirmed like `time-limit`).
17
19
  */
18
20
  export type TryCause =
19
21
  | 'stray-error'
@@ -178,7 +178,9 @@ export interface SyntaxHelpers {
178
178
 
179
179
  /**
180
180
  * Whether a replacement may stand in place of the node: an expression whose
181
- * value is read and that the mutant switch can wrap.
181
+ * value is read and that the mutant switch can wrap. A quoted JSX attribute
182
+ * value is not one, though a plain string may replace it (see
183
+ * `Replacement.node`).
182
184
  */
183
185
  isValuePosition(node: Node): boolean
184
186
 
@@ -252,8 +254,8 @@ export interface SyntaxHelpers {
252
254
 
253
255
  /**
254
256
  * Whether the node is part of the runtime tree of the file. Scope analysis
255
- * also sees nodes outside it, such as ambient declarations and the arguments
256
- * of logging calls, which the tree-bound helpers do not accept.
257
+ * also sees nodes outside it, such as ambient declarations and module
258
+ * specifiers, which the tree-bound helpers do not accept.
257
259
  */
258
260
  isRuntimeNode(node: Node): boolean
259
261
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mootant",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Mutation testing tool that ships with an agent skill for finding and fixing weak tests",
5
5
  "keywords": [
6
6
  "mutation-testing",
@@ -16,7 +16,7 @@
16
16
  "jest",
17
17
  "node-test"
18
18
  ],
19
- "homepage": "https://github.com/azat-io/mootant",
19
+ "homepage": "https://mootant.org",
20
20
  "repository": "azat-io/mootant",
21
21
  "license": "MIT",
22
22
  "author": "Azat S. <to@azat.io>",
@@ -53,9 +53,9 @@
53
53
  "./skills"
54
54
  ],
55
55
  "dependencies": {
56
- "@eslint-community/regexpp": "^4.12.2",
57
- "lilconfig": "^3.1.4",
58
- "oxc-parser": "^0.156.0"
56
+ "@eslint-community/regexpp": "^4.12.3",
57
+ "lilconfig": "^3.1.5",
58
+ "oxc-parser": "^0.159.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@vue/compiler-dom": "^3.5.0",
@@ -78,7 +78,7 @@ node -e "const fs=require('fs');fs.mkdirSync('.mootant',{recursive:true});fs.exi
78
78
 
79
79
  # Problems of a run, then one line per mutant
80
80
  node -e "const r=require('./.mootant/before.json');console.log(JSON.stringify({schemaVersion:r.schemaVersion,diagnostics:r.diagnostics,summary:r.summary}))"
81
- node -e "for(const m of require('./.mootant/before.json').mutants)console.log(m.id,m.status,m.file+':'+m.line,m.scope||'-',m.mutator,m.tests)"
81
+ node -e "for(const m of require('./.mootant/before.json').mutants)console.log(m.id,m.status,m.file+':'+(m.focus||m).line,m.scope||'-',m.mutator,m.tests)"
82
82
 
83
83
  # A recheck: the mutant's recheck with <mootant> in place of mootant, always with --no-fast --no-incremental
84
84
  <mootant> run [<paths>] --no-fast --no-incremental --mutant <id> [--mutant <id>] --json --all > .mootant/recheck.json 2> .mootant/recheck.log
@@ -127,9 +127,9 @@ smaller path, list the rest as not reached.
127
127
  when git does not track it.
128
128
  2. **Run once**, as Start says, in the background or with the longest timeout,
129
129
  and wait for the exit. Read its problems. An `Error:` line in the log: report
130
- it with the lines under it and stop. `schemaVersion` other than 3: stop, this
131
- skill does not fit this Mootant. No mutants to act on and no errors: say so
132
- and stop.
130
+ it with the lines under it and stop. `schemaVersion` other than 3 or 4: stop,
131
+ this skill does not fit this Mootant. No mutants to act on and no errors: say
132
+ so and stop.
133
133
  3. **Ledger.** One row per id with verdict `pending`; the report keeps the rest.
134
134
  Over 20 rows: tell the user the counts per file and work file by file in the
135
135
  report's order.
@@ -187,14 +187,16 @@ outputs in a throwaway test and recheck: `Killed` or `Timeout` means you found a
187
187
  real test, so keep it; otherwise delete the throwaway test.
188
188
 
189
189
  An ignore comment hides every mutant of the named mutators on the next line, not
190
- one id. Before you propose `// mootant-ignore-next-line <mutator>: <reason>`,
191
- with mutator names separated by commas and never without one, list what it would
192
- hide with `<mootant> list <file> --json`. Propose it only when each of those
193
- mutants is equivalent, and show the user each one with its reason. When the user
194
- approves, add the comment and list the file again: the new `Ignored` mutants
195
- must be exactly the ones you showed, with no `malformed-directive` or
196
- `unknown-mutator` in `diagnostics`. A coarse mutant that comes back gets its own
197
- row.
190
+ one id; a mutant is on its `line`, and one of `kind` `element` or `property` on
191
+ the line of its `focus`. Before you propose
192
+ `// mootant-ignore-next-line <mutator>: <reason>`, with mutator names separated
193
+ by commas and never without one, list what it would hide with
194
+ `<mootant> list <file> --json --verbose`, which gives `kind`. Propose it only
195
+ when each of those mutants is equivalent, and show the user each one with its
196
+ reason. When the user approves, add the comment and list the file again: the new
197
+ `Ignored` mutants must be exactly the ones you showed, with no
198
+ `malformed-directive` or `unknown-mutator` in `diagnostics`. A coarse mutant
199
+ that comes back gets its own row.
198
200
 
199
201
  ## Report
200
202
 
@@ -22,7 +22,7 @@ page of each mutator has examples: `https://mootant.org/mutators/<id>`.
22
22
  | `regex-pattern` | Text the pattern must reject; for a removed alternative, a test for each alternative; for an optional part made required, text without that part. |
23
23
  | `return-value` | An exact check of the result, with an input for which the function returns something else; where a call becomes `undefined`, a check of what that call does. |
24
24
  | `statement-removal` | The effect of the statement: state it changes, an error it throws, or a call into another module. |
25
- | `string-literal` | The whole result with `toBe`, for an input that makes the string appear in it. |
25
+ | `string-literal` | The whole result with `toBe`, for an input that makes the string appear in it; for a quoted JSX attribute value, the attribute of the rendered element or a query that finds the element by it. |
26
26
  | `unary-operator` | A value the operator changes: a total other than 0 for `-`, a string such as `'3'` for `+`, a flag set in the value for `~`, a quotient with a fraction for `~~`. |
27
27
  | `update-operator` | An input that reaches the update, and a check of the counter or of the value the update gives; for a postfix update whose value is used, the second value too. |
28
28
 
@@ -41,3 +41,5 @@ domain before you propose an ignore comment:
41
41
  for one.
42
42
  - `update-operator` with prefix and postfix swapped when nothing reads the
43
43
  value, as in `setTimeout(() => attempts++)`.
44
+ - `string-literal` on a quoted `key` that only React reads, when no other
45
+ element in its place has the new key.
@@ -1,9 +0,0 @@
1
- /**
2
- * Builds the check a switched file evaluates at a mutant site. It needs no
3
- * import or declaration: outside mootant's workers the runtime global is
4
- * undefined, the check is `undefined`, and the original code runs.
5
- *
6
- * @param id - Id of the mutant.
7
- * @returns Expression text that is true while the mutant is active.
8
- */
9
- export declare function getSiteCheck(id: string): string;
@@ -1,5 +0,0 @@
1
- import { RUNTIME_GLOBAL as e } from "../runtime/runtime-global.js";
2
- function t(t) {
3
- return `globalThis.${e}?.hit(${JSON.stringify(t)})`;
4
- }
5
- export { t as getSiteCheck };
@@ -1,12 +0,0 @@
1
- /**
2
- * Builds the check a switched Vue template evaluates at a mutant site. The Vue
3
- * compiler reads `globalThis` as a property of the component, so the check
4
- * reaches the runtime through `Math`, which it leaves alone, as it leaves
5
- * `Symbol` since version 3.5. The check is written with backticks, which
6
- * neither quote of an attribute value ends. Outside mootant's workers the
7
- * runtime is undefined, the check is `undefined`, and the original code runs.
8
- *
9
- * @param id - Id of the mutant, made of digits and lowercase letters.
10
- * @returns Expression text that is true while the mutant is active.
11
- */
12
- export declare function getTemplateSiteCheck(id: string): string;
@@ -1,5 +0,0 @@
1
- import { RUNTIME_SYMBOL_KEY as e } from "../runtime/runtime-symbol-key.js";
2
- function t(t) {
3
- return `Math[Symbol.for(\`${e}\`)]?.hit(\`${t}\`)`;
4
- }
5
- export { t as getTemplateSiteCheck };