mootant 0.1.0 → 0.3.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 (487) hide show
  1. package/bin/mootant.js +3 -2
  2. package/dist/adapters/jest/build-dry-file.d.ts +12 -12
  3. package/dist/adapters/jest/collect-jest-dependencies.d.ts +15 -12
  4. package/dist/adapters/jest/collect-jest-dependencies.js +20 -14
  5. package/dist/adapters/jest/get-jest-cache-inputs.d.ts +14 -13
  6. package/dist/adapters/jest/index.d.ts +3 -1
  7. package/dist/adapters/jest/run-dry.js +20 -20
  8. package/dist/adapters/jest/runner.d.ts +1 -1
  9. package/dist/adapters/jest/runner.js +1 -1
  10. package/dist/adapters/jest/start-jest-session.d.ts +6 -2
  11. package/dist/adapters/jest/start-jest-session.js +9 -2
  12. package/dist/adapters/jest/types/jest-handle.d.ts +2 -1
  13. package/dist/adapters/jest/types/jest-record.d.ts +5 -4
  14. package/dist/adapters/jest/types/unit-worker.d.ts +16 -8
  15. package/dist/adapters/jest/types/worker-channel.d.ts +7 -0
  16. package/dist/adapters/jest/types/worker-session.d.ts +6 -7
  17. package/dist/adapters/jest/worker/boot-worker.d.ts +5 -3
  18. package/dist/adapters/jest/worker/create-test-runner.d.ts +4 -1
  19. package/dist/adapters/jest/worker/keep-reset-loads.d.ts +13 -0
  20. package/dist/adapters/jest/worker/list-runtime-files.d.ts +13 -0
  21. package/dist/adapters/jest/worker/run-unit.d.ts +24 -17
  22. package/dist/adapters/jest/worker/vm-setup.js +1 -1
  23. package/dist/adapters/jest/worker/worker.js +1 -1
  24. package/dist/adapters/jest/write-worker-session.d.ts +1 -2
  25. package/dist/adapters/jest/write-worker-session.js +2 -2
  26. package/dist/adapters/node-test/check-typescript.js +2 -2
  27. package/dist/adapters/node-test/collect-node-dependencies.d.ts +7 -5
  28. package/dist/adapters/node-test/collect-node-dependencies.js +26 -20
  29. package/dist/adapters/node-test/create-spare-processes.d.ts +26 -0
  30. package/dist/adapters/node-test/create-spare-processes.js +53 -0
  31. package/dist/adapters/node-test/filter-exec-argv.d.ts +2 -1
  32. package/dist/adapters/node-test/filter-exec-argv.js +13 -12
  33. package/dist/adapters/node-test/get-node-cache-inputs.js +1 -1
  34. package/dist/adapters/node-test/get-unit-deadline.d.ts +6 -5
  35. package/dist/adapters/node-test/index.d.ts +2 -2
  36. package/dist/adapters/node-test/index.js +1 -0
  37. package/dist/adapters/node-test/is-group-alive.d.ts +8 -0
  38. package/dist/adapters/node-test/is-group-alive.js +8 -0
  39. package/dist/adapters/node-test/list-setup-files.js +2 -2
  40. package/dist/adapters/node-test/place-preload.d.ts +2 -1
  41. package/dist/adapters/node-test/place-preload.js +24 -18
  42. package/dist/adapters/node-test/preload/create-commonjs-route.js +1 -1
  43. package/dist/adapters/node-test/preload/preload.js +54 -49
  44. package/dist/adapters/node-test/preload/read-line-sync.d.ts +11 -0
  45. package/dist/adapters/node-test/preload/read-line-sync.js +25 -0
  46. package/dist/adapters/node-test/preload/read-unit.d.ts +11 -5
  47. package/dist/adapters/node-test/preload/read-unit.js +5 -4
  48. package/dist/adapters/node-test/run-isolated.d.ts +19 -10
  49. package/dist/adapters/node-test/run-isolated.js +68 -52
  50. package/dist/adapters/node-test/run-test-file.d.ts +12 -4
  51. package/dist/adapters/node-test/run-test-file.js +19 -14
  52. package/dist/adapters/node-test/run-test-process.d.ts +30 -13
  53. package/dist/adapters/node-test/run-test-process.js +38 -40
  54. package/dist/adapters/node-test/start-node-test-session.d.ts +10 -2
  55. package/dist/adapters/node-test/start-node-test-session.js +90 -84
  56. package/dist/adapters/node-test/start-test-process.d.ts +30 -0
  57. package/dist/adapters/node-test/start-test-process.js +27 -0
  58. package/dist/adapters/node-test/types/node-test-handle.d.ts +14 -1
  59. package/dist/adapters/node-test/types/node-test-record.d.ts +3 -3
  60. package/dist/adapters/node-test/types/node-test-unit.d.ts +6 -1
  61. package/dist/adapters/node-test/types/process-watch.d.ts +4 -3
  62. package/dist/adapters/node-test/types/spare-processes.d.ts +20 -0
  63. package/dist/adapters/node-test/types/test-process-outcome.d.ts +8 -1
  64. package/dist/adapters/shared/allows-spares.d.ts +11 -0
  65. package/dist/adapters/shared/allows-spares.js +23 -0
  66. package/dist/adapters/shared/create-environment-proxy.d.ts +4 -3
  67. package/dist/adapters/shared/create-input-filter.d.ts +29 -0
  68. package/dist/adapters/shared/create-input-filter.js +32 -0
  69. package/dist/adapters/shared/enable-compile-cache.d.ts +32 -0
  70. package/dist/adapters/shared/enable-compile-cache.js +7 -0
  71. package/dist/adapters/shared/find-tsconfig-property.d.ts +13 -0
  72. package/dist/adapters/shared/find-tsconfig-property.js +6 -0
  73. package/dist/adapters/shared/get-spare-limit.d.ts +10 -0
  74. package/dist/adapters/shared/get-spare-limit.js +5 -0
  75. package/dist/adapters/shared/index-environment-hashes.d.ts +2 -2
  76. package/dist/adapters/shared/index-environment-hashes.js +5 -13
  77. package/dist/adapters/{node-test → shared}/list-flag-values.d.ts +2 -1
  78. package/dist/adapters/shared/list-flag-values.js +10 -0
  79. package/dist/adapters/shared/list-tsconfig-files.d.ts +14 -5
  80. package/dist/adapters/shared/list-tsconfig-files.js +15 -13
  81. package/dist/adapters/shared/parse-tsconfig.d.ts +10 -0
  82. package/dist/adapters/shared/parse-tsconfig.js +19 -0
  83. package/dist/adapters/shared/read-flag-name.d.ts +9 -0
  84. package/dist/adapters/shared/read-flag-name.js +5 -0
  85. package/dist/adapters/shared/read-node-options.d.ts +11 -0
  86. package/dist/adapters/shared/read-node-options.js +6 -0
  87. package/dist/adapters/shared/read-prefork-switch.d.ts +10 -0
  88. package/dist/adapters/shared/read-prefork-switch.js +5 -0
  89. package/dist/adapters/shared/read-tsconfig-extends.d.ts +2 -5
  90. package/dist/adapters/shared/read-tsconfig-extends.js +16 -31
  91. package/dist/adapters/shared/read-tsconfig-references.d.ts +12 -0
  92. package/dist/adapters/shared/read-tsconfig-references.js +13 -0
  93. package/dist/adapters/shared/track-file-inputs.d.ts +7 -3
  94. package/dist/adapters/shared/track-file-inputs.js +16 -7
  95. package/dist/adapters/shared/track-file-reads.d.ts +13 -8
  96. package/dist/adapters/shared/track-file-reads.js +122 -69
  97. package/dist/adapters/shared/track-inputs.d.ts +13 -6
  98. package/dist/adapters/shared/track-inputs.js +7 -7
  99. package/dist/adapters/shared/track-process-group.d.ts +2 -1
  100. package/dist/adapters/shared/track-process-group.js +7 -2
  101. package/dist/adapters/shared/types/file-input-tracking.d.ts +6 -0
  102. package/dist/adapters/shared/types/input-tracking.d.ts +3 -3
  103. package/dist/adapters/vitest/build-isolated-facts.d.ts +4 -3
  104. package/dist/adapters/vitest/collect-dependencies.d.ts +10 -3
  105. package/dist/adapters/vitest/collect-dependencies.js +36 -26
  106. package/dist/adapters/vitest/configure-project.d.ts +3 -2
  107. package/dist/adapters/vitest/configure-project.js +1 -1
  108. package/dist/adapters/vitest/create-forks-pool.d.ts +34 -7
  109. package/dist/adapters/vitest/create-forks-pool.js +102 -24
  110. package/dist/adapters/vitest/create-interleaved-sequencer.d.ts +3 -2
  111. package/dist/adapters/vitest/drop-signal-listeners.d.ts +14 -0
  112. package/dist/adapters/vitest/drop-signal-listeners.js +15 -0
  113. package/dist/adapters/vitest/get-cache-inputs.d.ts +3 -1
  114. package/dist/adapters/vitest/get-cache-inputs.js +46 -29
  115. package/dist/adapters/vitest/get-module-file.d.ts +3 -5
  116. package/dist/adapters/vitest/get-module-file.js +1 -1
  117. package/dist/adapters/vitest/get-spare-key.d.ts +15 -0
  118. package/dist/adapters/vitest/get-spare-key.js +15 -0
  119. package/dist/adapters/vitest/index.d.ts +2 -1
  120. package/dist/adapters/vitest/index.js +1 -0
  121. package/dist/adapters/vitest/is-virtual-module.d.ts +10 -0
  122. package/dist/adapters/vitest/is-virtual-module.js +8 -0
  123. package/dist/adapters/vitest/list-script-defines.d.ts +13 -0
  124. package/dist/adapters/vitest/list-script-defines.js +22 -0
  125. package/dist/adapters/vitest/read-out-files.d.ts +7 -2
  126. package/dist/adapters/vitest/read-out-files.js +5 -5
  127. package/dist/adapters/vitest/read-out-records.d.ts +17 -0
  128. package/dist/adapters/vitest/read-out-records.js +27 -0
  129. package/dist/adapters/vitest/read-strays.d.ts +20 -0
  130. package/dist/adapters/vitest/read-strays.js +53 -0
  131. package/dist/adapters/vitest/read-unit-inputs.d.ts +9 -2
  132. package/dist/adapters/vitest/read-unit-inputs.js +1 -1
  133. package/dist/adapters/vitest/run-dry.js +17 -17
  134. package/dist/adapters/vitest/run-plan.d.ts +10 -6
  135. package/dist/adapters/vitest/run-plan.js +16 -16
  136. package/dist/adapters/vitest/run-specifications.d.ts +11 -3
  137. package/dist/adapters/vitest/run-specifications.js +22 -12
  138. package/dist/adapters/vitest/runner.d.ts +92 -46
  139. package/dist/adapters/vitest/runner.js +126 -104
  140. package/dist/adapters/vitest/start-vitest-session.d.ts +5 -1
  141. package/dist/adapters/vitest/start-vitest-session.js +64 -59
  142. package/dist/adapters/vitest/stop-hung-worker.d.ts +11 -4
  143. package/dist/adapters/vitest/stop-hung-worker.js +20 -7
  144. package/dist/adapters/vitest/types/mootant-forks-pool.d.ts +47 -0
  145. package/dist/adapters/vitest/types/stray-decisions.d.ts +8 -0
  146. package/dist/adapters/vitest/types/unit-outcome.d.ts +2 -1
  147. package/dist/adapters/vitest/types/vitest-session-state.d.ts +9 -8
  148. package/dist/adapters/vitest/types/vitest-worker.d.ts +118 -32
  149. package/dist/adapters/vitest/wait-for-workers.d.ts +5 -2
  150. package/dist/adapters/vitest/wait-for-workers.js +15 -15
  151. package/dist/adapters/vitest/worker/encode-stray.d.ts +16 -0
  152. package/dist/adapters/vitest/worker/encode-stray.js +16 -0
  153. package/dist/adapters/vitest/worker/intercept-strays.d.ts +26 -0
  154. package/dist/adapters/vitest/worker/intercept-strays.js +13 -0
  155. package/dist/adapters/vitest/worker/read-try-facts.d.ts +5 -4
  156. package/dist/adapters/vitest/worker/track-meta-defines.d.ts +39 -0
  157. package/dist/adapters/vitest/worker/track-meta-defines.js +23 -0
  158. package/dist/adapters/vitest/worker/track-values.d.ts +38 -0
  159. package/dist/adapters/vitest/worker/track-values.js +45 -0
  160. package/dist/adapters/vitest/worker/value-prefixes.d.ts +12 -0
  161. package/dist/adapters/vitest/worker/value-prefixes.js +6 -0
  162. package/dist/adapters/vitest/worker/wait-for-turn.d.ts +8 -6
  163. package/dist/adapters/vitest/worker/watch-property.d.ts +17 -0
  164. package/dist/adapters/vitest/worker/watch-property.js +27 -0
  165. package/dist/adapters/vitest/worker/write-out-record.d.ts +2 -2
  166. package/dist/cli/create-run-progress.d.ts +8 -1
  167. package/dist/cli/create-run-progress.js +4 -1
  168. package/dist/cli/ensure-exit.d.ts +11 -0
  169. package/dist/cli/ensure-exit.js +15 -0
  170. package/dist/cli/html/build-html-report.js +2 -1
  171. package/dist/cli/html/client/main.js +1 -1
  172. package/dist/cli/html/client/render-change.d.ts +3 -2
  173. package/dist/cli/html/client/render-code.d.ts +1 -1
  174. package/dist/cli/html/client/render-overview.d.ts +3 -3
  175. package/dist/cli/html/pack-replacement.d.ts +1 -1
  176. package/dist/cli/index.d.ts +1 -0
  177. package/dist/cli/index.js +3 -2
  178. package/dist/cli/parse-arguments.d.ts +4 -0
  179. package/dist/cli/parse-arguments.js +4 -1
  180. package/dist/cli/report/build-list-report.js +1 -1
  181. package/dist/cli/report/build-run-report.js +2 -1
  182. package/dist/cli/report/format-command.d.ts +5 -0
  183. package/dist/cli/report/format-command.js +1 -1
  184. package/dist/cli/report/format-file-groups.d.ts +1 -1
  185. package/dist/cli/report/format-run-text-report.d.ts +5 -4
  186. package/dist/cli/report/format-run-text-report.js +10 -10
  187. package/dist/cli/report/slim-run-report.d.ts +10 -10
  188. package/dist/cli/report/slim-run-report.js +1 -0
  189. package/dist/cli/run-mutation.d.ts +5 -1
  190. package/dist/cli/run-mutation.js +55 -47
  191. package/dist/cli/terminal/create-spinner.d.ts +2 -3
  192. package/dist/cli/terminal/create-spinner.js +23 -32
  193. package/dist/cli/terminal/get-text-style.js +4 -4
  194. package/dist/cli/watch-interrupts.d.ts +41 -0
  195. package/dist/cli/watch-interrupts.js +32 -0
  196. package/dist/core/cache/apply-cached-units.d.ts +8 -7
  197. package/dist/core/cache/build-hash.d.ts +9 -0
  198. package/dist/core/cache/build-hash.js +2 -0
  199. package/dist/core/cache/cache-version.d.ts +4 -4
  200. package/dist/core/cache/check-dry-snapshot.d.ts +25 -0
  201. package/dist/core/cache/check-dry-snapshot.js +13 -0
  202. package/dist/core/cache/create-dry-reuse-miss.d.ts +12 -0
  203. package/dist/core/cache/create-dry-reuse-miss.js +7 -0
  204. package/dist/core/cache/create-dry-snapshot.d.ts +71 -0
  205. package/dist/core/cache/create-dry-snapshot.js +27 -0
  206. package/dist/core/cache/create-run-cache.d.ts +20 -2
  207. package/dist/core/cache/create-run-cache.js +31 -22
  208. package/dist/core/cache/create-snapshot-session.d.ts +12 -0
  209. package/dist/core/cache/create-snapshot-session.js +19 -0
  210. package/dist/core/cache/get-build-id.d.ts +11 -0
  211. package/dist/core/cache/get-build-id.js +7 -0
  212. package/dist/core/cache/get-cache-path.d.ts +1 -1
  213. package/dist/core/cache/get-cache-path.js +1 -1
  214. package/dist/core/cache/get-dry-snapshot-key.d.ts +47 -0
  215. package/dist/core/cache/get-dry-snapshot-key.js +43 -0
  216. package/dist/core/cache/get-dry-snapshot-path.d.ts +9 -0
  217. package/dist/core/cache/get-dry-snapshot-path.js +5 -0
  218. package/dist/core/cache/get-environment-key.d.ts +9 -4
  219. package/dist/core/cache/get-environment-key.js +5 -4
  220. package/dist/core/cache/get-test-file-keys.d.ts +2 -1
  221. package/dist/core/cache/get-test-file-keys.js +11 -10
  222. package/dist/core/cache/hash-files.d.ts +11 -6
  223. package/dist/core/cache/hash-files.js +22 -17
  224. package/dist/core/cache/hash-project-tree.d.ts +22 -0
  225. package/dist/core/cache/hash-project-tree.js +69 -0
  226. package/dist/core/cache/is-dry-reuse-miss.d.ts +8 -0
  227. package/dist/core/cache/is-dry-reuse-miss.js +4 -0
  228. package/dist/core/cache/list-file-hashes.d.ts +4 -0
  229. package/dist/core/cache/list-file-hashes.js +5 -2
  230. package/dist/core/cache/list-install-states.d.ts +12 -0
  231. package/dist/core/cache/list-install-states.js +19 -0
  232. package/dist/core/cache/list-variable-hashes.d.ts +15 -0
  233. package/dist/core/cache/list-variable-hashes.js +14 -0
  234. package/dist/core/cache/prepare-run-cache.d.ts +64 -16
  235. package/dist/core/cache/prepare-run-cache.js +109 -62
  236. package/dist/core/cache/read-dry-snapshot.d.ts +10 -0
  237. package/dist/core/cache/read-dry-snapshot.js +15 -0
  238. package/dist/core/cache/read-run-cache.js +6 -2
  239. package/dist/core/cache/save-dry-snapshot.d.ts +34 -0
  240. package/dist/core/cache/save-dry-snapshot.js +32 -0
  241. package/dist/core/cache/save-run-cache.d.ts +8 -7
  242. package/dist/core/cache/save-run-cache.js +2 -1
  243. package/dist/core/cache/unknown-hash.d.ts +7 -0
  244. package/dist/core/cache/unknown-hash.js +2 -0
  245. package/dist/core/cache/volatile-variables.d.ts +7 -0
  246. package/dist/core/cache/volatile-variables.js +11 -0
  247. package/dist/core/cache/write-run-cache.js +1 -1
  248. package/dist/core/config/load-typescript-config.d.ts +6 -1
  249. package/dist/core/config/load-typescript-config.js +26 -10
  250. package/dist/core/config/prepare-run.d.ts +7 -3
  251. package/dist/core/config/prepare-run.js +1 -0
  252. package/dist/core/config/resolve-run-settings.d.ts +3 -2
  253. package/dist/core/config/resolve-run-settings.js +1 -0
  254. package/dist/core/config/validate-config.js +3 -2
  255. package/dist/core/files/get-package-manifest.d.ts +12 -0
  256. package/dist/core/files/get-package-manifest.js +7 -0
  257. package/dist/core/files/select-changed-mutants.d.ts +11 -6
  258. package/dist/core/files/select-changed-mutants.js +38 -13
  259. package/dist/core/generate/apply-solitary-rule.d.ts +8 -5
  260. package/dist/core/generate/apply-solitary-rule.js +36 -29
  261. package/dist/core/generate/collect-candidates.d.ts +23 -5
  262. package/dist/core/generate/collect-candidates.js +202 -92
  263. package/dist/core/generate/compare-targets.d.ts +14 -0
  264. package/dist/core/generate/compare-targets.js +6 -0
  265. package/dist/core/generate/deduplicate-candidates.d.ts +6 -4
  266. package/dist/core/generate/deduplicate-candidates.js +11 -9
  267. package/dist/core/generate/find-list-removal.d.ts +20 -0
  268. package/dist/core/generate/find-list-removal.js +26 -0
  269. package/dist/core/generate/generate-file-mutants.js +49 -47
  270. package/dist/core/generate/get-mutant-site.d.ts +18 -0
  271. package/dist/core/generate/get-mutant-site.js +4 -0
  272. package/dist/core/generate/get-target.d.ts +14 -0
  273. package/dist/core/generate/get-target.js +4 -0
  274. package/dist/core/generate/pick-host.d.ts +10 -0
  275. package/dist/core/generate/pick-host.js +16 -0
  276. package/dist/core/generate/validate-replacement.d.ts +15 -4
  277. package/dist/core/generate/validate-replacement.js +28 -13
  278. package/dist/core/ignore/find-ignore-rule.d.ts +8 -7
  279. package/dist/core/index.d.ts +18 -0
  280. package/dist/core/instrument/find-attribute-values.d.ts +12 -0
  281. package/dist/core/instrument/find-attribute-values.js +13 -0
  282. package/dist/core/instrument/get-site-syntax.d.ts +14 -0
  283. package/dist/core/instrument/get-site-syntax.js +12 -0
  284. package/dist/core/instrument/group-mutant-ranges.d.ts +7 -3
  285. package/dist/core/instrument/group-mutant-ranges.js +25 -19
  286. package/dist/core/instrument/instrument-file.d.ts +5 -3
  287. package/dist/core/instrument/instrument-file.js +10 -9
  288. package/dist/core/instrument/instrumenter-version.d.ts +1 -1
  289. package/dist/core/instrument/render-branch.d.ts +17 -0
  290. package/dist/core/instrument/render-branch.js +81 -0
  291. package/dist/core/instrument/render-mutant-range.d.ts +17 -6
  292. package/dist/core/instrument/render-mutant-range.js +39 -13
  293. package/dist/core/list-mutants.d.ts +7 -5
  294. package/dist/core/list-mutants.js +2 -2
  295. package/dist/core/mutators/array-element.d.ts +7 -6
  296. package/dist/core/mutators/array-element.js +13 -13
  297. package/dist/core/mutators/assignment-operator.js +34 -33
  298. package/dist/core/mutators/boolean-literal.d.ts +3 -2
  299. package/dist/core/mutators/number-literal.d.ts +1 -1
  300. package/dist/core/mutators/object-property.d.ts +4 -3
  301. package/dist/core/mutators/object-property.js +7 -8
  302. package/dist/core/mutators/return-value.js +65 -33
  303. package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +14 -9
  304. package/dist/core/mutators/shared/get-branch-copy-skip.js +34 -35
  305. package/dist/core/mutators/shared/get-canonical-falsy-default.d.ts +32 -0
  306. package/dist/core/mutators/shared/get-canonical-falsy-default.js +11 -0
  307. package/dist/core/mutators/shared/get-comparison-plan.d.ts +2 -2
  308. package/dist/core/mutators/shared/get-comparison-plan.js +86 -85
  309. package/dist/core/mutators/shared/get-condition-constants.d.ts +8 -8
  310. package/dist/core/mutators/shared/get-condition-constants.js +3 -3
  311. package/dist/core/mutators/shared/get-default-option-skip.d.ts +2 -2
  312. package/dist/core/mutators/shared/get-endless-value.d.ts +20 -0
  313. package/dist/core/mutators/shared/get-endless-value.js +25 -0
  314. package/dist/core/mutators/shared/get-forced-test-justifier.d.ts +44 -0
  315. package/dist/core/mutators/shared/get-forced-test-justifier.js +25 -0
  316. package/dist/core/mutators/shared/get-group-constant.d.ts +6 -6
  317. package/dist/core/mutators/shared/get-group-constant.js +2 -2
  318. package/dist/core/mutators/shared/get-literal-skip.d.ts +9 -9
  319. package/dist/core/mutators/shared/get-literal-skip.js +2 -2
  320. package/dist/core/mutators/shared/get-logical-drops.d.ts +8 -8
  321. package/dist/core/mutators/shared/get-logical-drops.js +80 -82
  322. package/dist/core/mutators/shared/get-loop-running-skip.d.ts +2 -2
  323. package/dist/core/mutators/shared/get-nullish-swap-skip.d.ts +2 -2
  324. package/dist/core/mutators/shared/get-or-default-skip.d.ts +2 -2
  325. package/dist/core/mutators/shared/get-owned-constants.d.ts +2 -2
  326. package/dist/core/mutators/shared/get-owner-constant.d.ts +3 -1
  327. package/dist/core/mutators/shared/get-running-value.d.ts +5 -4
  328. package/dist/core/mutators/shared/get-toward-mutant.d.ts +10 -2
  329. package/dist/core/mutators/shared/get-toward-mutant.js +45 -40
  330. package/dist/core/mutators/shared/has-other-exit.js +16 -36
  331. package/dist/core/mutators/shared/is-loop-exit.d.ts +20 -0
  332. package/dist/core/mutators/shared/is-loop-exit.js +32 -0
  333. package/dist/core/mutators/shared/is-read-only.d.ts +26 -0
  334. package/dist/core/mutators/shared/is-read-only.js +53 -0
  335. package/dist/core/mutators/shared/leave-now-skip.d.ts +2 -2
  336. package/dist/core/mutators/shared/no-op-callback-skip.d.ts +2 -2
  337. package/dist/core/mutators/statement-removal.d.ts +4 -3
  338. package/dist/core/mutators/statement-removal.js +69 -73
  339. package/dist/core/mutators/string-literal.d.ts +15 -5
  340. package/dist/core/mutators/string-literal.js +79 -50
  341. package/dist/core/plugins/create-mutator-registry.d.ts +4 -2
  342. package/dist/core/plugins/create-mutator-registry.js +15 -5
  343. package/dist/core/plugins/validate-plugin.d.ts +3 -3
  344. package/dist/core/plugins/validate-plugin.js +32 -10
  345. package/dist/core/presets/recommended.d.ts +2 -2
  346. package/dist/core/presets/strict.d.ts +4 -2
  347. package/dist/core/regex/collect-pattern-changes.d.ts +2 -2
  348. package/dist/core/regex/create-regex-replacement.d.ts +2 -2
  349. package/dist/core/run/apply-batch-result.d.ts +23 -22
  350. package/dist/core/run/apply-batch-result.js +5 -5
  351. package/dist/core/run/apply-isolated-result.d.ts +21 -12
  352. package/dist/core/run/apply-isolated-result.js +45 -25
  353. package/dist/core/run/classify-try.d.ts +9 -8
  354. package/dist/core/run/count-run.d.ts +2 -1
  355. package/dist/core/run/create-run-state.d.ts +5 -0
  356. package/dist/core/run/create-run-state.js +1 -0
  357. package/dist/core/run/create-work-directory.d.ts +4 -1
  358. package/dist/core/run/create-work-directory.js +15 -12
  359. package/dist/core/run/decide-evidence.d.ts +4 -3
  360. package/dist/core/run/get-test-file-limits.d.ts +13 -0
  361. package/dist/core/run/get-test-file-limits.js +13 -0
  362. package/dist/core/run/get-unit-evidence.d.ts +12 -3
  363. package/dist/core/run/get-unit-evidence.js +1 -1
  364. package/dist/core/run/guard-session.d.ts +18 -0
  365. package/dist/core/run/guard-session.js +30 -0
  366. package/dist/core/run/live-work-directories.d.ts +5 -0
  367. package/dist/core/run/live-work-directories.js +2 -0
  368. package/dist/core/run/plan-batch.d.ts +6 -3
  369. package/dist/core/run/plan-batch.js +36 -31
  370. package/dist/core/run/plan-isolated.d.ts +3 -1
  371. package/dist/core/run/plan-isolated.js +8 -14
  372. package/dist/core/run/read-isolated-unit.d.ts +9 -6
  373. package/dist/core/run/read-isolated-unit.js +77 -38
  374. package/dist/core/run/remove-live-work-directories.d.ts +7 -0
  375. package/dist/core/run/remove-live-work-directories.js +12 -0
  376. package/dist/core/run/run-batch-phases.d.ts +4 -3
  377. package/dist/core/run/run-dry-phase.d.ts +35 -19
  378. package/dist/core/run/run-dry-phase.js +127 -77
  379. package/dist/core/run/run-isolated-rounds.d.ts +15 -10
  380. package/dist/core/run/run-isolated-rounds.js +4 -2
  381. package/dist/core/run/validate-adapter.d.ts +1 -1
  382. package/dist/core/run/validate-adapter.js +1 -1
  383. package/dist/core/run-mutants.d.ts +59 -22
  384. package/dist/core/run-mutants.js +356 -208
  385. package/dist/core/runtime/create-hit-limit-error.d.ts +5 -3
  386. package/dist/core/runtime/create-hit-limit-error.js +1 -1
  387. package/dist/core/runtime/install-mutant-runtime.js +23 -6
  388. package/dist/core/runtime/runtime-version.d.ts +4 -4
  389. package/dist/core/skips/skip-rules.d.ts +7 -1
  390. package/dist/core/skips/skip-rules.js +4 -0
  391. package/dist/core/syntax/is-brace-sensitive-attribute.d.ts +18 -0
  392. package/dist/core/syntax/is-brace-sensitive-attribute.js +28 -0
  393. package/dist/core/syntax/is-spread-safe-member.d.ts +18 -0
  394. package/dist/core/syntax/is-spread-safe-member.js +18 -0
  395. package/dist/core/syntax/is-value-position.d.ts +3 -1
  396. package/dist/core/text/get-list-removal-range.d.ts +22 -0
  397. package/dist/core/text/get-list-removal-range.js +46 -0
  398. package/dist/core/text/is-plain-attribute-string.d.ts +10 -0
  399. package/dist/core/text/is-plain-attribute-string.js +5 -0
  400. package/dist/core/text/parse-expression.d.ts +8 -4
  401. package/dist/core/text/parse-expression.js +1 -0
  402. package/dist/core/text/remove-list-element.d.ts +2 -4
  403. package/dist/core/text/remove-list-element.js +4 -45
  404. package/dist/docs/styles/colors.js +1 -1
  405. package/dist/package.js +1 -1
  406. package/dist/types/adapter/adapter-context.d.ts +20 -0
  407. package/dist/types/adapter/adapter-session.d.ts +2 -1
  408. package/dist/types/adapter/cache-inputs.d.ts +3 -2
  409. package/dist/types/adapter/dry-file.d.ts +6 -3
  410. package/dist/types/adapter/dry-run-request.d.ts +5 -4
  411. package/dist/types/adapter/isolated-plan.d.ts +2 -1
  412. package/dist/types/adapter/isolated-result.d.ts +3 -1
  413. package/dist/types/adapter/mutant-runtime.d.ts +30 -1
  414. package/dist/types/adapter/run-inputs.d.ts +5 -4
  415. package/dist/types/adapter/test-adapter.d.ts +7 -0
  416. package/dist/types/cache/cache-entry.d.ts +9 -7
  417. package/dist/types/cache/cached-inputs.d.ts +2 -2
  418. package/dist/types/cache/dry-snapshot.d.ts +76 -0
  419. package/dist/types/cache/project-tree.d.ts +16 -0
  420. package/dist/types/cache/run-cache-file.d.ts +1 -1
  421. package/dist/types/cache/run-cache.d.ts +6 -5
  422. package/dist/types/cli/text-style.d.ts +1 -1
  423. package/dist/types/config/plugin.d.ts +11 -2
  424. package/dist/types/config/preset-settings.d.ts +2 -2
  425. package/dist/types/config/run-config.d.ts +22 -4
  426. package/dist/types/config/run-settings.d.ts +6 -0
  427. package/dist/types/html/indexed-mutant.d.ts +4 -2
  428. package/dist/types/html/shown-change.d.ts +4 -3
  429. package/dist/types/mutant/core-note.d.ts +12 -0
  430. package/dist/types/mutant/diagnostic.d.ts +1 -0
  431. package/dist/types/mutant/list-removal.d.ts +37 -0
  432. package/dist/types/mutant/mutant-candidate.d.ts +11 -17
  433. package/dist/types/mutant/mutant-host.d.ts +49 -0
  434. package/dist/types/mutant/mutant-kind.d.ts +18 -0
  435. package/dist/types/mutant/mutant-range.d.ts +15 -8
  436. package/dist/types/mutant/mutant.d.ts +9 -15
  437. package/dist/types/mutant/registered-skip-rule.d.ts +11 -0
  438. package/dist/types/mutant/site-syntax.d.ts +14 -0
  439. package/dist/types/mutant/skip-justifier.d.ts +3 -1
  440. package/dist/types/mutant/skip-note.d.ts +7 -6
  441. package/dist/types/mutant/skip-rule-id.d.ts +3 -2
  442. package/dist/types/mutant/skip-rule.d.ts +2 -1
  443. package/dist/types/mutant/skipped-candidate.d.ts +27 -17
  444. package/dist/types/mutant/skipped-mutant.d.ts +15 -12
  445. package/dist/types/mutator/mutator.d.ts +3 -2
  446. package/dist/types/mutator/registered-mutator.d.ts +8 -0
  447. package/dist/types/mutator/replacement.d.ts +14 -3
  448. package/dist/types/regex/regex-change.d.ts +2 -2
  449. package/dist/types/report/html-report.d.ts +13 -9
  450. package/dist/types/report/list-report-focus.d.ts +3 -2
  451. package/dist/types/report/list-report-justifier.d.ts +4 -2
  452. package/dist/types/report/list-report-mutant.d.ts +15 -9
  453. package/dist/types/report/list-report-skipped.d.ts +6 -4
  454. package/dist/types/report/list-report.d.ts +1 -1
  455. package/dist/types/report/run-report.d.ts +13 -4
  456. package/dist/types/report/slim-list-report.d.ts +6 -3
  457. package/dist/types/report/slim-run-report.d.ts +2 -2
  458. package/dist/types/run/isolated-evidence.d.ts +3 -2
  459. package/dist/types/run/isolated-reason.d.ts +6 -4
  460. package/dist/types/run/mutant-state.d.ts +1 -1
  461. package/dist/types/run/run-durations.d.ts +8 -3
  462. package/dist/types/run/run-event.d.ts +11 -8
  463. package/dist/types/run/run-kind.d.ts +3 -2
  464. package/dist/types/run/run-result.d.ts +17 -5
  465. package/dist/types/run/run-state.d.ts +30 -1
  466. package/dist/types/run/run-status.d.ts +2 -2
  467. package/dist/types/run/try-cause.d.ts +10 -7
  468. package/dist/types/syntax/syntax-helpers.d.ts +5 -3
  469. package/package.json +5 -5
  470. package/readme.md +85 -68
  471. package/skills/mootant/SKILL.md +50 -31
  472. package/skills/mootant/references/mutators.md +31 -23
  473. package/dist/adapters/node-test/list-flag-values.js +0 -9
  474. package/dist/core/instrument/get-site-check.d.ts +0 -9
  475. package/dist/core/instrument/get-site-check.js +0 -5
  476. package/dist/core/instrument/get-template-site-check.d.ts +0 -12
  477. package/dist/core/instrument/get-template-site-check.js +0 -5
  478. /package/dist/adapters/{node-test → shared}/loader-flags.d.ts +0 -0
  479. /package/dist/adapters/{node-test → shared}/loader-flags.js +0 -0
  480. /package/dist/cli/{built-in-adapters.d.ts → get-built-in-adapters.d.ts} +0 -0
  481. /package/dist/cli/{built-in-adapters.js → get-built-in-adapters.js} +0 -0
  482. /package/dist/cli/terminal/{colors.d.ts → create-colors.d.ts} +0 -0
  483. /package/dist/cli/terminal/{colors.js → create-colors.js} +0 -0
  484. /package/dist/{adapters/shared → core/files}/list-package-files.d.ts +0 -0
  485. /package/dist/{adapters/shared → core/files}/list-package-files.js +0 -0
  486. /package/dist/{adapters/shared → core/files}/read-package-type.d.ts +0 -0
  487. /package/dist/{adapters/shared → core/files}/read-package-type.js +0 -0
