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
@@ -1,12 +1,21 @@
1
1
  import { getSettingsProblem as e } from "./get-settings-problem.js";
2
2
  import { isMutatorSetting as t } from "./is-mutator-setting.js";
3
3
  import { isRecord as n } from "./is-record.js";
4
- function r(e, t) {
5
- let n = a(e);
4
+ const r = {
5
+ equivalent: !0,
6
+ duplicate: !0,
7
+ subsumed: !0,
8
+ timeout: !0,
9
+ invalid: !0,
10
+ owned: !0,
11
+ noise: !0
12
+ };
13
+ function i(e, t) {
14
+ let n = o(e);
6
15
  if (n !== null) throw Error(`Plugin "${t}" is invalid: ${n}.`);
7
16
  return e;
8
17
  }
9
- function i(r) {
18
+ function a(r) {
10
19
  if (!n(r)) return "must be an object";
11
20
  if (typeof r.description != "string") return "has no description";
12
21
  if (!n(r.mutators)) return "has \"mutators\" that is not an object";
@@ -20,27 +29,40 @@ function i(r) {
20
29
  }
21
30
  return null;
22
31
  }
23
- function a(e) {
32
+ function o(e) {
24
33
  if (!n(e)) return "it must be an object";
25
34
  if (!n(e.mutators)) return "\"mutators\" must be an object";
26
35
  let t = Object.entries(e.mutators);
27
36
  for (let [e, n] of t) {
28
- let t = o(n);
37
+ let t = c(n);
29
38
  if (t !== null) return `mutator "${e}" ${t}`;
30
39
  }
40
+ let r = s(e.skipRules);
41
+ if (r !== null) return r;
31
42
  if (e.presets === void 0) return null;
32
43
  if (!n(e.presets)) return "\"presets\" must be an object";
33
- let r = Object.entries(e.presets);
34
- for (let [e, t] of r) {
35
- let n = i(t);
44
+ let i = Object.entries(e.presets);
45
+ for (let [e, t] of i) {
46
+ let n = a(t);
36
47
  if (n !== null) return `preset "${e}" ${n}`;
37
48
  }
38
49
  return null;
39
50
  }
40
- function o(e) {
51
+ function s(e) {
52
+ if (e === void 0) return null;
53
+ if (!n(e)) return "\"skipRules\" must be an object";
54
+ for (let [t, i] of Object.entries(e)) {
55
+ if (!n(i)) return `skip rule "${t}" must be an object`;
56
+ let { category: e } = i;
57
+ if (typeof e != "string" || !Object.hasOwn(r, e)) return `skip rule "${t}" has an invalid category: use "equivalent", "noise", "timeout", "owned", "subsumed", "duplicate" or "invalid"`;
58
+ if (typeof i.heuristic != "boolean") return `skip rule "${t}" has heuristic that is not true or false`;
59
+ }
60
+ return null;
61
+ }
62
+ function c(e) {
41
63
  if (!n(e)) return "must be an object";
42
64
  if (typeof e.create != "function") return "has no create function";
43
65
  let { meta: t } = e;
44
66
  return !n(t) || typeof t.description != "string" ? "has no meta.description" : t.defaultOptions !== void 0 && !n(t.defaultOptions) ? "has meta.defaultOptions that is not an object" : t.countsForSolitary !== void 0 && typeof t.countsForSolitary != "boolean" ? "has meta.countsForSolitary that is not true or false" : null;
45
67
  }
46
- export { r as validatePlugin };
68
+ export { i as validatePlugin };
@@ -1,7 +1,7 @@
1
1
  import { Preset } from '../../types/config/preset.js';
2
2
  /**
3
3
  * Default preset: every built-in mutator with its default options, without
4
- * mutants that only a timeout can kill, and the usual loggers, whose message
5
- * texts are not mutated.
4
+ * mutants that may cause timeouts, and the usual loggers, whose message texts
5
+ * are not mutated.
6
6
  */
7
7
  export declare let recommended: Preset;
@@ -1,7 +1,9 @@
1
1
  import { Preset } from '../../types/config/preset.js';
2
2
  /**
3
3
  * Recommended preset with the noisier options of the built-in mutators, the
4
- * mutants that only a timeout can kill and the coarse mutants that the solitary
5
- * rule would drop.
4
+ * mutants that may cause timeouts and the coarse mutants that the solitary rule
5
+ * would drop. It leaves string-literal's `jsxAttributes` off: the braces that
6
+ * host a quoted JSX attribute value can change what Solid or a macro does with
7
+ * no mutant on.
6
8
  */
7
9
  export declare let strict: Preset;
@@ -1,7 +1,7 @@
1
1
  import { RegexPatternOptions } from '../../types/mutator/regex-pattern-options.js';
2
2
  import { RegexSource } from '../../types/regex/regex-source.js';
3
3
  import { RegexChange } from '../../types/regex/regex-change.js';
4
- import { SkipNote } from '../../types/mutant/skip-note.js';
4
+ import { CoreNote } from '../../types/mutant/core-note.js';
5
5
  /**
6
6
  * Lists the changes regex-pattern considers for a pattern, ordered by start
7
7
  * and, for one start, outer first: removing `^` and `$`, `\b` and `\B`,
@@ -21,4 +21,4 @@ import { SkipNote } from '../../types/mutant/skip-note.js';
21
21
  * pattern, when code only asks whether the pattern matches; null otherwise.
22
22
  * @returns Changes with offsets relative to the pattern.
23
23
  */
24
- export declare function collectPatternChanges(source: Pick<RegexSource, 'flags' | 'tree'>, options: Readonly<RegexPatternOptions>, testedSkip: SkipNote | null): RegexChange[];
24
+ export declare function collectPatternChanges(source: Pick<RegexSource, 'flags' | 'tree'>, options: Readonly<RegexPatternOptions>, testedSkip: CoreNote | null): RegexChange[];
@@ -2,7 +2,7 @@ import { PresetSettings } from '../../types/config/preset-settings.js';
2
2
  import { Replacement } from '../../types/mutator/replacement.js';
3
3
  import { RegexSource } from '../../types/regex/regex-source.js';
4
4
  import { TextEdit } from '../../types/source/text-edit.js';
5
- import { SkipNote } from '../../types/mutant/skip-note.js';
5
+ import { CoreNote } from '../../types/mutant/core-note.js';
6
6
  /**
7
7
  * Change of a regex mutant, with the skip the mutator decided.
8
8
  */
@@ -15,7 +15,7 @@ interface RegexEdit {
15
15
  /**
16
16
  * Skip the mutator decided, or null.
17
17
  */
18
- skip: SkipNote | null;
18
+ skip: CoreNote | null;
19
19
  /**
20
20
  * New flags.
21
21
  */
@@ -3,33 +3,34 @@ import { PlannedTry, RunState } from '../../types/run/run-state.js';
3
3
  import { BatchResult } from '../../types/adapter/batch-result.js';
4
4
  /**
5
5
  * Records what a batch run reported, in fast mode. Each mutant try is
6
- * classified. Only kills are accepted, and a kill or hit-limit timeout only
7
- * when the control tries right before and right after it both passed, else it
8
- * is doubtful. An accepted kill is heuristic and final: passing controls do not
9
- * prove that the mutant alone fails the test, since state an earlier try left
10
- * can fail it, such as a value a control try set that the mutant no longer
11
- * resets; the default mode decides every mutant isolated instead. A try that
12
- * ran out of time has no control after it, since the worker gives up the unit:
13
- * it counts only after a passing control, and then waits for a confirmation
14
- * with doubled bounds in a fresh run, or is final when the run was one.
15
- * Doubtful tries and late errors send the mutant to the isolated path; a
16
- * reached pass is only noted, since state left by a control try may hide the
17
- * mutant, and the core rechecks it on the isolated path. A unit whose suite
18
- * hook failed sends every mutant it planned that is still undecided to the
19
- * isolated path. A test whose leading control skipped itself ends its repeats
20
- * there, so its mutants count as tried without evidence rather than missing. A
21
- * hung unit gets a `worker-hang` warning and its timed-out try the cause
22
- * `hang`. Accepted kills and passes, whether they reached the mutant or not, go
23
- * to the cache of the run, so a later run reuses a kill only after the same
24
- * passes, unless the kill came from the first test of the mutant
25
- * (`applyCachedBatch`).
6
+ * classified. Only kills are accepted, and a kill only when the control tries
7
+ * right before and right after it both passed, else it is doubtful. An accepted
8
+ * kill is heuristic and final: passing controls do not prove that the mutant
9
+ * alone fails the test, since state an earlier try left can fail it, such as a
10
+ * value a control try set that the mutant no longer resets; the default mode
11
+ * decides every mutant isolated instead. A try that ran out of time has no
12
+ * control after it, since the worker gives up the unit: it counts only after a
13
+ * passing control, and then waits for a confirmation in a fresh run with twice
14
+ * the time of its whole test file, or is final when the run was one. A
15
+ * hit-limit timeout sends the mutant to the isolated path, even in such a run,
16
+ * since a mutant that only makes code hotter goes over the hit limit too and
17
+ * only that path confirms it with a raised limit. Doubtful tries and late
18
+ * errors send the mutant to the isolated path; a reached pass is only noted,
19
+ * since state left by a control try may hide the mutant, and the core rechecks
20
+ * it on the isolated path. A unit whose suite hook failed sends every mutant it
21
+ * planned that is still undecided to the isolated path. A test whose leading
22
+ * control skipped itself ends its repeats there, so its mutants count as tried
23
+ * without evidence rather than missing. A hung unit gets a `worker-hang`
24
+ * warning and its timed-out try the cause `hang`. Accepted kills and passes,
25
+ * whether they reached the mutant or not, go to the cache of the run, so a
26
+ * later run reuses a kill only after the same passes, unless the kill came from
27
+ * the first test of the mutant (`applyCachedBatch`).
26
28
  *
27
29
  * @param state - State of the run, updated in place.
28
30
  * @param run - The run to record.
29
31
  * @param run.plan - Plan the run executed.
30
32
  * @param run.result - What the adapter reported.
31
- * @param run.confirming - Whether the run confirmed timeouts with doubled
32
- * bounds.
33
+ * @param run.confirming - Whether the run confirms timeouts.
33
34
  * @returns Planned tries without facts whose mutant is still undecided on the
34
35
  * batch path.
35
36
  */
@@ -41,13 +41,13 @@ function i(e, n, r) {
41
41
  t(e, n.mutant.id, "doubtful");
42
42
  break;
43
43
  case "timeout": {
44
- let e = o === "time-limit" && c ? "hang" : o;
45
- e === "hit-limit" || i ? n.verdict = {
46
- cause: e,
44
+ let r = o === "time-limit" && c ? "hang" : o;
45
+ r === "hit-limit" ? t(e, n.mutant.id, "doubtful") : i ? n.verdict = {
46
+ cause: r,
47
47
  status: "Timeout",
48
48
  ...l
49
49
  } : n.confirm.push({
50
- cause: e,
50
+ cause: r,
51
51
  test: s.id
52
52
  });
53
53
  break;
@@ -99,7 +99,7 @@ function s(e, n) {
99
99
  }
100
100
  }
101
101
  function c(e, t, r) {
102
- let { outcome: i, cause: a } = n(e, t, "batch"), o = i === "killed" || a === "hit-limit";
102
+ let { outcome: i, cause: a } = n(e, t, "batch"), o = i === "killed";
103
103
  return (o || i === "timeout") && (!u(r.before) || o && !u(r.after)) && (i = "doubtful"), {
104
104
  outcome: i,
105
105
  cause: a
@@ -2,23 +2,32 @@ import { IsolatedPlan } from '../../types/adapter/isolated-plan.js';
2
2
  import { IsolatedRequest, RunState } from '../../types/run/run-state.js';
3
3
  import { IsolatedResult } from '../../types/adapter/isolated-result.js';
4
4
  /**
5
- * Records what an isolated run reported, unit by unit. A unit is a timeout when
6
- * it exceeded its hit limit; a hang, or a test or suite hook that ran out of
7
- * time after the mutant was reached, waits for a confirmation with doubled
8
- * bounds, or is final when the unit was one; a crash, a load error, a failed
5
+ * Records what an isolated run reported, unit by unit. A unit that exceeded its
6
+ * hit limit, a hang, or a test or suite hook that ran out of time after the
7
+ * mutant was reached is a timeout that waits for a confirmation with doubled
8
+ * time, and past the hit limit with a raised one, or is final when the unit was
9
+ * one (`getUnitEvidence`); a crash runs the unit once more with the limits it
10
+ * had and kills only when an earlier unit of the mutant in the test file
11
+ * crashed too, as something else can end its process; a load error, a failed
9
12
  * suite hook or file teardown in a unit that reached the mutant, or a test that
10
13
  * failed or threw a stray error after the mutant was reached kills; a unit that
11
14
  * reached the mutant and passed is survived evidence. The dry run had no failed
12
15
  * suite hook, since one fails the dry run. Stray errors of tests and test files
13
16
  * that had them in the dry run prove nothing. A unit without facts is planned
14
- * once more, then gives an `Error` verdict unless another file has evidence.
15
- * The verdict of a mutant follows `decideEvidence`: the kill or timeout of its
16
- * first test file in the order of `routeIsolated` that has one, once every file
17
- * before it is done; a timeout waiting for its confirmation or a unit waiting
18
- * for its retry holds back the evidence of later files, so the verdict does not
19
- * depend on which files ran together. Kills and reached passes go to the cache
20
- * of the run, which keeps only what it may reuse. The cost of a unit counts the
21
- * start of its process too.
17
+ * once more, then gives an `Error` verdict unless another file has evidence. So
18
+ * does an inconclusive unit, which something else stopped before the tests that
19
+ * reach the mutant got to it (`readIsolatedUnit`): it runs once more with the
20
+ * limits it had, and a second inconclusive unit of the mutant in the test file
21
+ * gives its `Error` and a `tests-stopped-early` warning. The verdict of a
22
+ * mutant follows `decideEvidence`: the kill or timeout of its first test file
23
+ * in the order of `routeIsolated` that has one, once every file before it is
24
+ * done; a timeout waiting for its confirmation, a crash waiting for one more
25
+ * run or a unit waiting for its retry holds back the evidence of later files,
26
+ * so the verdict does not depend on which files ran together. Kills, reached
27
+ * passes and final timeouts go to the cache of the run, which keeps only what
28
+ * it may reuse; a timeout or a crash that waits for another run does not, and
29
+ * the cache never keeps an `Error`. The cost of a unit counts the start of its
30
+ * process too.
22
31
  *
23
32
  * @param state - State of the run, updated in place.
24
33
  * @param planned - The plan the run executed and the requests it was built
@@ -3,32 +3,41 @@ import { getUnitEvidence as t } from "./get-unit-evidence.js";
3
3
  import { getDisplayPath as n } from "./get-display-path.js";
4
4
  import { decideEvidence as r } from "./decide-evidence.js";
5
5
  function i(n, r, i) {
6
- let { requests: s, plan: c } = r, l = new Map(i.units.map((e) => [e.unit, e])), u = [], d = [], f = /* @__PURE__ */ new Set();
7
- for (let [r, i] of c.units.entries()) {
8
- let o = s[r], c = n.mutants.get(i.mutant), p = l.get(r);
9
- if (p === void 0) {
10
- d.push(o);
6
+ let { requests: c, plan: l } = r, u = new Map(i.units.map((e) => [e.unit, e])), d = [], f = [], p = /* @__PURE__ */ new Set();
7
+ for (let [r, i] of l.units.entries()) {
8
+ let s = c[r], l = n.mutants.get(i.mutant), m = u.get(r);
9
+ if (m === void 0) {
10
+ f.push(s);
11
11
  continue;
12
12
  }
13
- c.units += 1, c.tries += 1, c.duration += p.duration, c.unitDuration += p.duration + (p.startup ?? 0), p.incomplete === "hang" && a(n, i), f.add(c);
14
- let m = e(n, c, {
15
- facts: p,
16
- request: o,
13
+ l.units += 1, l.tries += 1, l.duration += m.duration, l.unitDuration += m.duration + (m.startup ?? 0), m.incomplete === "hang" && o(n, i), p.add(l);
14
+ let h = e(n, l, {
15
+ facts: m,
16
+ request: s,
17
17
  unit: i
18
+ }), g = t(h, s);
19
+ if (h !== null && g !== "confirming" && n.cache?.recordUnit(l, s.file, {
20
+ inputs: m.inputs,
21
+ verdict: h
22
+ }), l.survived ||= h === "survived", l.evidence.set(s.file, g), typeof h == "object" && h?.status === "Error") typeof g == "object" ? a(n, i, g.message) : d.push({
23
+ ...s,
24
+ inconclusive: !0
18
25
  });
19
- m !== null && n.cache?.recordUnit(c, o.file, {
20
- inputs: p.inputs,
21
- verdict: m
22
- });
23
- let h = t(m, o);
24
- c.survived ||= m === "survived", c.evidence.set(o.file, h), h === "confirming" && u.push({
25
- ...o,
26
- confirming: !0,
27
- retried: !1
28
- });
26
+ else if (g === "confirming") {
27
+ let e = typeof h == "object" && h?.cause;
28
+ d.push(e === "crash" ? {
29
+ ...s,
30
+ crashed: !0
31
+ } : {
32
+ ...s,
33
+ raised: e === "hit-limit",
34
+ confirming: !0,
35
+ retried: !1
36
+ });
37
+ }
29
38
  }
30
- for (let e of f) o(e);
31
- for (let e of d) {
39
+ for (let e of p) s(e);
40
+ for (let e of f) {
32
41
  let t = n.mutants.get(e.mutant);
33
42
  t.verdict === null && (e.retried ? (t.evidence.set(e.file, {
34
43
  message: "The test runner did not report this mutant.",
@@ -36,14 +45,25 @@ function i(n, r, i) {
36
45
  cause: null,
37
46
  file: null,
38
47
  test: null
39
- }), o(t)) : (e.confirming || t.evidence.set(e.file, "retrying"), u.push({
48
+ }), s(t)) : (!e.confirming && !e.crashed && t.evidence.set(e.file, "retrying"), d.push({
40
49
  ...e,
41
50
  retried: !0
42
51
  })));
43
52
  }
44
- return u;
53
+ return d;
54
+ }
55
+ function a(e, t, r) {
56
+ let i = n(t.file, e.root);
57
+ e.diagnostics.push({
58
+ message: `The test file ${i} gave mutant ${t.mutant} no verdict in two runs. ${r}`,
59
+ code: "tests-stopped-early",
60
+ severity: "warning",
61
+ file: i,
62
+ column: null,
63
+ line: null
64
+ });
45
65
  }
46
- function a(e, t) {
66
+ function o(e, t) {
47
67
  let r = n(t.file, e.root);
48
68
  e.diagnostics.push({
49
69
  message: `The test file ${r} ran past its time budget with mutant ${t.mutant} and was stopped.`,
@@ -54,7 +74,7 @@ function a(e, t) {
54
74
  line: null
55
75
  });
56
76
  }
57
- function o(e) {
77
+ function s(e) {
58
78
  let t = r(e);
59
79
  t !== null && (e.verdict = t.verdict);
60
80
  }
@@ -3,14 +3,15 @@ import { TryVerdict } from '../../types/run/try-verdict.js';
3
3
  import { TryFacts } from '../../types/adapter/try-facts.js';
4
4
  /**
5
5
  * Classifies the raw facts of one try. In order: more site evaluations than the
6
- * hit limit is a timeout, since only a loop through sites gets there; a try
7
- * that ran out of time is a timeout when it reached the mutant; stray errors
8
- * make a batch try doubtful, since orphaned work of an earlier try may throw
9
- * them, and kill on the isolated path when the try reached the mutant; a
10
- * failure kills when the try reached the mutant; a pass, or a skip, survives
11
- * when it reached the mutant. A try that failed, ran out of time or had stray
12
- * errors without reaching the mutant is doubtful; one that passed without
13
- * reaching it is unreached.
6
+ * hit limit is a timeout, whether a mutant made a loop through sites endless or
7
+ * only made code far hotter, which its confirmation tells apart; a try that ran
8
+ * out of time is a timeout when it reached the mutant; stray errors make a
9
+ * batch try doubtful, since orphaned work of an earlier try may throw them, and
10
+ * kill on the isolated path when the try reached the mutant; a failure kills
11
+ * when the try reached the mutant; a pass, or a skip, survives when it reached
12
+ * the mutant. A try that failed, ran out of time or had stray errors without
13
+ * reaching the mutant is doubtful; one that passed without reaching it is
14
+ * unreached.
14
15
  *
15
16
  * @param facts - Facts the adapter reported for the try.
16
17
  * @param limits - Limits the try ran with.
@@ -18,7 +18,8 @@ import { RunKind } from '../../types/run/run-kind.js';
18
18
  * @param work.confirming - Of the mutants of an isolated round, those that
19
19
  * confirm a timeout; 0 when omitted.
20
20
  * @param work.retrying - Of the mutants of an isolated round, those that run
21
- * again after a lost result; 0 when omitted.
21
+ * again after a lost result, an inconclusive unit or a crash; 0 when
22
+ * omitted.
22
23
  */
23
24
  export declare function countRun(state: RunState, kind: Exclude<RunKind, 'dry'>, work: {
24
25
  confirming?: number;
@@ -25,6 +25,11 @@ interface RunStateInput {
25
25
  * or not.
26
26
  */
27
27
  hosted: readonly Mutant[];
28
+ /**
29
+ * Whether isolated units of one test file may run at the same time; false
30
+ * when omitted.
31
+ */
32
+ parallelUnits?: boolean;
28
33
  /**
29
34
  * Coverage and stability of the dry run.
30
35
  */
@@ -17,6 +17,7 @@ function r(r) {
17
17
  running: null
18
18
  },
19
19
  moduleTests: e(r.hosted, i),
20
+ parallelUnits: r.parallelUnits === !0,
20
21
  report: r.report ?? (() => {}),
21
22
  workers: r.workers,
22
23
  imports: r.imports,
@@ -13,7 +13,10 @@ interface WorkDirectory {
13
13
  }
14
14
  /**
15
15
  * Creates a fresh directory for the files of one run (plans, results,
16
- * heartbeats) in the system temporary directory.
16
+ * heartbeats) in the system temporary directory. Until it is removed, it is
17
+ * among the live work directories (`LIVE_WORK_DIRECTORIES`), which an
18
+ * interrupted run whose cleanup takes too long removes before the process ends
19
+ * (`removeLiveWorkDirectories`).
17
20
  *
18
21
  * @returns Path of the directory and a function that deletes it.
19
22
  */
@@ -1,14 +1,17 @@
1
- import e from "node:path";
2
- import { tmpdir as t } from "node:os";
3
- import { mkdtemp as n, rm as r } from "node:fs/promises";
4
- async function i() {
5
- let i = await n(e.join(t(), "mootant-"));
6
- return {
7
- remove: () => r(i, {
8
- recursive: !0,
9
- force: !0
10
- }),
11
- path: i
1
+ import { LIVE_WORK_DIRECTORIES as e } from "./live-work-directories.js";
2
+ import t from "node:path";
3
+ import { tmpdir as n } from "node:os";
4
+ import { mkdtemp as r, rm as i } from "node:fs/promises";
5
+ async function a() {
6
+ let a = await r(t.join(n(), "mootant-"));
7
+ return e.add(a), {
8
+ remove: async () => {
9
+ await i(a, {
10
+ recursive: !0,
11
+ force: !0
12
+ }), e.delete(a);
13
+ },
14
+ path: a
12
15
  };
13
16
  }
14
- export { i as createWorkDirectory };
17
+ export { a as createWorkDirectory };
@@ -6,9 +6,10 @@ import { MutantVerdict, MutantState } from '../../types/run/mutant-state.js';
6
6
  * every file before it is done without one. A file is not done while it waits
7
7
  * to run (it has no evidence), for a timeout confirmation or for a retry, so
8
8
  * the verdict depends neither on which files ran together nor on which came
9
- * from the cache. A file the test runner did not report gives its `Error` only
10
- * when no file has a kill or a timeout. Without any, the mutant is decided once
11
- * all its files are done, with no verdict: a reached pass makes it `Survived`.
9
+ * from the cache. A file the test runner did not report, or one inconclusive
10
+ * twice, gives its `Error` only when no file has a kill or a timeout. Without
11
+ * any, the mutant is decided once all its files are done, with no verdict: a
12
+ * reached pass makes it `Survived`.
12
13
  *
13
14
  * @param mutant - Test files of the mutant in order and their evidence.
14
15
  * @returns The verdict, or null while it is undecided.
@@ -0,0 +1,13 @@
1
+ import { TryLimits } from '../../types/adapter/try-limits.js';
2
+ import { RunState } from '../../types/run/run-state.js';
3
+ /**
4
+ * Computes the limits of running a whole test file with a mutant, as an
5
+ * isolated unit does: those of loading the file and its suite hooks and of one
6
+ * try of every test of the file, added up.
7
+ *
8
+ * @param state - State of the run.
9
+ * @param file - Key of the test file (`getTestFileKey`).
10
+ * @param scale - 1, or 2 to confirm a timeout.
11
+ * @returns Hit limit and timeout of the whole file.
12
+ */
13
+ export declare function getTestFileLimits(state: RunState, file: string, scale: number): TryLimits;
@@ -0,0 +1,13 @@
1
+ import { getTryLimits as e } from "./get-try-limits.js";
2
+ function t(t, n, r) {
3
+ let { analysis: i, limits: a } = t, o = e(i.loads.get(n) ?? {
4
+ duration: 0,
5
+ hits: 0
6
+ }, a, r), s = i.fileTests.get(n);
7
+ if (s !== void 0) for (let t of s) {
8
+ let n = e(i.baselines.get(t), a, r);
9
+ o.hitLimit += n.hitLimit, o.timeout += n.timeout;
10
+ }
11
+ return o;
12
+ }
13
+ export { t as getTestFileLimits };
@@ -2,9 +2,18 @@ import { IsolatedEvidence } from '../../types/run/isolated-evidence.js';
2
2
  import { MutantVerdict } from '../../types/run/mutant-state.js';
3
3
  import { IsolatedRequest } from '../../types/run/run-state.js';
4
4
  /**
5
- * Turns the outcome of an isolated unit into the evidence of its test file: a
6
- * timer or hang timeout of a unit that does not confirm one yet waits for its
7
- * confirmation, a reached pass and a unit that decided nothing are done without
5
+ * Turns the outcome of an isolated unit into the evidence of its test file: an
6
+ * inconclusive unit waits for one more run, as a lost one does, and keeps a
7
+ * timeout or a crash it reran waiting, unless an earlier unit of the mutant in
8
+ * the test file was inconclusive too, which gives its `Error`; a crash waits
9
+ * for one more run of the unit, as something else, such as the OOM killer or a
10
+ * `kill -9`, can end its process too, unless an earlier unit of the mutant in
11
+ * the test file crashed, while a lost result confirms nothing; a timeout waits
12
+ * for its confirmation, unless the unit confirmed one with what stopped it: a
13
+ * timer or a hang in any confirming unit, the hit limit only in one with the
14
+ * raised limit, since a mutant that only makes code hotter goes over the hit
15
+ * limit too, also when the doubled time of a timer's confirmation lets it reach
16
+ * its hot code; a reached pass and a unit that decided nothing are done without
8
17
  * a verdict, and any other verdict stands.
9
18
  *
10
19
  * @param verdict - Outcome of the unit (`readIsolatedUnit`).
@@ -1,4 +1,4 @@
1
1
  function e(e, t) {
2
- return e === "survived" || e === null ? "none" : e.status === "Timeout" && (e.cause === "time-limit" || e.cause === "hang") && !t.confirming ? "confirming" : e;
2
+ return e === "survived" || e === null ? "none" : e.status === "Error" && t.inconclusive !== !0 ? t.confirming || t.crashed ? "confirming" : "retrying" : e.cause === "crash" ? t.crashed ? e : "confirming" : !(e.cause === "hit-limit" ? t.raised : t.confirming) && e.status === "Timeout" ? "confirming" : e;
3
3
  }
4
4
  export { e as getUnitEvidence };
@@ -0,0 +1,18 @@
1
+ import { AdapterSession } from '../../types/adapter/adapter-session.js';
2
+ /**
3
+ * Wraps the session of a run so that an interrupted run asks nothing more of
4
+ * the test runner: once the signal aborted, a call throws the signal's reason
5
+ * without starting, and a call that was running throws it when it ends,
6
+ * dropping what it gave, so verdicts of units the interrupt stopped never
7
+ * count. A running call is awaited, not cut short: the adapter ends it
8
+ * (`AdapterContext.signal`), so `close` never runs alongside it and no
9
+ * rejection is left unhandled. `close` passes through. The facts of the session
10
+ * (`diagnostics`, `version`, `workers`) and whether it has `cacheInputs` are
11
+ * read from the session itself each time, so a session that keeps them in
12
+ * getters of its class or changes them later reads the same through the guard.
13
+ *
14
+ * @param session - Session the adapter started.
15
+ * @param signal - Signal that interrupts the run.
16
+ * @returns The guarded session.
17
+ */
18
+ export declare function guardSession(session: AdapterSession, signal: AbortSignal): AdapterSession;
@@ -0,0 +1,30 @@
1
+ function e(e, t) {
2
+ async function n(e) {
3
+ t.throwIfAborted();
4
+ try {
5
+ return await e();
6
+ } finally {
7
+ t.throwIfAborted();
8
+ }
9
+ }
10
+ return {
11
+ get cacheInputs() {
12
+ return e.cacheInputs === void 0 ? void 0 : () => n(() => e.cacheInputs());
13
+ },
14
+ get diagnostics() {
15
+ return e.diagnostics;
16
+ },
17
+ get version() {
18
+ return e.version;
19
+ },
20
+ get workers() {
21
+ return e.workers;
22
+ },
23
+ runIsolated: (t) => n(() => e.runIsolated(t)),
24
+ listTestFiles: () => n(() => e.listTestFiles()),
25
+ dryRun: (t) => n(() => e.dryRun(t)),
26
+ runBatch: (t) => n(() => e.runBatch(t)),
27
+ close: () => e.close()
28
+ };
29
+ }
30
+ export { e as guardSession };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Absolute paths of the work directories of runs of this process that are not
3
+ * removed yet.
4
+ */
5
+ export declare const LIVE_WORK_DIRECTORIES: Set<string>;
@@ -0,0 +1,2 @@
1
+ const e = /* @__PURE__ */ new Set();
2
+ export { e as LIVE_WORK_DIRECTORIES };