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