mootant 0.2.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 (313) hide show
  1. package/bin/mootant.js +3 -2
  2. package/dist/adapters/jest/collect-jest-dependencies.d.ts +8 -6
  3. package/dist/adapters/jest/collect-jest-dependencies.js +20 -14
  4. package/dist/adapters/jest/get-jest-cache-inputs.d.ts +14 -13
  5. package/dist/adapters/jest/index.d.ts +3 -1
  6. package/dist/adapters/jest/run-dry.js +20 -20
  7. package/dist/adapters/jest/start-jest-session.d.ts +6 -2
  8. package/dist/adapters/jest/start-jest-session.js +9 -2
  9. package/dist/adapters/jest/types/jest-handle.d.ts +2 -1
  10. package/dist/adapters/jest/types/jest-record.d.ts +4 -3
  11. package/dist/adapters/jest/types/worker-channel.d.ts +7 -0
  12. package/dist/adapters/jest/worker/boot-worker.d.ts +5 -4
  13. package/dist/adapters/jest/worker/create-test-runner.d.ts +4 -1
  14. package/dist/adapters/jest/worker/keep-reset-loads.d.ts +13 -0
  15. package/dist/adapters/jest/worker/list-runtime-files.d.ts +13 -0
  16. package/dist/adapters/jest/worker/run-unit.d.ts +25 -20
  17. package/dist/adapters/jest/worker/vm-setup.js +1 -1
  18. package/dist/adapters/jest/worker/worker.js +1 -1
  19. package/dist/adapters/node-test/check-typescript.js +2 -2
  20. package/dist/adapters/node-test/collect-node-dependencies.d.ts +7 -5
  21. package/dist/adapters/node-test/collect-node-dependencies.js +26 -20
  22. package/dist/adapters/node-test/create-spare-processes.d.ts +26 -0
  23. package/dist/adapters/node-test/create-spare-processes.js +53 -0
  24. package/dist/adapters/node-test/filter-exec-argv.d.ts +2 -1
  25. package/dist/adapters/node-test/filter-exec-argv.js +13 -12
  26. package/dist/adapters/node-test/get-node-cache-inputs.js +1 -1
  27. package/dist/adapters/node-test/get-unit-deadline.d.ts +6 -5
  28. package/dist/adapters/node-test/index.d.ts +2 -2
  29. package/dist/adapters/node-test/index.js +1 -0
  30. package/dist/adapters/node-test/is-group-alive.d.ts +8 -0
  31. package/dist/adapters/node-test/is-group-alive.js +8 -0
  32. package/dist/adapters/node-test/list-setup-files.js +2 -2
  33. package/dist/adapters/node-test/place-preload.d.ts +2 -1
  34. package/dist/adapters/node-test/place-preload.js +24 -18
  35. package/dist/adapters/node-test/preload/create-commonjs-route.js +1 -1
  36. package/dist/adapters/node-test/preload/preload.js +54 -52
  37. package/dist/adapters/node-test/preload/read-line-sync.d.ts +11 -0
  38. package/dist/adapters/node-test/preload/read-line-sync.js +25 -0
  39. package/dist/adapters/node-test/preload/read-unit.d.ts +11 -5
  40. package/dist/adapters/node-test/preload/read-unit.js +5 -4
  41. package/dist/adapters/node-test/run-isolated.d.ts +19 -10
  42. package/dist/adapters/node-test/run-isolated.js +68 -52
  43. package/dist/adapters/node-test/run-test-file.d.ts +12 -4
  44. package/dist/adapters/node-test/run-test-file.js +18 -14
  45. package/dist/adapters/node-test/run-test-process.d.ts +30 -13
  46. package/dist/adapters/node-test/run-test-process.js +38 -40
  47. package/dist/adapters/node-test/start-node-test-session.d.ts +10 -2
  48. package/dist/adapters/node-test/start-node-test-session.js +90 -84
  49. package/dist/adapters/node-test/start-test-process.d.ts +30 -0
  50. package/dist/adapters/node-test/start-test-process.js +27 -0
  51. package/dist/adapters/node-test/types/node-test-handle.d.ts +14 -1
  52. package/dist/adapters/node-test/types/process-watch.d.ts +4 -3
  53. package/dist/adapters/node-test/types/spare-processes.d.ts +20 -0
  54. package/dist/adapters/node-test/types/test-process-outcome.d.ts +8 -1
  55. package/dist/adapters/shared/allows-spares.d.ts +11 -0
  56. package/dist/adapters/shared/allows-spares.js +23 -0
  57. package/dist/adapters/shared/create-environment-proxy.d.ts +4 -3
  58. package/dist/adapters/shared/create-input-filter.d.ts +17 -14
  59. package/dist/adapters/shared/create-input-filter.js +2 -2
  60. package/dist/adapters/shared/enable-compile-cache.d.ts +32 -0
  61. package/dist/adapters/shared/enable-compile-cache.js +7 -0
  62. package/dist/adapters/shared/find-tsconfig-property.d.ts +13 -0
  63. package/dist/adapters/shared/find-tsconfig-property.js +6 -0
  64. package/dist/adapters/shared/get-spare-limit.d.ts +10 -0
  65. package/dist/adapters/shared/get-spare-limit.js +5 -0
  66. package/dist/adapters/shared/index-environment-hashes.d.ts +2 -2
  67. package/dist/adapters/shared/index-environment-hashes.js +5 -13
  68. package/dist/adapters/{node-test → shared}/list-flag-values.d.ts +2 -1
  69. package/dist/adapters/shared/list-flag-values.js +10 -0
  70. package/dist/adapters/shared/list-tsconfig-files.d.ts +14 -5
  71. package/dist/adapters/shared/list-tsconfig-files.js +15 -13
  72. package/dist/adapters/shared/parse-tsconfig.d.ts +10 -0
  73. package/dist/adapters/shared/parse-tsconfig.js +19 -0
  74. package/dist/adapters/shared/read-flag-name.d.ts +9 -0
  75. package/dist/adapters/shared/read-flag-name.js +5 -0
  76. package/dist/adapters/shared/read-node-options.d.ts +11 -0
  77. package/dist/adapters/shared/read-node-options.js +6 -0
  78. package/dist/adapters/shared/read-prefork-switch.d.ts +10 -0
  79. package/dist/adapters/shared/read-prefork-switch.js +5 -0
  80. package/dist/adapters/shared/read-tsconfig-extends.d.ts +2 -5
  81. package/dist/adapters/shared/read-tsconfig-extends.js +16 -31
  82. package/dist/adapters/shared/read-tsconfig-references.d.ts +12 -0
  83. package/dist/adapters/shared/read-tsconfig-references.js +13 -0
  84. package/dist/adapters/shared/track-file-reads.d.ts +13 -12
  85. package/dist/adapters/shared/track-file-reads.js +71 -71
  86. package/dist/adapters/shared/track-process-group.d.ts +2 -1
  87. package/dist/adapters/shared/track-process-group.js +7 -2
  88. package/dist/adapters/vitest/build-isolated-facts.d.ts +4 -3
  89. package/dist/adapters/vitest/collect-dependencies.d.ts +11 -5
  90. package/dist/adapters/vitest/collect-dependencies.js +36 -27
  91. package/dist/adapters/vitest/configure-project.d.ts +3 -2
  92. package/dist/adapters/vitest/configure-project.js +1 -1
  93. package/dist/adapters/vitest/create-forks-pool.d.ts +34 -7
  94. package/dist/adapters/vitest/create-forks-pool.js +102 -24
  95. package/dist/adapters/vitest/create-interleaved-sequencer.d.ts +3 -2
  96. package/dist/adapters/vitest/drop-signal-listeners.d.ts +14 -0
  97. package/dist/adapters/vitest/drop-signal-listeners.js +15 -0
  98. package/dist/adapters/vitest/get-cache-inputs.d.ts +3 -1
  99. package/dist/adapters/vitest/get-cache-inputs.js +43 -28
  100. package/dist/adapters/vitest/get-module-file.d.ts +3 -5
  101. package/dist/adapters/vitest/get-module-file.js +1 -1
  102. package/dist/adapters/vitest/get-spare-key.d.ts +15 -0
  103. package/dist/adapters/vitest/get-spare-key.js +15 -0
  104. package/dist/adapters/vitest/index.d.ts +2 -1
  105. package/dist/adapters/vitest/index.js +1 -0
  106. package/dist/adapters/vitest/is-virtual-module.d.ts +1 -2
  107. package/dist/adapters/vitest/is-virtual-module.js +1 -1
  108. package/dist/adapters/vitest/list-script-defines.d.ts +13 -0
  109. package/dist/adapters/vitest/list-script-defines.js +22 -0
  110. package/dist/adapters/vitest/read-unit-inputs.d.ts +2 -1
  111. package/dist/adapters/vitest/run-dry.js +1 -1
  112. package/dist/adapters/vitest/run-plan.d.ts +10 -8
  113. package/dist/adapters/vitest/run-plan.js +1 -1
  114. package/dist/adapters/vitest/run-specifications.d.ts +9 -2
  115. package/dist/adapters/vitest/run-specifications.js +22 -12
  116. package/dist/adapters/vitest/runner.d.ts +60 -29
  117. package/dist/adapters/vitest/runner.js +109 -86
  118. package/dist/adapters/vitest/start-vitest-session.d.ts +5 -1
  119. package/dist/adapters/vitest/start-vitest-session.js +64 -59
  120. package/dist/adapters/vitest/stop-hung-worker.d.ts +11 -4
  121. package/dist/adapters/vitest/stop-hung-worker.js +20 -7
  122. package/dist/adapters/vitest/types/mootant-forks-pool.d.ts +47 -0
  123. package/dist/adapters/vitest/types/vitest-session-state.d.ts +9 -8
  124. package/dist/adapters/vitest/types/vitest-worker.d.ts +48 -33
  125. package/dist/adapters/vitest/wait-for-workers.d.ts +5 -2
  126. package/dist/adapters/vitest/wait-for-workers.js +15 -15
  127. package/dist/adapters/vitest/worker/track-meta-defines.d.ts +39 -0
  128. package/dist/adapters/vitest/worker/track-meta-defines.js +23 -0
  129. package/dist/adapters/vitest/worker/track-values.d.ts +38 -0
  130. package/dist/adapters/vitest/worker/track-values.js +45 -0
  131. package/dist/adapters/vitest/worker/value-prefixes.d.ts +12 -0
  132. package/dist/adapters/vitest/worker/value-prefixes.js +6 -0
  133. package/dist/adapters/vitest/worker/wait-for-turn.d.ts +8 -6
  134. package/dist/adapters/vitest/worker/watch-property.d.ts +17 -0
  135. package/dist/adapters/vitest/worker/watch-property.js +27 -0
  136. package/dist/cli/create-run-progress.d.ts +8 -1
  137. package/dist/cli/create-run-progress.js +4 -1
  138. package/dist/cli/ensure-exit.d.ts +11 -0
  139. package/dist/cli/ensure-exit.js +15 -0
  140. package/dist/cli/html/build-html-report.js +1 -0
  141. package/dist/cli/html/client/main.js +1 -1
  142. package/dist/cli/html/client/render-overview.d.ts +3 -3
  143. package/dist/cli/index.d.ts +1 -0
  144. package/dist/cli/index.js +3 -2
  145. package/dist/cli/parse-arguments.d.ts +4 -0
  146. package/dist/cli/parse-arguments.js +4 -1
  147. package/dist/cli/report/build-run-report.js +1 -0
  148. package/dist/cli/report/format-command.d.ts +5 -0
  149. package/dist/cli/report/format-command.js +1 -1
  150. package/dist/cli/report/format-run-text-report.d.ts +5 -4
  151. package/dist/cli/report/format-run-text-report.js +10 -10
  152. package/dist/cli/report/slim-run-report.d.ts +10 -10
  153. package/dist/cli/report/slim-run-report.js +1 -0
  154. package/dist/cli/run-mutation.d.ts +5 -1
  155. package/dist/cli/run-mutation.js +32 -24
  156. package/dist/cli/terminal/create-spinner.d.ts +1 -2
  157. package/dist/cli/terminal/create-spinner.js +23 -32
  158. package/dist/cli/watch-interrupts.d.ts +41 -0
  159. package/dist/cli/watch-interrupts.js +32 -0
  160. package/dist/core/cache/apply-cached-units.d.ts +8 -7
  161. package/dist/core/cache/build-hash.d.ts +9 -0
  162. package/dist/core/cache/build-hash.js +2 -0
  163. package/dist/core/cache/cache-version.d.ts +4 -4
  164. package/dist/core/cache/check-dry-snapshot.d.ts +25 -0
  165. package/dist/core/cache/check-dry-snapshot.js +13 -0
  166. package/dist/core/cache/create-dry-reuse-miss.d.ts +12 -0
  167. package/dist/core/cache/create-dry-reuse-miss.js +7 -0
  168. package/dist/core/cache/create-dry-snapshot.d.ts +71 -0
  169. package/dist/core/cache/create-dry-snapshot.js +27 -0
  170. package/dist/core/cache/create-run-cache.d.ts +20 -2
  171. package/dist/core/cache/create-run-cache.js +31 -22
  172. package/dist/core/cache/create-snapshot-session.d.ts +12 -0
  173. package/dist/core/cache/create-snapshot-session.js +19 -0
  174. package/dist/core/cache/get-build-id.d.ts +11 -0
  175. package/dist/core/cache/get-build-id.js +7 -0
  176. package/dist/core/cache/get-cache-path.d.ts +1 -1
  177. package/dist/core/cache/get-cache-path.js +1 -1
  178. package/dist/core/cache/get-dry-snapshot-key.d.ts +47 -0
  179. package/dist/core/cache/get-dry-snapshot-key.js +43 -0
  180. package/dist/core/cache/get-dry-snapshot-path.d.ts +9 -0
  181. package/dist/core/cache/get-dry-snapshot-path.js +5 -0
  182. package/dist/core/cache/get-environment-key.d.ts +9 -4
  183. package/dist/core/cache/get-environment-key.js +3 -2
  184. package/dist/core/cache/get-test-file-keys.d.ts +2 -1
  185. package/dist/core/cache/get-test-file-keys.js +11 -10
  186. package/dist/core/cache/hash-files.d.ts +8 -7
  187. package/dist/core/cache/hash-files.js +17 -11
  188. package/dist/core/cache/hash-project-tree.d.ts +22 -0
  189. package/dist/core/cache/hash-project-tree.js +69 -0
  190. package/dist/core/cache/is-dry-reuse-miss.d.ts +8 -0
  191. package/dist/core/cache/is-dry-reuse-miss.js +4 -0
  192. package/dist/core/cache/list-file-hashes.d.ts +4 -0
  193. package/dist/core/cache/list-file-hashes.js +5 -2
  194. package/dist/core/cache/list-install-states.d.ts +12 -0
  195. package/dist/core/cache/list-install-states.js +19 -0
  196. package/dist/core/cache/list-variable-hashes.d.ts +15 -0
  197. package/dist/core/cache/list-variable-hashes.js +14 -0
  198. package/dist/core/cache/prepare-run-cache.d.ts +48 -22
  199. package/dist/core/cache/prepare-run-cache.js +86 -73
  200. package/dist/core/cache/read-dry-snapshot.d.ts +10 -0
  201. package/dist/core/cache/read-dry-snapshot.js +15 -0
  202. package/dist/core/cache/read-run-cache.js +6 -2
  203. package/dist/core/cache/save-dry-snapshot.d.ts +34 -0
  204. package/dist/core/cache/save-dry-snapshot.js +32 -0
  205. package/dist/core/cache/volatile-variables.d.ts +7 -0
  206. package/dist/core/cache/volatile-variables.js +11 -0
  207. package/dist/core/cache/write-run-cache.js +1 -1
  208. package/dist/core/config/load-typescript-config.d.ts +6 -1
  209. package/dist/core/config/load-typescript-config.js +26 -10
  210. package/dist/core/config/prepare-run.d.ts +7 -3
  211. package/dist/core/config/prepare-run.js +1 -0
  212. package/dist/core/config/resolve-run-settings.d.ts +3 -2
  213. package/dist/core/config/resolve-run-settings.js +1 -0
  214. package/dist/core/config/validate-config.js +3 -2
  215. package/dist/core/files/get-package-manifest.d.ts +12 -0
  216. package/dist/core/files/get-package-manifest.js +7 -0
  217. package/dist/core/generate/collect-candidates.d.ts +5 -1
  218. package/dist/core/generate/collect-candidates.js +125 -97
  219. package/dist/core/generate/generate-file-mutants.js +6 -5
  220. package/dist/core/index.d.ts +18 -0
  221. package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +2 -2
  222. package/dist/core/mutators/shared/get-comparison-plan.d.ts +2 -2
  223. package/dist/core/mutators/shared/get-default-option-skip.d.ts +2 -2
  224. package/dist/core/mutators/shared/get-group-constant.d.ts +2 -2
  225. package/dist/core/mutators/shared/get-literal-skip.d.ts +3 -3
  226. package/dist/core/mutators/shared/get-loop-running-skip.d.ts +2 -2
  227. package/dist/core/mutators/shared/get-nullish-swap-skip.d.ts +2 -2
  228. package/dist/core/mutators/shared/get-or-default-skip.d.ts +2 -2
  229. package/dist/core/mutators/shared/get-owned-constants.d.ts +2 -2
  230. package/dist/core/mutators/shared/leave-now-skip.d.ts +2 -2
  231. package/dist/core/mutators/shared/no-op-callback-skip.d.ts +2 -2
  232. package/dist/core/plugins/create-mutator-registry.d.ts +4 -2
  233. package/dist/core/plugins/create-mutator-registry.js +15 -5
  234. package/dist/core/plugins/validate-plugin.d.ts +3 -3
  235. package/dist/core/plugins/validate-plugin.js +32 -10
  236. package/dist/core/regex/collect-pattern-changes.d.ts +2 -2
  237. package/dist/core/regex/create-regex-replacement.d.ts +2 -2
  238. package/dist/core/run/apply-isolated-result.d.ts +22 -14
  239. package/dist/core/run/apply-isolated-result.js +45 -26
  240. package/dist/core/run/count-run.d.ts +2 -1
  241. package/dist/core/run/create-run-state.d.ts +5 -0
  242. package/dist/core/run/create-run-state.js +1 -0
  243. package/dist/core/run/create-work-directory.d.ts +4 -1
  244. package/dist/core/run/create-work-directory.js +15 -12
  245. package/dist/core/run/decide-evidence.d.ts +4 -3
  246. package/dist/core/run/get-unit-evidence.d.ts +13 -7
  247. package/dist/core/run/get-unit-evidence.js +1 -1
  248. package/dist/core/run/guard-session.d.ts +18 -0
  249. package/dist/core/run/guard-session.js +30 -0
  250. package/dist/core/run/live-work-directories.d.ts +5 -0
  251. package/dist/core/run/live-work-directories.js +2 -0
  252. package/dist/core/run/read-isolated-unit.d.ts +6 -3
  253. package/dist/core/run/read-isolated-unit.js +77 -38
  254. package/dist/core/run/remove-live-work-directories.d.ts +7 -0
  255. package/dist/core/run/remove-live-work-directories.js +12 -0
  256. package/dist/core/run/run-isolated-rounds.d.ts +16 -12
  257. package/dist/core/run/run-isolated-rounds.js +3 -2
  258. package/dist/core/run/validate-adapter.d.ts +1 -1
  259. package/dist/core/run/validate-adapter.js +1 -1
  260. package/dist/core/run-mutants.d.ts +34 -2
  261. package/dist/core/run-mutants.js +356 -216
  262. package/dist/core/skips/skip-rules.d.ts +3 -1
  263. package/dist/package.js +1 -1
  264. package/dist/types/adapter/adapter-context.d.ts +20 -0
  265. package/dist/types/adapter/adapter-session.d.ts +2 -1
  266. package/dist/types/adapter/cache-inputs.d.ts +3 -2
  267. package/dist/types/adapter/dry-file.d.ts +4 -2
  268. package/dist/types/adapter/isolated-plan.d.ts +2 -1
  269. package/dist/types/adapter/isolated-result.d.ts +3 -1
  270. package/dist/types/adapter/run-inputs.d.ts +5 -4
  271. package/dist/types/adapter/test-adapter.d.ts +7 -0
  272. package/dist/types/cache/cache-entry.d.ts +9 -7
  273. package/dist/types/cache/cached-inputs.d.ts +2 -2
  274. package/dist/types/cache/dry-snapshot.d.ts +76 -0
  275. package/dist/types/cache/project-tree.d.ts +16 -0
  276. package/dist/types/cache/run-cache-file.d.ts +1 -1
  277. package/dist/types/cache/run-cache.d.ts +6 -5
  278. package/dist/types/config/plugin.d.ts +11 -2
  279. package/dist/types/config/run-config.d.ts +10 -0
  280. package/dist/types/config/run-settings.d.ts +6 -0
  281. package/dist/types/mutant/core-note.d.ts +12 -0
  282. package/dist/types/mutant/diagnostic.d.ts +1 -0
  283. package/dist/types/mutant/registered-skip-rule.d.ts +11 -0
  284. package/dist/types/mutant/skip-note.d.ts +7 -6
  285. package/dist/types/mutant/skip-rule-id.d.ts +3 -2
  286. package/dist/types/mutant/skip-rule.d.ts +2 -1
  287. package/dist/types/mutant/skipped-candidate.d.ts +14 -7
  288. package/dist/types/mutant/skipped-mutant.d.ts +6 -6
  289. package/dist/types/mutator/mutator.d.ts +3 -2
  290. package/dist/types/mutator/registered-mutator.d.ts +8 -0
  291. package/dist/types/regex/regex-change.d.ts +2 -2
  292. package/dist/types/report/html-report.d.ts +3 -2
  293. package/dist/types/report/list-report-skipped.d.ts +3 -2
  294. package/dist/types/report/run-report.d.ts +11 -2
  295. package/dist/types/report/slim-run-report.d.ts +1 -1
  296. package/dist/types/run/isolated-evidence.d.ts +3 -2
  297. package/dist/types/run/isolated-reason.d.ts +2 -1
  298. package/dist/types/run/run-durations.d.ts +8 -3
  299. package/dist/types/run/run-event.d.ts +10 -7
  300. package/dist/types/run/run-result.d.ts +11 -2
  301. package/dist/types/run/run-state.d.ts +21 -0
  302. package/dist/types/run/try-cause.d.ts +2 -1
  303. package/package.json +1 -1
  304. package/readme.md +85 -68
  305. package/skills/mootant/SKILL.md +36 -19
  306. package/skills/mootant/references/mutators.md +29 -23
  307. package/dist/adapters/node-test/list-flag-values.js +0 -9
  308. /package/dist/adapters/{node-test → shared}/loader-flags.d.ts +0 -0
  309. /package/dist/adapters/{node-test → shared}/loader-flags.js +0 -0
  310. /package/dist/{adapters/shared → core/files}/list-package-files.d.ts +0 -0
  311. /package/dist/{adapters/shared → core/files}/list-package-files.js +0 -0
  312. /package/dist/{adapters/shared → core/files}/read-package-type.d.ts +0 -0
  313. /package/dist/{adapters/shared → core/files}/read-package-type.js +0 -0
