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
@@ -82,9 +82,10 @@ function a(a, c) {
82
82
  preset: a.preset,
83
83
  since: a.since,
84
84
  mode: a.mode,
85
+ ...a.parallelUnits && { parallelUnits: !0 },
85
86
  files: l.files,
86
87
  ...l.skipped && { skipped: l.skipped },
87
- schemaVersion: 3,
88
+ schemaVersion: 4,
88
89
  command: "run",
89
90
  mutants: f
90
91
  };
@@ -2,6 +2,11 @@
2
2
  * Options of a command that change what it does, as a report shows them.
3
3
  */
4
4
  interface CommandOptions {
5
+ /**
6
+ * Whether units of one test file run at once, from `--parallel-units` or
7
+ * `--no-parallel-units`.
8
+ */
9
+ parallelUnits?: boolean;
5
10
  /**
6
11
  * Whether verdicts are reused by region, from `--incremental` or
7
12
  * `--no-incremental`.
@@ -5,7 +5,7 @@ function t(e, t) {
5
5
  e,
6
6
  ...t.paths.map(n)
7
7
  ];
8
- if (t.config !== void 0 && r.push("--config", n(t.config)), t.preset !== void 0 && r.push("--preset", n(t.preset)), t.since !== void 0 && r.push("--since", n(t.since)), t.skipped === !0 && r.push("--skipped"), t.fast !== void 0 && r.push(t.fast ? "--fast" : "--no-fast"), t.incremental !== void 0 && r.push(t.incremental ? "--incremental" : "--no-incremental"), t.threshold !== void 0 && r.push("--threshold", String(t.threshold)), t.concurrency !== void 0 && r.push("--concurrency", String(t.concurrency)), t.mutantIds !== void 0) for (let e of t.mutantIds) r.push("--mutant", n(e));
8
+ if (t.config !== void 0 && r.push("--config", n(t.config)), t.preset !== void 0 && r.push("--preset", n(t.preset)), t.since !== void 0 && r.push("--since", n(t.since)), t.skipped === !0 && r.push("--skipped"), t.fast !== void 0 && r.push(t.fast ? "--fast" : "--no-fast"), t.parallelUnits !== void 0 && r.push(t.parallelUnits ? "--parallel-units" : "--no-parallel-units"), t.incremental !== void 0 && r.push(t.incremental ? "--incremental" : "--no-incremental"), t.threshold !== void 0 && r.push("--threshold", String(t.threshold)), t.concurrency !== void 0 && r.push("--concurrency", String(t.concurrency)), t.mutantIds !== void 0) for (let e of t.mutantIds) r.push("--mutant", n(e));
9
9
  return r.join(" ");
10
10
  }
11
11
  function n(t) {
@@ -1,5 +1,5 @@
1
1
  import { TextStyle } from '../../types/cli/text-style.js';
2
- import { Color } from '../terminal/colors.js';
2
+ import { Color } from '../terminal/create-colors.js';
3
3
  /**
4
4
  * One mutant or skipped candidate of a report, before its columns are aligned.
5
5
  */
@@ -38,10 +38,11 @@ export interface RunTextOptions {
38
38
  /**
39
39
  * Formats a run report as text: a header with the command and the test runner;
40
40
  * the dry run, the mutants with how many were ignored or reused from the cache,
41
- * and time; the counts by status and the score; in a terminal, the files with
42
- * the lowest scores below 100, five at most; a section for each status to act
43
- * on (`survived`, `no coverage`, `errors`) with its count and its mutants
44
- * grouped by file, each as a diff of its source lines under a heading with the
41
+ * and time, which names fast mode and parallel units when they were on; the
42
+ * counts by status and the score; in a terminal, the files with the lowest
43
+ * scores below 100, five at most; a section for each status to act on
44
+ * (`survived`, `no coverage`, `errors`) with its count and its mutants grouped
45
+ * by file, each as a diff of its source lines under a heading with the
45
46
  * location, mutator and short id, the reason of an error or the likeliest test
46
47
  * file to extend of another mutant under the diff; and a hint to re-check the
47
48
  * first survivor, else the first listed mutant. Killed, timed-out and ignored
@@ -55,25 +55,25 @@ function p(e, t) {
55
55
  }, _, i)}\n\n${_}`;
56
56
  }
57
57
  function m(e, t) {
58
- let { summary: n } = e, { duration: r } = n, a = n.totalIgnored > 0 ? `, ${n.totalIgnored} ignored` : "", o = n.totalCached !== null && n.totalCached > 0 ? `, ${n.totalCached} cached` : "", c = [
58
+ let { summary: n } = e, { duration: r } = n, a = n.totalIgnored > 0 ? `, ${n.totalIgnored} ignored` : "", o = n.totalCached !== null && n.totalCached > 0 ? `, ${n.totalCached} cached` : "", c = n.runs.dry === void 0 && n.totalTests > 0, l = [
59
59
  `start ${s(r.startup)}`,
60
60
  `dry run ${s(r.dryRun)}`,
61
61
  ...r.batch === null ? [] : [`batch ${s(r.batch)}`],
62
62
  `isolated ${s(r.isolated)}`
63
- ], l = [
64
- ["dry run", `${i(n.totalTests, "test")} in ${s(r.dryRun)}`],
63
+ ], u = [
64
+ ["dry run", c ? `${i(n.totalTests, "test")} of an earlier run` : `${i(n.totalTests, "test")} in ${s(r.dryRun)}`],
65
65
  ["mutants", `${n.totalMutants} in ${i(n.totalFiles, "file")}${a}${o}`],
66
- ["time", `${s(r.total)}${e.mode === "fast" ? " in fast mode" : ""} (${c.join(", ")})`]
67
- ], { staticCost: u } = n;
68
- if (u.length > 0 && r.total >= 3e4 && r.isolated > r.total * .25) {
69
- let e = Math.max(1, u.reduce((e, t) => e + t.duration, 0));
70
- l.push(["most test time", u.slice(0, 3).map((t) => `${t.file} ${Math.round(t.duration / e * 100)}%`).join(", ")]);
66
+ ["time", `${s(r.total)}${e.mode === "fast" ? " in fast mode" : ""}${e.parallelUnits ? " with parallel units" : ""} (${l.join(", ")})`]
67
+ ], { staticCost: d } = n;
68
+ if (d.length > 0 && r.total >= 3e4 && r.isolated > r.total * .25) {
69
+ let e = Math.max(1, d.reduce((e, t) => e + t.duration, 0));
70
+ u.push(["most test time", d.slice(0, 3).map((t) => `${t.file} ${Math.round(t.duration / e * 100)}%`).join(", ")]);
71
71
  }
72
72
  if (t) {
73
73
  let e = f.filter((e) => n.runs[e] !== void 0).map((e) => `${n.runs[e]} ${e}`);
74
- l.push(["runs", e.length === 0 ? "none" : e.join(", ")]);
74
+ u.push(["runs", e.length === 0 ? "none" : e.join(", ")]);
75
75
  }
76
- return l;
76
+ return u;
77
77
  }
78
78
  function h(n, o) {
79
79
  let { colors: s } = o, { ellipsis: c } = a(o.unicode), l = n.slice(0, 5), u = Math.min(e(l.map((e) => e.file)), Math.max(16, o.width - 38)), d = l.map((e) => {
@@ -3,16 +3,16 @@ import { RunReport } from '../../types/report/run-report.js';
3
3
  /**
4
4
  * Shapes a run report as `--json` prints it: the counts and scores with the
5
5
  * total duration, the schema version, diagnostics, command, which mutants are
6
- * listed, runner, preset, mode, the `--since` revision when given and, last, so
7
- * that output cut short keeps the rest, the mutants. A mutant to act on or an
8
- * ignored one keeps its position, mutator, status, scope, source lines and
9
- * focus (`slimListMutant`), the ignore directive and its reason, the message
10
- * and cause of the verdict, `path` only for a batch verdict, the number of
11
- * covering tests, its likeliest test files, the first covering test and the
12
- * re-check command, each only when set. A killed or timed-out mutant, listed
13
- * with `--all`, keeps only its position, mutator, status, the test file that
14
- * killed it and a batch `path`. Fields that are null are left out; the full
15
- * report is what `--json --verbose` prints.
6
+ * listed, runner, preset, mode, parallel units when they were on, the `--since`
7
+ * revision when given and, last, so that output cut short keeps the rest, the
8
+ * mutants. A mutant to act on or an ignored one keeps its position, mutator,
9
+ * status, scope, source lines and focus (`slimListMutant`), the ignore
10
+ * directive and its reason, the message and cause of the verdict, `path` only
11
+ * for a batch verdict, the number of covering tests, its likeliest test files,
12
+ * the first covering test and the re-check command, each only when set. A
13
+ * killed or timed-out mutant, listed with `--all`, keeps only its position,
14
+ * mutator, status, the test file that killed it and a batch `path`. Fields that
15
+ * are null are left out; the full report is what `--json --verbose` prints.
16
16
  *
17
17
  * @param report - Full report of a run.
18
18
  * @returns Report as `--json` prints it.
@@ -28,6 +28,7 @@ function t(e) {
28
28
  runner: e.runner,
29
29
  preset: e.preset,
30
30
  mode: e.mode,
31
+ ...e.parallelUnits && { parallelUnits: !0 },
31
32
  ...e.since !== null && { since: e.since },
32
33
  mutants: t
33
34
  };
@@ -11,7 +11,11 @@ import { RunOptions } from './parse-arguments.js';
11
11
  * --verbose` the full one. A terminal also gets the files with the lowest
12
12
  * scores. When the run asks for an HTML report, it is written after the report
13
13
  * is printed and its path goes to stderr; a report that cannot be written is an
14
- * error.
14
+ * error. SIGHUP, SIGINT or SIGTERM during the run (`watchInterrupts`) ends the
15
+ * progress at once, without the line of the running phase, and interrupts the
16
+ * run, which stops its test processes and removes its files; then nothing is
17
+ * printed and the process ends by that signal, after 5 seconds even when the
18
+ * cleanup did not end.
15
19
  *
16
20
  * @param options - Options of the run command.
17
21
  */
@@ -1,72 +1,80 @@
1
1
  import { getShortIdLength as e } from "./report/get-short-id-length.js";
2
2
  import { printDiagnostics as t } from "./report/print-diagnostics.js";
3
3
  import { formatRunReport as n } from "./report/format-run-report.js";
4
- import { buildHtmlReport as r } from "./html/build-html-report.js";
5
- import { writeHtmlReport as i } from "./html/write-html-report.js";
6
- import { readProjectName as a } from "./html/read-project-name.js";
7
- import { buildRunReport as o } from "./report/build-run-report.js";
8
- import { createRunProgress as s } from "./create-run-progress.js";
9
- import { getFileScores as c } from "./report/get-file-scores.js";
10
- import { getBuiltInAdapters as l } from "./built-in-adapters.js";
4
+ import { getBuiltInAdapters as r } from "./get-built-in-adapters.js";
5
+ import { buildHtmlReport as i } from "./html/build-html-report.js";
6
+ import { writeHtmlReport as a } from "./html/write-html-report.js";
7
+ import { readProjectName as o } from "./html/read-project-name.js";
8
+ import { buildRunReport as s } from "./report/build-run-report.js";
9
+ import { createRunProgress as c } from "./create-run-progress.js";
10
+ import { getFileScores as l } from "./report/get-file-scores.js";
11
11
  import { getTextStyle as u } from "./terminal/get-text-style.js";
12
12
  import { formatCommand as d } from "./report/format-command.js";
13
- import { runMutants as f } from "../core/run-mutants.js";
14
- import { version as p } from "../package.js";
15
- import m from "node:path";
16
- async function h(r) {
17
- let { verbose: i, json: a, all: p, ...m } = r, h = u(process.stderr), _ = s(h, i);
13
+ import { watchInterrupts as f } from "./watch-interrupts.js";
14
+ import { runMutants as p } from "../core/run-mutants.js";
15
+ import { version as m } from "../package.js";
16
+ import h from "node:path";
17
+ async function g(i) {
18
+ let { verbose: a, json: o, all: m, ...h } = i, g = u(process.stderr), v = f(), y = c(g, a);
19
+ v.signal.addEventListener("abort", () => {
20
+ y.stop();
21
+ });
18
22
  try {
19
- let s = await f({
23
+ let c = await p({
20
24
  onProgress: (e) => {
21
- _.handle(e);
25
+ y.handle(e);
22
26
  },
23
- builtIns: l(),
24
- ...m,
27
+ builtIns: r(),
28
+ signal: v.signal,
29
+ ...h,
25
30
  cwd: process.cwd()
26
31
  });
27
- _.finish();
28
- let v = d("run", {
29
- incremental: r.incremental,
30
- config: r.config,
31
- preset: r.preset,
32
- paths: r.paths,
33
- fast: r.fast
34
- }), y = o(s, {
35
- recheck: v,
36
- all: p
32
+ if (v.end()) return;
33
+ y.finish();
34
+ let f = d("run", {
35
+ parallelUnits: i.parallelUnits,
36
+ incremental: i.incremental,
37
+ config: i.config,
38
+ preset: i.preset,
39
+ paths: i.paths,
40
+ fast: i.fast
41
+ }), b = s(c, {
42
+ recheck: f,
43
+ all: m
37
44
  });
38
- a || t(y.diagnostics, h), console.info(n(y, a ? "json" : "text", {
39
- ...!a && process.stdout.isTTY && { files: c(s) },
40
- idLength: e(s.listedIds),
41
- command: d("run", r),
45
+ o || t(b.diagnostics, g), console.info(n(b, o ? "json" : "text", {
46
+ ...!o && process.stdout.isTTY && { files: l(c) },
47
+ idLength: e(c.listedIds),
48
+ command: d("run", i),
42
49
  style: u(process.stdout),
43
- verbose: i,
44
- recheck: v
45
- })), y.summary.passed || (process.exitCode = 1), s.html !== null && await g(s, s.html, {
46
- command: `${d("run", r)}${r.html ? " --html" : ""}`,
47
- style: h,
48
- recheck: v
50
+ verbose: a,
51
+ recheck: f
52
+ })), b.summary.passed || (process.exitCode = 1), c.html !== null && await _(c, c.html, {
53
+ command: `${d("run", i)}${i.html ? " --html" : ""}`,
54
+ style: g,
55
+ recheck: f
49
56
  });
50
57
  } catch (e) {
51
- _.finish();
52
- let t = _.output(), { colors: n } = h;
58
+ if (v.end()) return;
59
+ y.finish();
60
+ let t = y.output(), { colors: n } = g;
53
61
  t.trim() !== "" && console.error(`${n.gray("Output of the tests:")}\n${t.replace(/\n$/u, "")}\n`), console.error(`${n.red("Error:")} ${e.message}`), process.exitCode = 1;
54
62
  }
55
63
  }
56
- async function g(t, n, o) {
57
- let { colors: s } = o.style, c = /* @__PURE__ */ new Date();
64
+ async function _(t, n, r) {
65
+ let { colors: s } = r.style, c = /* @__PURE__ */ new Date();
58
66
  try {
59
- let l = r(t, {
67
+ let l = i(t, {
60
68
  idLength: e(t.listedIds),
61
- project: a(t.root),
62
- recheck: o.recheck,
63
- command: o.command,
69
+ project: o(t.root),
70
+ recheck: r.recheck,
71
+ command: r.command,
64
72
  date: c.toISOString(),
65
- version: p
73
+ version: m
66
74
  }), { formatHtmlReport: u } = await import("./html/format-html-report.js");
67
- await i(n, u(l)), console.error(`${s.gray("html report:")} ${m.relative(process.cwd(), n)}`);
75
+ await a(n, u(l)), console.error(`${s.gray("html report:")} ${h.relative(process.cwd(), n)}`);
68
76
  } catch (e) {
69
77
  console.error(`${s.red("Error:")} The HTML report could not be written to ${n}: ${e.message}`), process.exitCode = 1;
70
78
  }
71
79
  }
72
- export { h as runMutation };
80
+ export { g as runMutation };
@@ -1,4 +1,4 @@
1
- import { ColorName, Color } from './colors.js';
1
+ import { ColorName, Color } from './create-colors.js';
2
2
  /**
3
3
  * Progress line that the CLI shows on standard error while a command works.
4
4
  */
@@ -27,8 +27,7 @@ export interface Spinner {
27
27
  * In an interactive terminal the spinner redraws its row every 80 ms with the
28
28
  * cursor hidden, asking for its text on every frame, so the text may show a
29
29
  * live clock. Elsewhere it never animates: only the lines given to `print` are
30
- * written. While it runs, SIGINT and SIGTERM erase it and show the cursor
31
- * before the process exits.
30
+ * written.
32
31
  *
33
32
  * @param text - Gives the text next to the animation; called on every frame.
34
33
  * @param colors - Color functions of the CLI.
@@ -17,46 +17,37 @@ const r = [
17
17
  "\\",
18
18
  "|",
19
19
  "/"
20
- ], a = "\x1B[2K\x1B[1G", o = [["SIGINT", 130], ["SIGTERM", 143]];
21
- function s(s, c) {
22
- let l = process.stderr, u = e(), d = t() ? r : i, f = 0, p = 0, m = !1, h, g = [];
23
- function _() {
20
+ ], a = "\x1B[2K\x1B[1G";
21
+ function o(o, s) {
22
+ let c = process.stderr, l = e(), u = t() ? r : i, d = 0, f = 0, p = !1, m;
23
+ function h() {
24
24
  let e = "\x1B[1G";
25
- for (let t = 0; t < p; t++) e += t === 0 ? a : `${a}`;
26
- return p = 0, e;
25
+ for (let t = 0; t < f; t++) e += t === 0 ? a : `${a}`;
26
+ return f = 0, e;
27
27
  }
28
- function v() {
29
- return `${c.greenBright(d[f])} ${s()}`;
28
+ function g() {
29
+ return `${s.greenBright(u[d])} ${o()}`;
30
30
  }
31
- function y() {
32
- let e = v();
33
- h = setTimeout(y, 80), l.write(`[?25l${_()}${e}`), p = n(e, l.columns), f = (f + 1) % d.length;
31
+ function _() {
32
+ let e = g();
33
+ m = setTimeout(_, 80), c.write(`[?25l${h()}${e}`), f = n(e, c.columns), d = (d + 1) % u.length;
34
34
  }
35
- let b = {
36
- start() {
37
- if (!u) return b;
38
- for (let [e, t] of o) {
39
- let n;
40
- process.on(e, n = () => {
41
- b.stop(), process.exit(t);
42
- }), g.push([e, n]);
35
+ let v = {
36
+ print(e) {
37
+ if (!p) {
38
+ c.write(`${e}\n`);
39
+ return;
43
40
  }
44
- return m = !0, y(), b;
41
+ let t = g();
42
+ c.write(`${h()}${e}\n${t}`), f = n(t, c.columns);
45
43
  },
46
44
  stop() {
47
- clearTimeout(h);
48
- for (let [e, t] of g) process.off(e, t);
49
- g = [], m && (m = !1, l.write(`${_()}[?25h`));
45
+ clearTimeout(m), p && (p = !1, c.write(`${h()}[?25h`));
50
46
  },
51
- print(e) {
52
- if (!m) {
53
- l.write(`${e}\n`);
54
- return;
55
- }
56
- let t = v();
57
- l.write(`${_()}${e}\n${t}`), p = n(t, l.columns);
47
+ start() {
48
+ return l && (p = !0, _()), v;
58
49
  }
59
50
  };
60
- return b;
51
+ return v;
61
52
  }
62
- export { s as createSpinner };
53
+ export { o as createSpinner };
@@ -1,15 +1,15 @@
1
- import { isUnicodeSupported as e } from "./is-unicode-supported.js";
2
- import { createColors as t, isColorSupported as n } from "./colors.js";
1
+ import { createColors as e, isColorSupported as t } from "./create-colors.js";
2
+ import { isUnicodeSupported as n } from "./is-unicode-supported.js";
3
3
  function r(r) {
4
4
  let { platform: i, argv: a, env: o } = process, s = Infinity;
5
5
  return r.isTTY === !0 && (s = (r.columns ?? 0) > 0 ? r.columns : 80), {
6
- colors: t(n({
6
+ colors: e(t({
7
7
  stdout: r,
8
8
  platform: i,
9
9
  argv: a,
10
10
  env: o
11
11
  })),
12
- unicode: e(),
12
+ unicode: n(),
13
13
  width: s
14
14
  };
15
15
  }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Watch of the signals that interrupt a run.
3
+ */
4
+ interface Interrupts {
5
+ /**
6
+ * Aborted on the first signal.
7
+ */
8
+ signal: AbortSignal;
9
+ /**
10
+ * Ends the watch once the run is over. Without a signal, it removes the
11
+ * listeners of the watch and returns false. After a signal, it ends the
12
+ * process by that signal, as the process would end without the listeners;
13
+ * where the signal does not end it, on Windows, which cannot raise a signal
14
+ * again, or while another listener of the signal remains, it exits with the
15
+ * code a shell gives for the signal, 128 plus its number.
16
+ *
17
+ * @returns False when no signal came.
18
+ */
19
+ end(): boolean;
20
+ }
21
+ /**
22
+ * Watches SIGHUP, SIGINT and SIGTERM for a run, so that it can stop its test
23
+ * processes and remove its files before the process ends. The first signal sets
24
+ * the exit code a shell gives for it, 128 plus its number, and aborts the
25
+ * returned signal; later ones are ignored while the run cleans up, since npm
26
+ * and other wrappers send the terminal's SIGINT a second time. The cleanup gets
27
+ * 5 seconds: past them, such as when a global teardown hangs, the work
28
+ * directories of the run are removed at once (`removeLiveWorkDirectories`) and
29
+ * the process ends by the signal anyway. They are removed too when something
30
+ * else ends the process meanwhile, such as a listener of the project's code
31
+ * that exits. The listeners stay until the process ends, as a listener that
32
+ * removed itself would let other listeners raise the signal again before the
33
+ * cleanup. SIGQUIT, the quit key, keeps ending the process at once. Errors of
34
+ * writes to standard error are ignored from the start: after a terminal closed
35
+ * a write fails with EIO, which would otherwise end the process before the run
36
+ * cleaned up.
37
+ *
38
+ * @returns The watch, with the signal to pass to the run.
39
+ */
40
+ export declare function watchInterrupts(): Interrupts;
41
+ export {};
@@ -0,0 +1,32 @@
1
+ import { removeLiveWorkDirectories as e } from "../core/run/remove-live-work-directories.js";
2
+ import { constants as t } from "node:os";
3
+ const n = [
4
+ "SIGHUP",
5
+ "SIGINT",
6
+ "SIGTERM"
7
+ ];
8
+ function r() {
9
+ let r = new AbortController(), i = null, a;
10
+ function o(n) {
11
+ i === null && (i = n, process.exitCode = 128 + t.signals[n], a = setTimeout(() => {
12
+ e(), s(n);
13
+ }, 5e3), r.abort());
14
+ }
15
+ function s(e) {
16
+ clearTimeout(a);
17
+ for (let e of n) process.off(e, o);
18
+ process.platform !== "win32" && process.kill(process.pid, e), process.exit();
19
+ }
20
+ function c() {}
21
+ process.stderr.on("error", c), process.on("exit", e);
22
+ for (let e of n) process.on(e, o);
23
+ return {
24
+ end: () => {
25
+ if (i !== null) return s(i), !0;
26
+ for (let e of n) process.off(e, o);
27
+ return process.off("exit", e), process.stderr.off("error", c), !1;
28
+ },
29
+ signal: r.signal
30
+ };
31
+ }
32
+ export { r as watchInterrupts };
@@ -2,13 +2,14 @@ import { RunState } from '../../types/run/run-state.js';
2
2
  /**
3
3
  * Applies cached isolated evidence before the isolated rounds, by the rule of
4
4
  * fresh units (`decideEvidence`): for every undecided mutant on the isolated
5
- * path, a valid cached kill in one of its test files is that file's evidence,
6
- * and a valid cached reached pass counts as `Survived` evidence; either takes
7
- * its test file off the list. The cache never holds a timeout or an error, so a
8
- * file before the first cached kill without a valid entry still runs, and the
9
- * kill decides only if that file brings no kill or timeout of its own; files
10
- * after the first cached kill can no longer decide and are dropped. A mutant
11
- * left with nothing to run that never ran is `cached`.
5
+ * path, a valid cached kill or timeout in one of its test files is that file's
6
+ * evidence, and a valid cached reached pass counts as `Survived` evidence;
7
+ * either takes its test file off the list. The cache holds no error and no
8
+ * timeout but a confirmed one by the hit limit, so a file before the first
9
+ * cached kill or timeout without a valid entry still runs, and the cached one
10
+ * decides only if that file brings no kill or timeout of its own; files after
11
+ * it can no longer decide and are dropped. A mutant left with nothing to run
12
+ * that never ran is `cached`.
12
13
  *
13
14
  * @param state - State of the run with its cache, updated in place.
14
15
  */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hash of the code of mootant's build, which the build writes in place of this
3
+ * text (`vite.config.ts`), so a reinstall of the same package keeps the cache
4
+ * keys and a build of other code under the same version changes them. Sources
5
+ * keep this text, and `getBuildId` gives them an id of their own. Pass it on
6
+ * only as a value: the build may inline a constant that code compares and fold
7
+ * the comparison before the hash is written.
8
+ */
9
+ export declare const BUILD_HASH: string;
@@ -0,0 +1,2 @@
1
+ const e = "da443aa26f1c6d9598091e6e9f5a8fb4da4a1e016744b73109e0571e0c5a03b0";
2
+ export { e as BUILD_HASH };
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Version of the cache file format and of the recipe of its keys; it is part of
3
- * the file name, so a file of another version is never read. Bump it when
4
- * either changes.
2
+ * Version of the format of the cache file and of the saved dry run, and of the
3
+ * recipe of their keys; it is part of their file names, so a file of another
4
+ * version is never read. Bump it when any of them changes.
5
5
  */
6
- export declare const CACHE_VERSION = 3;
6
+ export declare const CACHE_VERSION = 8;
@@ -0,0 +1,25 @@
1
+ import { ProjectTree } from '../../types/cache/project-tree.js';
2
+ import { DrySnapshot } from '../../types/cache/dry-snapshot.js';
3
+ /**
4
+ * Tells whether the inputs of a saved dry run (`DrySnapshot`) are unchanged,
5
+ * the cheapest check first, before a run builds its switched files for the key:
6
+ * the environment variables of the main process, the files the dry run and the
7
+ * cache keys depended on, then everything under the project root
8
+ * (`hashProjectTree`), which a run that starts the test runner hashes anyway. A
9
+ * file that is now a device, a pipe or a socket (`UNKNOWN_HASH`) has another
10
+ * hash than any saved one, which never names such a file.
11
+ *
12
+ * @param snapshot - Saved dry run of an earlier run.
13
+ * @param run - Environment, root and tree of this run.
14
+ * @param run.environment - Environment variables of the main process as the run
15
+ * started, before a test runner could set any.
16
+ * @param run.root - Project root, for the paths of the reason.
17
+ * @param run.tree - Hashes everything under the project root, once per run.
18
+ * @returns Null when the inputs are unchanged, else the end of a sentence that
19
+ * tells what changed, such as `src/a.test.ts changed`.
20
+ */
21
+ export declare function checkDrySnapshot(snapshot: DrySnapshot, run: {
22
+ tree(): Promise<ProjectTree | null>;
23
+ environment: NodeJS.ProcessEnv;
24
+ root: string;
25
+ }): Promise<string | null>;
@@ -0,0 +1,13 @@
1
+ import { listVariableHashes as e } from "./list-variable-hashes.js";
2
+ import { getDisplayPath as t } from "../run/get-display-path.js";
3
+ import { createDigest as n } from "./create-digest.js";
4
+ import { hashFiles as r } from "./hash-files.js";
5
+ async function i(i, a) {
6
+ let o = e(i.variables.map(([e]) => e), a.environment);
7
+ if (n(o) !== n(i.variables)) return "an environment variable changed";
8
+ let s = await r(i.files.map(([e]) => e)), c = i.files.find(([e, t]) => s.get(e) !== t);
9
+ if (c !== void 0) return `${t(c[0], a.root)} changed`;
10
+ let l = await a.tree();
11
+ return l === null ? "mootant cannot read every directory and link of the project" : l.hash === i.tree ? null : "a file of the project was added, removed or changed";
12
+ }
13
+ export { i as checkDrySnapshot };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Creates the error thrown inside a run that replays a saved dry run once the
3
+ * saved dry run turns out to be stale, a mutant has no valid cached verdict and
4
+ * needs the test runner, or the replay fails otherwise. The run then starts
5
+ * over with the test runner; nothing ran or was written before. The message is
6
+ * the note the run gives.
7
+ *
8
+ * @param reason - Why the saved dry run cannot decide the run, as the end of a
9
+ * sentence, such as `src/a.test.ts changed`.
10
+ * @returns Error named `DryReuseMiss`.
11
+ */
12
+ export declare function createDryReuseMiss(reason: string): Error;
@@ -0,0 +1,7 @@
1
+ var e = class extends Error {
2
+ name = "DryReuseMiss";
3
+ };
4
+ function t(t) {
5
+ return new e(`Did not reuse the dry run of an earlier run, as ${t}.`);
6
+ }
7
+ export { t as createDryReuseMiss };