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
@@ -2,7 +2,9 @@
2
2
  * Registry of the rules that skip a candidate, keyed by rule id: the ownership
3
3
  * (O) and redundancy (R) labels of the catalog, and short kebab-case names for
4
4
  * the other rules. Each rule has one category and is a heuristic or not; a skip
5
- * names only its rule, so ids, categories and flags stay consistent.
5
+ * names only its rule, so ids, categories and flags stay consistent. Built-in
6
+ * mutators and the collection name these rules; a mutator of a plugin names
7
+ * them too, after the skip rules of its plugin.
6
8
  */
7
9
  export declare let skipRules: {
8
10
  'canonical-falsy-default': {
package/dist/package.js CHANGED
@@ -1,2 +1,2 @@
1
- const e = "0.2.0";
1
+ const e = "0.3.0";
2
2
  export { e as version };
@@ -37,12 +37,32 @@ export interface AdapterContext {
37
37
  */
38
38
  concurrency: number | null
39
39
 
40
+ /**
41
+ * Whether isolated units of one test file may run at the same time, each in a
42
+ * worker of its own: the project's tests must not rely on a test file never
43
+ * running twice at once, as with a fixed file, port or database. False or
44
+ * omitted runs them one after another, in plan order. Only an adapter with
45
+ * `TestAdapter.parallelUnits` gets true.
46
+ */
47
+ parallelUnits?: boolean
48
+
40
49
  /**
41
50
  * Directory for files of this run (plans, results, heartbeats); the core
42
51
  * creates it and removes it after `close`.
43
52
  */
44
53
  workDirectory: string
45
54
 
55
+ /**
56
+ * Aborted once the run is interrupted, such as on a signal to the command
57
+ * line. From then on the adapter starts no test process and stops those that
58
+ * run, so the running call ends soon; the core waits for that call, drops
59
+ * what it gives, then calls `close` and calls nothing else. The command line
60
+ * gives this cleanup 5 seconds before it ends the process anyway, leaving
61
+ * what the adapter did not remove. Optional; an adapter that ignores it lets
62
+ * its running call go on until then.
63
+ */
64
+ signal?: AbortSignal
65
+
46
66
  /**
47
67
  * Project root: the directory of the mootant configuration, else the working
48
68
  * directory.
@@ -14,7 +14,8 @@ export interface AdapterSession {
14
14
  * Executes isolated units in one run. Several units may share a test file;
15
15
  * they run one after another, in plan order, never at the same time, since a
16
16
  * plain run of the test runner never runs a test file twice at once and tests
17
- * may rely on it (a fixed file, port or database).
17
+ * may rely on it (a fixed file, port or database), unless the context allows
18
+ * parallel units (`AdapterContext.parallelUnits`).
18
19
  */
19
20
  runIsolated(plan: IsolatedPlan): Promise<IsolatedResult>
20
21
 
@@ -7,8 +7,9 @@ export interface CacheInputs {
7
7
  * Hashes of the values of the environment variables test files see, by name,
8
8
  * for each project of the test runner by name (see `DryFile.project`), and
9
9
  * under `*` a hash of all of them but those that change from one shell to
10
- * another; a variable that is not set has no entry. Without it, variables
11
- * test files read count as not set.
10
+ * another; a variable that is not set has no entry. Other values have their
11
+ * hashes under the names `DryFile.environment` gives them. Without it,
12
+ * variables test files read count as not set.
12
13
  */
13
14
  environment?: Record<string, Record<string, string>>
14
15
 
@@ -15,8 +15,10 @@ export interface DryFile {
15
15
 
16
16
  /**
17
17
  * Names of the environment variables the test code read in the run, or `*`
18
- * when it listed them all; values come from `CacheInputs.environment`.
19
- * Omitted when the adapter does not track them.
18
+ * when it listed them all, and of other values of the test runner it read,
19
+ * under names no variable has, such as `provide=url` for Vitest's
20
+ * `inject('url')`; values come from `CacheInputs.environment`. Omitted when
21
+ * the adapter does not track them.
20
22
  */
21
23
  environment?: string[]
22
24
 
@@ -32,7 +32,8 @@ export interface IsolatedUnit {
32
32
 
33
33
  /**
34
34
  * Units of one isolated run. Several units may share a test file; they never
35
- * run at the same time.
35
+ * run at the same time, unless the context allows parallel units
36
+ * (`AdapterContext.parallelUnits`).
36
37
  */
37
38
  export interface IsolatedPlan {
38
39
  /**
@@ -74,7 +74,9 @@ export interface IsolatedFacts {
74
74
 
75
75
  /**
76
76
  * What an isolated run reported; a unit without facts is planned once more,
77
- * then becomes `Error`.
77
+ * then becomes `Error`, and so is a unit in which something else stopped the
78
+ * tests that reach its mutant before they got to it, such as a failed suite
79
+ * hook.
78
80
  */
79
81
  export interface IsolatedResult {
80
82
  /**
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * What a run of a test file read besides the code of its mutant: the files it
3
- * depended on and the environment variables it read. The cache compares them
4
- * with the dry run of the test file, and evidence that read more is reused only
5
- * while those extra inputs are unchanged.
3
+ * depended on and the environment variables and other values it read. The cache
4
+ * compares them with the dry run of the test file, and evidence that read more
5
+ * is reused only while those extra inputs are unchanged.
6
6
  */
7
7
  export interface RunInputs {
8
8
  /**
@@ -14,7 +14,8 @@ export interface RunInputs {
14
14
 
15
15
  /**
16
16
  * Names of the environment variables the test code read, or `*` when it
17
- * listed them all; values come from `CacheInputs.environment`.
17
+ * listed them all, and of other values, as in `DryFile.environment`; values
18
+ * come from `CacheInputs.environment`.
18
19
  */
19
20
  environment: string[]
20
21
  }
@@ -15,6 +15,13 @@ export interface TestAdapter {
15
15
  */
16
16
  start(context: AdapterContext): Promise<AdapterSession>
17
17
 
18
+ /**
19
+ * Whether the adapter runs isolated units of one test file at the same time
20
+ * when the context allows it (`AdapterContext.parallelUnits`). Optional;
21
+ * without it the core never allows it, and a run that asks for it notes so.
22
+ */
23
+ parallelUnits?: boolean
24
+
18
25
  /**
19
26
  * Version of the adapter itself, part of the cache key; the version of the
20
27
  * test runner is `AdapterSession.version`. Optional.
@@ -5,11 +5,12 @@ import { TryCause } from '../run/try-cause.js';
5
5
  */
6
6
  export interface CacheEntry {
7
7
  /**
8
- * `Killed` with the test of the kill, or `Survived` for an isolated unit that
9
- * reached the mutant and passed, or for a batch try that passed, whether it
10
- * reached the mutant or not.
8
+ * `Killed` with the test of the kill; `Timeout` for an isolated unit over its
9
+ * raised hit limit; or `Survived` for an isolated unit that reached the
10
+ * mutant and passed, or for a batch try that passed, whether it reached the
11
+ * mutant or not.
11
12
  */
12
- status: 'Survived' | 'Killed'
13
+ status: 'Survived' | 'Timeout' | 'Killed'
13
14
 
14
15
  /**
15
16
  * Path the evidence came from; batch entries are only reused in fast mode.
@@ -24,12 +25,12 @@ export interface CacheEntry {
24
25
  incremental: string | null
25
26
 
26
27
  /**
27
- * First line of the failure of a kill, or null.
28
+ * First line of the failure of a kill or a timeout, or null.
28
29
  */
29
30
  message: string | null
30
31
 
31
32
  /**
32
- * How the kill was detected, or null for `Survived`.
33
+ * How the kill or the timeout was detected, or null for `Survived`.
33
34
  */
34
35
  cause: TryCause | null
35
36
 
@@ -40,7 +41,8 @@ export interface CacheEntry {
40
41
  inputs: string | null
41
42
 
42
43
  /**
43
- * Id of the test that failed, or null (load-time kills, `Survived`).
44
+ * Id of the test that failed or ran into the hit limit, or null (load-time
45
+ * kills and timeouts, `Survived`).
44
46
  */
45
47
  test: string | null
46
48
 
@@ -5,8 +5,8 @@
5
5
  */
6
6
  export interface CachedInputs {
7
7
  /**
8
- * Names of environment variables with the hash of their values, or null for a
9
- * variable that was not set, sorted.
8
+ * Names of environment variables, or of other values (`DryFile.environment`),
9
+ * with the hash of their values, or null for one that was not set, sorted.
10
10
  */
11
11
  environment: [string, string | null][]
12
12
 
@@ -0,0 +1,76 @@
1
+ import { DryRunResult } from '../adapter/dry-run-result.js';
2
+ import { CacheInputs } from '../adapter/cache-inputs.js';
3
+ import { Diagnostic } from '../mutant/diagnostic.js';
4
+ /**
5
+ * What a run saw of its test runner up to the end of its dry phase, saved next
6
+ * to the cache file, so that a later run whose inputs are all unchanged can
7
+ * decide its mutants from cached verdicts without starting the test runner.
8
+ * Paths are absolute: the key includes the project root.
9
+ */
10
+ export interface DrySnapshot {
11
+ /**
12
+ * What the session reported besides its runs: its version, workers and
13
+ * warnings, and what verdicts depend on beyond each test file, as
14
+ * `prepareRunCache` asked it once (`AdapterSession.cacheInputs`).
15
+ */
16
+ session: {
17
+ diagnostics: Diagnostic[]
18
+ version: string | null
19
+ workers: number | null
20
+ inputs: CacheInputs
21
+ }
22
+
23
+ /**
24
+ * Outcome of the dry phase: the final dry run, the messages of the files
25
+ * whose mutants get no verdict, by display path, and the diagnostics of the
26
+ * phase.
27
+ */
28
+ phase: {
29
+ errors: [string, string][]
30
+ diagnostics: Diagnostic[]
31
+ dry: DryRunResult
32
+ }
33
+
34
+ /**
35
+ * Environment variables of the main process as the run started, before the
36
+ * test runner could set any (`listVariableHashes`): each one test code read,
37
+ * in the dry run or in a unit whose evidence the cache holds, and `*` for all
38
+ * but those that change from shell to shell, with the hash of the value, or
39
+ * null when unset, as the names of other values (`DryFile.environment`)
40
+ * always are.
41
+ */
42
+ variables: [string, string | null][]
43
+
44
+ /**
45
+ * Files the dry run and the cache keys depended on, with the hash of their
46
+ * contents after the dry run, or null for a missing one: the files of
47
+ * `session.inputs`, the lockfile with the files that tell what was installed
48
+ * (`listInstallStates`), `package.json`, the `.env`, `tsconfig` and
49
+ * `jsconfig` files of the root, and every test file of the dry run with its
50
+ * dependencies, inside the root or not, under `node_modules` too.
51
+ */
52
+ files: [string, string | null][]
53
+
54
+ /**
55
+ * Test files and setup files of the session (`AdapterSession.listTestFiles`).
56
+ */
57
+ testFiles: string[]
58
+
59
+ /**
60
+ * Version of the format (`CACHE_VERSION`).
61
+ */
62
+ version: number
63
+
64
+ /**
65
+ * Hash of everything under the project root (`hashProjectTree`), taken before
66
+ * the test runner started and checked again before saving: a file added,
67
+ * removed or changed anywhere, such as a new test file or a helper of a test
68
+ * file the dry run did not run, makes the snapshot stale.
69
+ */
70
+ tree: string
71
+
72
+ /**
73
+ * Hash of what the dry run was asked to do (`getDrySnapshotKey`).
74
+ */
75
+ key: string
76
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Everything under the project root as `hashProjectTree` saw it.
3
+ */
4
+ export interface ProjectTree {
5
+ /**
6
+ * Each path under the root, relative to it with `/` separators, with what it
7
+ * is as text: a directory, a file with the hash of its contents, or a
8
+ * symbolic link with its target.
9
+ */
10
+ entries: ReadonlyMap<string, string>
11
+
12
+ /**
13
+ * SHA-256 in hex over every entry.
14
+ */
15
+ hash: string
16
+ }
@@ -1,7 +1,7 @@
1
1
  import { CachedInputs } from './cached-inputs.js';
2
2
  import { CacheEntry } from './cache-entry.js';
3
3
  /**
4
- * Content of the cache file, `node_modules/.cache/mootant/run-v2.json`.
4
+ * Content of the cache file, `node_modules/.cache/mootant/run-v7.json`.
5
5
  */
6
6
  export interface RunCacheFile {
7
7
  /**
@@ -40,8 +40,9 @@ export interface RunCache {
40
40
  recordBatch(mutant: MutantState, test: string, evidence: CacheEvidence): void
41
41
 
42
42
  /**
43
- * Records the evidence of an isolated unit: a kill or a reached pass, with
44
- * what the unit read. Kills by a crash, timeouts and errors are not stored,
43
+ * Records the final evidence of an isolated unit: a kill, a timeout or a
44
+ * reached pass, with what the unit read. Kills by a crash, errors, and
45
+ * timeouts other than one by the hit limit outside fast mode are not stored,
45
46
  * and neither is anything about a test file without a key or a unit whose
46
47
  * inputs are unknown.
47
48
  */
@@ -107,7 +108,7 @@ export interface CacheEvidence<
107
108
  inputs: RunInputs | undefined | null
108
109
 
109
110
  /**
110
- * A kill or a pass.
111
+ * A kill, a timeout or a pass.
111
112
  */
112
113
  verdict: Verdict
113
114
  }
@@ -118,8 +119,8 @@ export interface CacheEvidence<
118
119
  */
119
120
  export interface PendingInputs {
120
121
  /**
121
- * Names of environment variables with the hash of their values, or null for a
122
- * variable that is not set, sorted.
122
+ * Names of environment variables, or of other values, with the hash of their
123
+ * values, or null for one that is not set, sorted.
123
124
  */
124
125
  environment: [string, string | null][]
125
126
 
@@ -1,10 +1,19 @@
1
+ import { SkipRule } from '../mutant/skip-rule.js';
1
2
  import { Mutator } from '../mutator/mutator.js';
2
3
  import { Preset } from './preset.js';
3
4
  /**
4
- * Package of mutators and presets. Built-in mutators form the core plugin;
5
- * other plugins get a namespace that prefixes their ids.
5
+ * Package of mutators, presets and skip rules. Built-in mutators form the core
6
+ * plugin; other plugins get a namespace that prefixes their ids.
6
7
  */
7
8
  export interface Plugin {
9
+ /**
10
+ * Rules that the skips of the plugin's mutators name, keyed by kebab-case
11
+ * name; reports give a rule the id `namespace/name`. A skip may also name a
12
+ * built-in rule that the plugin does not declare. The core plugin has none:
13
+ * its mutators name the built-in rules.
14
+ */
15
+ skipRules?: Record<string, SkipRule>
16
+
8
17
  /**
9
18
  * Mutators keyed by kebab-case name.
10
19
  */
@@ -40,6 +40,16 @@ export interface RunConfig {
40
40
  */
41
41
  html?: boolean | string
42
42
 
43
+ /**
44
+ * Parallel units: run one test file for several mutants at once, each run in
45
+ * a process of its own, with Vitest and Node Test; faster when a few test
46
+ * files cover most mutants, but runs of one test file that share something
47
+ * outside their processes, such as a fixed file, port or database, may give
48
+ * false verdicts. False when omitted, so a test file runs for one mutant at a
49
+ * time, as a plain run never runs a test file twice at once.
50
+ */
51
+ parallelUnits?: boolean
52
+
43
53
  /**
44
54
  * Incremental mode: reuse a cached verdict while the declaration of its
45
55
  * mutant, what that uses in its file and what its test file reads outside the
@@ -14,6 +14,12 @@ export interface RunSettings {
14
14
  */
15
15
  threshold: number | null
16
16
 
17
+ /**
18
+ * Whether parallel units were asked for, which the run uses only with an
19
+ * adapter that runs them.
20
+ */
21
+ parallelUnits: boolean
22
+
17
23
  /**
18
24
  * How try limits grow from the dry run.
19
25
  */
@@ -0,0 +1,12 @@
1
+ import { SkipRuleId } from './skip-rule-id.js';
2
+ import { SkipNote } from './skip-note.js';
3
+ /**
4
+ * Skip note of a built-in mutator or of the collection: its rule is a built-in
5
+ * id, so that a rule the registry does not have fails to compile.
6
+ */
7
+ export interface CoreNote extends SkipNote {
8
+ /**
9
+ * Id of the rule in the registry.
10
+ */
11
+ rule: SkipRuleId
12
+ }
@@ -15,6 +15,7 @@ export interface Diagnostic {
15
15
  | 'unclosed-ignore-start'
16
16
  | 'unmatched-ignore-end'
17
17
  | 'malformed-directive'
18
+ | 'tests-stopped-early'
18
19
  | 'test-file-excluded'
19
20
  | 'cache-write-failed'
20
21
  | 'config-overridden'
@@ -0,0 +1,11 @@
1
+ import { SkipRule } from './skip-rule.js';
2
+ /**
3
+ * Skip rule with the id that reports give it.
4
+ */
5
+ export interface RegisteredSkipRule extends SkipRule {
6
+ /**
7
+ * Full id: `namespace/name` for a rule of a plugin, the name itself for a
8
+ * built-in rule.
9
+ */
10
+ id: string
11
+ }
@@ -1,5 +1,4 @@
1
1
  import { Node } from 'oxc-parser';
2
- import { SkipRuleId } from './skip-rule-id.js';
3
2
  /**
4
3
  * Why a mutator does not emit a replacement it would otherwise make.
5
4
  */
@@ -18,13 +17,15 @@ export interface SkipNote {
18
17
  heuristic?: boolean
19
18
 
20
19
  /**
21
- * Id of the rule in the registry, which gives the category and whether the
22
- * rule is a heuristic.
20
+ * Plain-English reason, worded to follow `skipped: `.
23
21
  */
24
- rule: SkipRuleId
22
+ reason: string
25
23
 
26
24
  /**
27
- * Plain-English reason, worded to follow `skipped: `.
25
+ * Name of the rule, which gives the category and whether the rule is a
26
+ * heuristic: a key of the `skipRules` of the mutator's plugin, else an id of
27
+ * the registry. A skip with any other rule is a mutator error, and its
28
+ * replacement is dropped.
28
29
  */
29
- reason: string
30
+ rule: string
30
31
  }
@@ -1,6 +1,7 @@
1
1
  import { skipRules } from '../../core/skips/skip-rules.js';
2
2
  /**
3
- * Id of a skip rule of the registry: a catalog label such as `O3` or `R2`, or a
4
- * short kebab-case name such as `lower-bound`.
3
+ * Id of a built-in skip rule, a key of the registry: a catalog label such as
4
+ * `O3` or `R2`, or a short kebab-case name such as `lower-bound`. Rules of a
5
+ * plugin are not among them.
5
6
  */
6
7
  export type SkipRuleId = keyof typeof skipRules
@@ -1,6 +1,7 @@
1
1
  import { SkipCategory } from './skip-category.js';
2
2
  /**
3
- * Entry of the registry of skip rules.
3
+ * Rule that skips candidates: an entry of the registry of built-in rules or of
4
+ * the `skipRules` of a plugin.
4
5
  */
5
6
  export interface SkipRule {
6
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { RegisteredMutator } from '../mutator/registered-mutator.js';
2
2
  import { SkipJustifier } from './skip-justifier.js';
3
+ import { SkipCategory } from './skip-category.js';
3
4
  import { TextEdit } from '../source/text-edit.js';
4
- import { SkipRuleId } from './skip-rule-id.js';
5
5
  import { MutantKind } from './mutant-kind.js';
6
6
  /**
7
7
  * Replacement that was considered and not emitted, before it is sorted.
@@ -25,7 +25,13 @@ export interface SkippedCandidate {
25
25
  kind: MutantKind | null
26
26
 
27
27
  /**
28
- * Whether the skip rests on a guess beyond its rule.
28
+ * Category of the skip rule.
29
+ */
30
+ category: SkipCategory
31
+
32
+ /**
33
+ * Whether the skip rests on a guess: its rule is a heuristic, or the skip
34
+ * also rests on one.
29
35
  */
30
36
  heuristic: boolean
31
37
 
@@ -41,11 +47,6 @@ export interface SkippedCandidate {
41
47
  */
42
48
  emission: number
43
49
 
44
- /**
45
- * Id of the skip rule.
46
- */
47
- rule: SkipRuleId
48
-
49
50
  /**
50
51
  * Plain-English reason of the skip.
51
52
  */
@@ -61,6 +62,12 @@ export interface SkippedCandidate {
61
62
  */
62
63
  text: string
63
64
 
65
+ /**
66
+ * Id of the skip rule: a built-in id, or `namespace/name` for a rule of a
67
+ * plugin.
68
+ */
69
+ rule: string
70
+
64
71
  /**
65
72
  * End of the replaced range.
66
73
  */
@@ -1,7 +1,6 @@
1
1
  import { SkipJustifier } from './skip-justifier.js';
2
2
  import { SkipCategory } from './skip-category.js';
3
3
  import { TextEdit } from '../source/text-edit.js';
4
- import { SkipRuleId } from './skip-rule-id.js';
5
4
  import { MutantKind } from './mutant-kind.js';
6
5
  /**
7
6
  * Mutation that a mutator or the pipeline considered and did not emit. It has
@@ -42,11 +41,6 @@ export interface SkippedMutant {
42
41
  */
43
42
  focus?: TextEdit
44
43
 
45
- /**
46
- * Id of the skip rule.
47
- */
48
- rule: SkipRuleId
49
-
50
44
  /**
51
45
  * Id of the mutator that considered the mutation.
52
46
  */
@@ -62,6 +56,12 @@ export interface SkippedMutant {
62
56
  */
63
57
  start: number
64
58
 
59
+ /**
60
+ * Id of the skip rule: a built-in id such as `O3` or `lower-bound`, or
61
+ * `namespace/name` for a rule of a plugin.
62
+ */
63
+ rule: string
64
+
65
65
  /**
66
66
  * Path of the file relative to the working directory, with `/` separators.
67
67
  */
@@ -7,8 +7,9 @@ import { MutatorMeta } from './mutator-meta.js';
7
7
  */
8
8
  export interface Mutator<Options extends object = object> {
9
9
  /**
10
- * Creates the visitors for one file. Mootant calls it once per file, so the
11
- * visitors may keep state for that file in the closure.
10
+ * Creates the visitors for one program: a file, or a script block or the
11
+ * template of a Vue or Svelte file. Mootant calls it once per program, so the
12
+ * visitors may keep state for that program in the closure.
12
13
  */
13
14
  create(context: MutatorContext<Options>): MutatorVisitors
14
15
 
@@ -1,8 +1,16 @@
1
+ import { RegisteredSkipRule } from '../mutant/registered-skip-rule.js';
1
2
  import { Mutator } from './mutator.js';
2
3
  /**
3
4
  * Mutator known to the registry.
4
5
  */
5
6
  export interface RegisteredMutator {
7
+ /**
8
+ * Skip rules of the plugin of the mutator, keyed by the name a skip gives,
9
+ * each with its id `namespace/name`, which a skip names before the built-in
10
+ * rules; omitted for a built-in mutator.
11
+ */
12
+ skipRules?: ReadonlyMap<string, RegisteredSkipRule>
13
+
6
14
  /**
7
15
  * Module that produces the replacements.
8
16
  */
@@ -1,4 +1,4 @@
1
- import { SkipNote } from '../mutant/skip-note.js';
1
+ import { CoreNote } from '../mutant/core-note.js';
2
2
  /**
3
3
  * Edit of a regular expression pattern that a regex mutator considers, with
4
4
  * offsets relative to the pattern.
@@ -7,7 +7,7 @@ export interface RegexChange {
7
7
  /**
8
8
  * Why the change is not emitted, or null when it is.
9
9
  */
10
- skip: SkipNote | null
10
+ skip: CoreNote | null
11
11
 
12
12
  /**
13
13
  * Offset of the first replaced character of the pattern.
@@ -201,7 +201,8 @@ export interface HtmlReportSkipped {
201
201
  start: number
202
202
 
203
203
  /**
204
- * Id of the skip rule, such as `O3` or `lower-bound`.
204
+ * Id of the skip rule, such as `O3`, `lower-bound` or, for a rule of a
205
+ * plugin, `namespace/name`.
205
206
  */
206
207
  rule: string
207
208
 
@@ -282,7 +283,7 @@ export interface HtmlReport {
282
283
  */
283
284
  export interface HtmlReportMeta extends Pick<
284
285
  RunReport,
285
- 'runnerVersion' | 'runner' | 'preset' | 'since' | 'mode'
286
+ 'parallelUnits' | 'runnerVersion' | 'runner' | 'preset' | 'since' | 'mode'
286
287
  > {
287
288
  /**
288
289
  * Characters ids are cut to: the shortest that tells apart every listed
@@ -70,8 +70,9 @@ export interface ListReportSkipped {
70
70
  line: number
71
71
 
72
72
  /**
73
- * Id of the skip rule: a catalog label such as `O3` or `R2`, or a short
74
- * kebab-case name such as `lower-bound` or `duplicate`.
73
+ * Id of the skip rule: a catalog label such as `O3` or `R2`, a short
74
+ * kebab-case name such as `lower-bound` or `duplicate`, or `namespace/name`
75
+ * for a rule of a plugin.
75
76
  */
76
77
  rule: string
77
78