@@ -13,13 +13,23 @@ function n(n, i) {
13
13
  return a;
14
14
  }
15
15
  function r(n, r, i) {
16
- let a = i === null ? "the core plugin" : `plugin "${i}"`, o = i === null ? "" : `${i}/`;
17
- for (let i of Object.keys(r.mutators).toSorted(e)) {
18
- if (!t(i)) throw Error(`Mutator name "${i}" in ${a} is not kebab-case.`);
16
+ let a = i === null ? "the core plugin" : `plugin "${i}"`, o = i === null ? "" : `${i}/`, s = /* @__PURE__ */ new Map(), c = r.skipRules ?? {};
17
+ for (let n of Object.keys(c).toSorted(e)) {
18
+ if (!t(n)) throw Error(`Skip rule name "${n}" in ${a} is not kebab-case.`);
19
+ let { heuristic: e, category: r } = c[n];
20
+ s.set(n, {
21
+ id: `${o}${n}`,
22
+ heuristic: e,
23
+ category: r
24
+ });
25
+ }
26
+ for (let c of Object.keys(r.mutators).toSorted(e)) {
27
+ if (!t(c)) throw Error(`Mutator name "${c}" in ${a} is not kebab-case.`);
19
28
  let e = {
20
- mutator: r.mutators[i],
29
+ ...i !== null && { skipRules: s },
30
+ mutator: r.mutators[c],
21
31
  rank: n.mutators.size,
22
- id: `${o}${i}`
32
+ id: `${o}${c}`
23
33
  };
24
34
  n.mutators.set(e.id, e);
25
35
  }
@@ -2,9 +2,9 @@ import { Plugin } from '../../types/config/plugin.js';
2
2
  /**
3
3
  * Checks the shape of a plugin loaded at runtime: an object with a `mutators`
4
4
  * object of mutators, each with a `create` function and a `meta` object with a
5
- * description, and optional presets with a description, mutator settings,
6
- * `extends` and settings. Names and ids are checked when the plugin is
7
- * registered.
5
+ * description, optional skip rules with a category and a heuristic flag, and
6
+ * optional presets with a description, mutator settings, `extends` and
7
+ * settings. Names and ids are checked when the plugin is registered.
8
8
  *
9
9
  * @param value - Default export of a plugin package, or a plugin object.
10
10
  * @param namespace - Namespace the plugin is loaded under.
@@ -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 { 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
  */
@@ -6,20 +6,28 @@ import { IsolatedResult } from '../../types/adapter/isolated-result.js';
6
6
  * hit limit, a hang, or a test or suite hook that ran out of time after the
7
7
  * mutant was reached is a timeout that waits for a confirmation with doubled
8
8
  * time, and past the hit limit with a raised one, or is final when the unit was
9
- * one (`getUnitEvidence`); a crash, a load error, a failed suite hook or file
10
- * teardown in a unit that reached the mutant, or a test that failed or threw a
11
- * stray error after the mutant was reached kills; a unit that reached the
12
- * mutant and passed is survived evidence. The dry run had no failed suite hook,
13
- * since one fails the dry run. Stray errors of tests and test files that had
14
- * them in the dry run prove nothing. A unit without facts is planned once more,
15
- * then gives an `Error` verdict unless another file has evidence. The verdict
16
- * of a mutant follows `decideEvidence`: the kill or timeout of its first test
17
- * file in the order of `routeIsolated` that has one, once every file before it
18
- * is done; a timeout waiting for its confirmation or a unit waiting for its
19
- * retry holds back the evidence of later files, so the verdict does not depend
20
- * on which files ran together. Kills and reached passes go to the cache of the
21
- * run, which keeps only what it may reuse. The cost of a unit counts the start
22
- * of its process too.
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
12
+ * suite hook or file teardown in a unit that reached the mutant, or a test that
13
+ * failed or threw a stray error after the mutant was reached kills; a unit that
14
+ * reached the mutant and passed is survived evidence. The dry run had no failed
15
+ * suite hook, since one fails the dry run. Stray errors of tests and test files
16
+ * that had them in the dry run prove nothing. A unit without facts is planned
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.
23
31
  *
24
32
  * @param state - State of the run, updated in place.
25
33
  * @param planned - The plan the run executed and the requests it was built
@@ -3,33 +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
- raised: typeof m == "object" && m?.cause === "hit-limit",
27
- confirming: !0,
28
- retried: !1
29
- });
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
+ }
30
38
  }