@@ -3,11 +3,13 @@ import { RunKind } from './run-kind.js';
3
3
  * What happens in a mutation run, as it happens; the command line turns these
4
4
  * into live progress. Events come in this order: `mutants`, `dry-start`, units
5
5
  * of the dry run, a `dry-again` before each later dry run, `dry-end`, then for
6
- * every later run of the test runner a `run-start` and its units. When tests
7
- * fail without mutants, `dry-failed` comes before the run throws. `verdicts`
8
- * comes whenever the counts of decided mutants change, from right before the
9
- * first `run-start` on; the last one counts the final results. `note` and
10
- * `output` may come at any point.
6
+ * every later run of the test runner a `run-start` and its units; a run that
7
+ * reuses the dry run of an earlier run has neither `dry-start` nor `dry-end`,
8
+ * and the events of its phases come all at once as it ends. When tests fail
9
+ * without mutants, `dry-failed` comes before the run throws. `verdicts` comes
10
+ * whenever the counts of decided mutants change, from right before the first
11
+ * `run-start` on; the last one counts the final results. `note` and `output`
12
+ * may come at any point.
11
13
  */
12
14
  export type RunEvent =
13
15
  | {
@@ -42,8 +44,9 @@ export type RunEvent =
42
44
 
43
45
  /**
44
46
  * Distinct mutants of an isolated round whose units run again, as the
45
- * test runner lost what they gave, and are not counted in `confirming`; 0
46
- * in other runs.
47
+ * test runner lost what they gave, something else stopped the tests that
48
+ * reach them or their process died, and are not counted in `confirming`;
49
+ * 0 in other runs.
47
50
  */
48
51
  retrying: number
49
52
 
@@ -221,7 +224,7 @@ export type RunEvent =
221
224
  kind: 'dry-start'
222
225
 
223
226
  /**
224
- * Mutated files whose related tests run.
227
+ * Switched files of the dry run.
225
228
  */
226
229
  files: number
227
230
  }