31
- for (let e of f) o(e);
32
- for (let e of d) {
39
+ for (let e of p) s(e);
40
+ for (let e of f) {
33
41
  let t = n.mutants.get(e.mutant);
34
42
  t.verdict === null && (e.retried ? (t.evidence.set(e.file, {
35
43
  message: "The test runner did not report this mutant.",
@@ -37,14 +45,25 @@ function i(n, r, i) {
37
45
  cause: null,
38
46
  file: null,
39
47
  test: null
40
- }), 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({
41
49
  ...e,
42
50
  retried: !0
43
51
  })));
44
52
  }
45
- 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
+ });
46
65
  }
47
- function a(e, t) {
66
+ function o(e, t) {
48
67
  let r = n(t.file, e.root);
49
68
  e.diagnostics.push({
50
69
  message: `The test file ${r} ran past its time budget with mutant ${t.mutant} and was stopped.`,
@@ -55,7 +74,7 @@ function a(e, t) {
55
74
  line: null
56
75
  });
57
76
  }
58
- function o(e) {
77
+ function s(e) {
59
78
  let t = r(e);
60
79
  t !== null && (e.verdict = t.verdict);
61
80
  }
@@ -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.
@@ -2,13 +2,19 @@ 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
- * timeout waits for its confirmation, unless the unit confirmed one with what
7
- * stopped it: a timer or a hang in any confirming unit, the hit limit only in
8
- * one with the raised limit, since a mutant that only makes code hotter goes
9
- * over the hit limit too, also when the doubled time of a timer's confirmation
10
- * lets it reach its hot code; a reached pass and a unit that decided nothing
11
- * are done without a verdict, and any other verdict stands.
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
17
+ * a verdict, and any other verdict stands.
12
18
  *
13
19
  * @param verdict - Outcome of the unit (`readIsolatedUnit`).
14
20
  * @param request - Mutant and test file of the unit.
@@ -1,4 +1,4 @@
1
1
  function e(e, t) {
2
- return e === "survived" || e === null ? "none" : !(e.cause === "hit-limit" ? t.raised : t.confirming) && e.status === "Timeout" ? "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 };
@@ -11,7 +11,9 @@ import { IsolatedUnit } from '../../types/adapter/isolated-plan.js';
11
11
  * of the overrun, and one after it throws at its first site, as the count of
12
12
  * the unit stays over the limit. With no failed test, the limit stopped the
13
13
  * load or a hook, whose error is the message. A hang names no test, as no
14
- * adapter reports the try that hung.
14
+ * adapter reports the try that hung. A unit without a kill or a timeout is
15
+ * inconclusive when something else stopped the tests that reach the mutant
16
+ * before they got to it (`readUndecidedUnit`).
15
17
  *
16
18
  * @param state - State of the run.
17
19
  * @param mutant - State of the unit's mutant.
@@ -19,8 +21,9 @@ import { IsolatedUnit } from '../../types/adapter/isolated-plan.js';
19
21
  * @param ran.request - Mutant and test file key of the unit.
20
22
  * @param ran.unit - Unit of the plan.
21
23
  * @param ran.facts - Facts the adapter reported for it.
22
- * @returns Kill or timeout evidence, `survived` for a reached pass, or null
23
- * when the unit decided nothing.
24
+ * @returns Kill or timeout evidence, an `Error` verdict for an inconclusive
25
+ * unit, `survived` for a reached pass, or null when the unit decided
26
+ * nothing.
24
27
  */
25
28
  export declare function readIsolatedUnit(state: RunState, mutant: MutantState, ran: {
26
29
  request: IsolatedRequest;