@@ -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'
@@ -13,14 +13,14 @@ import { RunMode } from './run-mode.js';
13
13
  */
14
14
  export interface RunResult {
15
15
  /**
16
- * Test runner runs by kind; kinds that did not run are left out.
16
+ * Test runner runs by kind; kinds that did not run are left out, the dry run
17
+ * too when the run reused the dry run of an earlier run.
17
18
  */
18
19
  runs: Partial<Record<RunKind, number>>
19
20
 
20
21
  /**
21
22
  * 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.
23
+ * errors, sorted; null outside fast mode, which tries each test once.
24
24
  */
25
25
  unrepeatable: string[] | null
26
26
 
@@ -61,6 +61,13 @@ export interface RunResult {
61
61
  */
62
62
  results: MutantResult[]
63
63
 
64
+ /**
65
+ * Whether isolated units of one test file ran at the same time
66
+ * (`run.parallelUnits` with an adapter that runs them), so tests that share a
67
+ * fixed file, port or database may have given false verdicts.
68
+ */
69
+ parallelUnits: boolean
70
+
64
71
  /**
65
72
  * Durations of the phases.
66
73
  */
@@ -84,13 +91,18 @@ export interface RunResult {
84
91
  listedIds: string[]
85
92
 
86
93
  /**
87
- * Tests the dry run saw.
94
+ * Tests the dry run saw, or the dry run of an earlier run that the run
95
+ * reused.
88
96
  */
89
97
  tests: DryTest[]
90
98
 
91
99
  /**
92
100
  * Whether verdicts were reused from and saved to the cache: false with
93
- * `--no-cache`, `run.cache: false`, or an adapter without cache support.
101
+ * `--no-cache`, `run.cache: false`, an adapter without cache support, and
102
+ * when no test file has a key, as when after the dry run a file every verdict
103
+ * depends on, other than one the tests read and wrote themselves, has a
104
+ * modification time at or after the start of the run, which a `cache-skipped`
105
+ * warning names.
94
106
  */
95
107
  cache: boolean
96
108
 
@@ -49,6 +49,13 @@ export interface RunState {
49
49
  */
50
50
  live: LiveVerdicts | null
51
51
 
52
+ /**
53
+ * Whether isolated units of one test file may run at the same time
54
+ * (`AdapterContext.parallelUnits`), so they form no serial chain; false or
55
+ * omitted when they run one after another.
56
+ */
57
+ parallelUnits?: boolean
58
+
52
59
  /**
53
60
  * Verdicts of earlier runs to reuse and the evidence of this run to store, or
54
61
  * null when the cache is off.
@@ -80,16 +87,36 @@ export interface RunState {
80
87
  * One mutant planned in one test file on the isolated path.
81
88
  */
82
89
  export interface IsolatedRequest {
90
+ /**
91
+ * Whether an earlier unit of the mutant in the test file was inconclusive:
92
+ * something else stopped the tests that reach the mutant before they got to
93
+ * it, so an inconclusive unit now gives `Error`; false or omitted when none
94
+ * was.
95
+ */
96
+ inconclusive?: boolean
97
+
83
98
  /**
84
99
  * Whether the unit confirms a timeout of an earlier unit.
85
100
  */
86
101
  confirming: boolean
87
102
 
103
+ /**
104
+ * Whether an earlier unit of the mutant in the test file crashed, so a crash
105
+ * of this one kills.
106
+ */
107
+ crashed: boolean
108
+
88
109
  /**
89
110
  * Whether the unit already went missing once.
90
111
  */
91
112
  retried: boolean
92
113
 
114
+ /**
115
+ * Whether the unit confirms a hit-limit timeout, with `factor × floor` more
116
+ * site evaluations than planned.
117
+ */
118
+ raised: boolean
119
+
93
120
  /**
94
121
  * Id of the mutant.
95
122
  */
@@ -112,7 +139,9 @@ export interface LimitSettings {
112
139
  timeout: { constant: number; factor: number }
113
140
 
114
141
  /**
115
- * Hit limit per try: `max(floor, factor × dry hits)`.
142
+ * Hit limit of a try or of loading a test file: `max(floor, factor × dry
143
+ * hits)`. A unit that confirms a hit-limit timeout gets `factor × floor`
144
+ * more.
116
145
  */
117
146
  hitLimit: { factor: number; floor: number }
118
147
  }
@@ -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,21 @@
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
- * - `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`).
12
+ * - `crash`: the worker died with the mutant active, and again in a later run of
13
+ * the unit (isolated path);
14
+ * - `hit-limit`: the hit counter stopped a loop or far hotter code (confirmed
15
+ * with doubled time and `factor × floor` more evaluations);
16
+ * - `time-limit`: a timer stopped stuck or far slower code (confirmed with
17
+ * doubled time);
18
+ * - `hang`: the watchdog stopped a worker that was stuck or far slower with the
19
+ * mutant active (confirmed like `time-limit`).
17
20
  */
18
21
  export type TryCause =
19
22
  | '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.3.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",
package/readme.md CHANGED
@@ -1,22 +1,13 @@
1
1
  # Mootant
2
2
 
3
- <picture>
4
- <source
5
- srcset="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-light.svg"
6
- media="(prefers-color-scheme: light)"
7
- />
8
- <source
9
- srcset="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-dark.svg"
10
- media="(prefers-color-scheme: dark)"
11
- />
3
+ <a href="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-light.svg">
12
4
  <img
13
5
  src="https://raw.githubusercontent.com/azat-io/mootant/main/assets/logo-light.svg"
14
6
  alt="Mootant Logo"
15
7
  align="right"
16
- height="160"
17
8
  width="160"
18
9
  />
19
- </picture>
10
+ </a>
20
11
 
21
12
  [![Version](https://img.shields.io/npm/v/mootant.svg?color=b8f12a&labelColor=f4f2ec)](https://npmjs.com/package/mootant)
22
13
  [![Code Coverage](https://img.shields.io/codecov/c/github/azat-io/mootant.svg?color=b8f12a&labelColor=f4f2ec)](https://codecov.io/gh/azat-io/mootant)
@@ -25,12 +16,13 @@
25
16
  Find the gaps in your tests.
26
17
 
27
18
  Mutation testing for JavaScript and TypeScript. Mootant makes small changes to
28
- your code, called mutants, and runs your tests. If they still pass, the mutant
29
- survives, which points to a test that is missing or too weak.
19
+ your code and shows which ones your tests miss. Use the findings to strengthen
20
+ your tests, or let your coding agent add missing cases and verify them with
21
+ Mootant's agent skill.
30
22
 
31
23
  ## See what your tests miss
32
24
 
33
- Coverage shows that a line ran, not that a test would notice it change. In the
25
+ Tests can miss a bug even with full coverage. In the
34
26
  [sample shop](https://github.com/azat-io/mootant/tree/main/docs/demo), the tests
35
27
  run every line and branch of `src/discount.ts`, yet all of them still pass after
36
28
  Mootant makes this change:
@@ -40,36 +32,48 @@ Mootant makes this change:
40
32
  + if (total > 100 || isMember) {
41
33
  ```
42
34
 
43
- The tests cover small orders, large orders and members. None checks a
44
- non-member's order of exactly 100, where this change removes the discount. That
45
- is why this mutant survives.
35
+ No test checks a non-member's order of exactly 100, where this change removes
36
+ the discount. The change, called a mutant, survives because the tests miss it.
37
+
38
+ Mootant shows the diff and suggests `test/discount.test.ts` as the file to
39
+ extend. Add the missing boundary case:
46
40
 
47
- Mootant shows the change, suggests `test/discount.test.ts` as the file to extend
48
- and prints the mutant's id, so `--mutant q31p` re-checks it after you add the
49
- missing test.
41
+ ```ts
42
+ it('gives orders of exactly 100 a discount', () => {
43
+ expect(getDiscount(100, false)).toBe(10)
44
+ })
45
+ ```
46
+
47
+ Then re-check the mutant to confirm that your test catches it. Use the id from
48
+ your report; in this example, it is `q31p`:
49
+
50
+ ```sh
51
+ npx mootant run src --mutant q31p
52
+ ```
50
53
 
51
54
  ## Why Mootant
52
55
 
53
- - **Use your existing tests.** Mootant works with Vitest 5, Jest 29.7+ and Node
54
- Test, using your project's test configuration. With Vitest, it also tests Vue
55
- and Svelte components.
56
- - **Find hidden gaps.** Mootant mutates numbers, return values, `await`s and
57
- regular expressions, not just operators.
58
- - **Filter out noise.** Mootant skips duplicate and likely equivalent mutants,
59
- and by default leaves out loop changes it expects to hang.
60
- - **Follow each finding.** Reports show the code change and a suggested test
61
- file. Re-check one mutant as you improve the tests, or export JSON for tools
62
- and agents.
63
- - **Check your next change.** Mootant caches verdicts between runs. In CI, check
64
- changed lines with `--since` and set a passing score with `--threshold`.
56
+ - **Find hidden gaps.** Check edge cases in existing or AI-written tests.
57
+ - **Simulate common mistakes.** [Mutate](https://mootant.org/mutators) `await`s,
58
+ calls, return values and regular expressions.
59
+ - **Keep your setup.** Use your existing tests and configuration.
60
+ - **Less noise, faster reruns.** Skip duplicate and likely equivalent mutants,
61
+ and reuse cached verdicts.
62
+ - **Ready for CI.** Check changed lines with `--since` and enforce a minimum
63
+ score with `--threshold`.
65
64
 
66
65
  ## Getting started
67
66
 
68
67
  > **Early development.** Expect breaking changes.
69
68
 
70
- You need passing tests on **Vitest 5** (Node.js 22.12+, no browser mode), **Jest
71
- 29.7+** or **Node Test** (Node.js 20.19+ or 22.12+). See
72
- [compatibility](https://mootant.org/guide/compatibility) for other limits.
69
+ You need passing tests with one of these runners:
70
+
71
+ - **Vitest** 5, including Vue and Svelte components.
72
+ - **Jest** 29.7 or 30.
73
+ - **Node Test**, the test runner built into Node.js.
74
+
75
+ See [compatibility](https://mootant.org/guide/compatibility) for supported
76
+ Node.js versions and other limits.
73
77
 
74
78
  Install Mootant and point it at your source code:
75
79
 
@@ -78,49 +82,62 @@ npm install -D mootant
78
82
  npx mootant run src
79
83
  ```
80
84
 
81
- Mootant never writes to your source files. The report lists the mutants that
82
- survived, those no test reached and any errors. To see the mutants without
83
- running any test, use `npx mootant list src`.
85
+ Mootant applies mutations in memory, leaving your source files untouched. The
86
+ terminal report shows the changes your tests missed and suggests test files to
87
+ extend.
84
88
 
85
- Follow the [getting started guide](https://mootant.org/guide/getting-started) to
86
- turn a surviving mutant into a test that catches it.
89
+ ## Improve tests with your AI agent
87
90
 
88
- ## HTML report
91
+ Mootant ships with an [agent skill](https://mootant.org/agent-skill) for Claude
92
+ Code, Codex, Cursor and other coding agents. It guides your agent to read the
93
+ report, add missing tests and rerun Mootant to verify that they catch the
94
+ changes. You review the new tests.
89
95
 
90
- Browse each mutant in its code, see what your tests reach and find the files
91
- with the lowest scores. Add `--html` to write `.mootant/report.html`, a single
92
- file that opens offline:
96
+ With Mootant installed in your project, install the skill (Node.js 22.20+):
93
97
 
94
98
  ```sh
95
- npx mootant run src --html
99
+ npx skills add azat-io/mootant
96
100
  ```
97
101
 
98
- Add `.mootant` to `.gitignore`: the report holds your source code.
99
-
100
- <a href="https://mootant.org/report/demo">
101
- <picture>
102
- <source
103
- srcset="https://raw.githubusercontent.com/azat-io/mootant/main/docs/public/report-overview-dark.webp"
104
- media="(prefers-color-scheme: dark)"
105
- />
106
- <img
107
- src="https://raw.githubusercontent.com/azat-io/mootant/main/docs/public/report-overview-light.webp"
108
- alt="Mootant report for a sample shop, showing surviving mutants and the mutators its tests miss."
109
- width="900"
110
- />
111
- </picture>
112
- </a>
102
+ Then ask your agent:
103
+
104
+ ```text
105
+ Fix the surviving mutants in src.
106
+ ```
113
107
 
114
- [Explore the demo report](https://mootant.org/report/demo) or
115
- [learn about the HTML report](https://mootant.org/guide/report).
108
+ ## Check changes in CI
116
109
 
117
- ## Documentation
110
+ Check the lines changed in a pull request and fail CI if their mutation score
111
+ falls below a threshold:
118
112
 
119
- - [CLI reference](https://mootant.org/guide/cli)
120
- - [Configuration](https://mootant.org/guide/configuration)
121
- - [Mutators](https://mootant.org/mutators) and
122
- [ignore comments](https://mootant.org/mutators#ignore-mutants)
123
- - [Supported runners and frameworks](https://mootant.org/guide/compatibility)
113
+ ```sh
114
+ npx mootant run src --since origin/main --threshold 80
115
+ ```
116
+
117
+ This requires a score of at least 80%. Replace `origin/main` with your target
118
+ branch and fetch it with enough history to find the merge base. See the
119
+ [CLI reference](https://mootant.org/guide/cli#shared-options) for details.
120
+
121
+ ## Explore the HTML report
122
+
123
+ Find the files with the weakest scores, inspect each mutant in its code and see
124
+ which tests reach it. Generate the report with:
125
+
126
+ ```sh
127
+ npx mootant run src --html
128
+ ```
129
+
130
+ Mootant writes `.mootant/report.html`, a single file you can open offline or
131
+ keep as a CI artifact. Add `.mootant` to `.gitignore`: the report includes your
132
+ source code.
133
+
134
+ <a href="https://mootant.org/reports/html/demo">
135
+ <img
136
+ src="https://raw.githubusercontent.com/azat-io/mootant/main/docs/public/report-overview-light.webp"
137
+ alt="Mootant HTML report showing mutation scores and surviving mutants in a sample shop."
138
+ width="900"
139
+ />
140
+ </a>
124
141
 
125
142
  ## Contributing
126
143
 
@@ -74,29 +74,37 @@ wrap redirects in `cmd /c "..."`, since its `>` writes UTF-16.
74
74
  node -e "const fs=require('fs');fs.mkdirSync('.mootant',{recursive:true});fs.existsSync('.mootant/.gitignore')||fs.writeFileSync('.mootant/.gitignore','*')"
75
75
 
76
76
  # The first run
77
- <mootant> run [<paths>] [--since <base>] --no-fast --no-incremental [--mutant <id>] --json > .mootant/before.json 2> .mootant/before.log
77
+ <mootant> run [<paths>] [--since <base>] --no-fast --no-incremental --no-parallel-units [--mutant <id>] --json > .mootant/before.json 2> .mootant/before.log
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
- # A recheck: the mutant's recheck with <mootant> in place of mootant, always with --no-fast --no-incremental
84
- <mootant> run [<paths>] --no-fast --no-incremental --mutant <id> [--mutant <id>] --json --all > .mootant/recheck.json 2> .mootant/recheck.log
83
+ # A recheck: the mutant's recheck with <mootant> in place of mootant, always with --no-fast --no-incremental --no-parallel-units
84
+ <mootant> run [<paths>] --no-fast --no-incremental --no-parallel-units --mutant <id> [--mutant <id>] --json --all > .mootant/recheck.json 2> .mootant/recheck.log
85
85
 
86
86
  # The last run: the first run's command with --all, then the final status of full ids and any new problem ids
87
- <mootant> run [<paths>] [--since <base>] --no-fast --no-incremental [--mutant <id>] --json --all > .mootant/after.json 2> .mootant/after.log
87
+ <mootant> run [<paths>] [--since <base>] --no-fast --no-incremental --no-parallel-units [--mutant <id>] --json --all > .mootant/after.json 2> .mootant/after.log
88
88
  node -e "const b=require('./.mootant/before.json').mutants.map(m=>m.id),a=require('./.mootant/after.json').mutants;for(const id of process.argv.slice(1))console.log(id,(a.find(m=>m.id===id)||{status:'missing'}).status);for(const m of a)if(!b.includes(m.id)&&['Survived','NoCoverage','Error'].includes(m.status))console.log('new',m.id,m.status)" <id> <id>
89
89
  ```
90
90
 
91
- A mutant in the report has `id`, `file`, `line`, `mutator`, `status`, `before`
92
- and `after` (its source lines; `…` marks a cut), `scope` (the function or
93
- constant), `focus` (the part that changes, when smaller than the line), `test`
94
- (the first covering test: file, name, line), `testFiles` (an object of test
95
- files to extend, best first, each with its number of covering tests), `tests`
96
- (covering tests; 0 on a survivor means only module loading, a setup file or a
97
- hook such as `beforeAll` reached it) and `recheck`. With `--all`, killed and
98
- timed-out mutants keep only `id`, `file`, `line`, `column`, `mutator`, `status`
99
- and `killedIn`.
91
+ A mutant in the report has these fields:
92
+
93
+ | Field | Meaning |
94
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
95
+ | `id` | Mutant id |
96
+ | `file`, `line` | Source file and line |
97
+ | `mutator`, `status` | Mutator name and run verdict |
98
+ | `before`, `after` | Source lines before and after the change; `…` marks a cut |
99
+ | `scope` | The function or constant containing the mutant |
100
+ | `focus` | The part that changes, when smaller than the line |
101
+ | `test` | The first covering test: file, name and line |
102
+ | `testFiles` | An object of test files to extend, best first, each with its number of covering tests |
103
+ | `tests` | Number of covering tests. On a survivor, 0 means only module loading, a setup file or a hook such as `beforeAll` reached it |
104
+ | `recheck` | Command to run the mutant again |
105
+
106
+ With `--all`, killed and timed-out mutants keep only `id`, `file`, `line`,
107
+ `column`, `mutator`, `status` and `killedIn`.
100
108
 
101
109
  | Recheck status | Meaning |
102
110
  | ------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
@@ -127,9 +135,9 @@ smaller path, list the rest as not reached.
127
135
  when git does not track it.
128
136
  2. **Run once**, as Start says, in the background or with the longest timeout,
129
137
  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.
138
+ it with the lines under it and stop. `schemaVersion` other than 3 or 4: stop,
139
+ this skill does not fit this Mootant. No mutants to act on and no errors: say
140
+ so and stop.
133
141
  3. **Ledger.** One row per id with verdict `pending`; the report keeps the rest.
134
142
  Over 20 rows: tell the user the counts per file and work file by file in the
135
143
  report's order.
@@ -187,23 +195,34 @@ outputs in a throwaway test and recheck: `Killed` or `Timeout` means you found a
187
195
  real test, so keep it; otherwise delete the throwaway test.
188
196
 
189
197
  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.
198
+ one id; a mutant is on its `line`, and one of `kind` `element` or `property` on
199
+ the line of its `focus`. Before you propose
200
+ `// mootant-ignore-next-line <mutator>: <reason>`, with mutator names separated
201
+ by commas and never without one, list what it would hide with
202
+ `<mootant> list <file> --json --verbose`, which gives `kind`. Propose it only
203
+ when each of those mutants is equivalent, and show the user each one with its
204
+ reason. When the user approves, add the comment and list the file again: the new
205
+ `Ignored` mutants must be exactly the ones you showed, with no
206
+ `malformed-directive` or `unknown-mutator` in `diagnostics`. A coarse mutant
207
+ that comes back gets its own row.
198
208
 
199
209
  ## Report
200
210
 
201
- Scope and command; the score of that scope before → after, with the counts of
202
- errors and `Error` mutants, which leave the score; killed, confirmed by the last
203
- run; needs your decision (pinned, suspected bugs, equivalent mutants with any
204
- proposed ignore comment and the mutants it hides, installing); could not kill;
205
- not testable; not reached; changed files. Commit, push or open a pull request
206
- only when the user asks.
211
+ Include these parts in the report:
212
+
213
+ - Scope and command.
214
+ - The score of that scope before → after, with the counts of errors and `Error`
215
+ mutants. `Error` mutants are excluded from the score.
216
+ - Killed mutants, confirmed by the last run.
217
+ - Needs your decision: pinned tests, suspected bugs, equivalent mutants and
218
+ anything that needs installing. For a proposed ignore comment, list every
219
+ mutant it would hide and why each is equivalent.
220
+ - Could not kill.
221
+ - Not testable.
222
+ - Not reached.
223
+ - Changed files.
224
+
225
+ Commit, push or open a pull request only when the user asks.
207
226
 
208
227
  ## Common mistakes
209
228