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
@@ -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,4 +1,4 @@
1
- import { ColorName, Color } from '../../cli/terminal/colors.js';
1
+ import { ColorName, Color } from '../../cli/terminal/create-colors.js';
2
2
  /**
3
3
  * How text reports look where they are printed.
4
4
  */
@@ -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
  */
@@ -36,8 +36,8 @@ export interface PresetSettings {
36
36
  templates: boolean
37
37
 
38
38
  /**
39
- * Whether mutants that only a timeout can kill are emitted, such as a loop
40
- * test forced to `true`. False unless a preset turns it on.
39
+ * Whether mutants that may cause timeouts are emitted, such as a loop test
40
+ * forced to `true`. False unless a preset turns it on.
41
41
  */
42
42
  timeouts: boolean
43
43
  }
@@ -5,14 +5,22 @@ import { TestAdapter } from '../adapter/test-adapter.js';
5
5
  */
6
6
  export interface RunConfig {
7
7
  /**
8
- * Per-try timeout: `ceil(factor × dry duration) + constant` milliseconds.
9
- * Defaults: factor 3, constant 250.
8
+ * Timeout: `ceil(factor × dry duration) + constant` milliseconds for loading
9
+ * a test file and for each test, added up while a test file runs with a
10
+ * mutant, or per test in the batch runs of fast mode. A mutant over it runs
11
+ * again with twice the timeout of its whole test file and counts as a timeout
12
+ * only when that run times out too, even when it only slows tests that pass
13
+ * in a plain run. Defaults: factor 3, constant 250.
10
14
  */
11
15
  timeout?: { constant?: number; factor?: number }
12
16
 
13
17
  /**
14
- * Hit limit per try: `max(floor, factor × dry hits)`. Defaults: factor 100,
15
- * floor 100000.
18
+ * Hit limit: `max(floor, factor × dry hits)` for loading a test file and for
19
+ * each test, added up while a test file runs with a mutant, or per test in
20
+ * the batch runs of fast mode, which send a mutant over it to a run of its
21
+ * whole test file. A mutant over it runs its test file once more with doubled
22
+ * time and `factor × floor` more evaluations, and counts as a timeout only
23
+ * when that run times out too. Defaults: factor 100, floor 100000.
16
24
  */
17
25
  hitLimit?: { factor?: number; floor?: number }
18
26
 
@@ -32,6 +40,16 @@ export interface RunConfig {
32
40
  */
33
41
  html?: boolean | string
34
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
+
35
53
  /**
36
54
  * Incremental mode: reuse a cached verdict while the declaration of its
37
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
  */
@@ -14,7 +14,8 @@ export interface IndexedMutant extends HtmlReportMutant {
14
14
  endLine: number
15
15
 
16
16
  /**
17
- * 1-based UTF-16 column of the first replaced character.
17
+ * 1-based UTF-16 column of the first replaced character, or of the removed
18
+ * element for kinds `element` and `property`.
18
19
  */
19
20
  column: number
20
21
 
@@ -24,7 +25,8 @@ export interface IndexedMutant extends HtmlReportMutant {
24
25
  index: number
25
26
 
26
27
  /**
27
- * 1-based line of the first replaced character.
28
+ * 1-based line of the first replaced character, or of the removed element for
29
+ * kinds `element` and `property`.
28
30
  */
29
31
  line: number
30
32
  }
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * Change of a text as the page shows it: a range of the file, the whole text
3
- * written in its place and, when the mutator names one, the part of the range
4
- * the change amounts to.
3
+ * written in its place and, when there is one, the part of the range the change
4
+ * amounts to.
5
5
  */
6
6
  export interface ShownChange {
7
7
  /**
8
- * Part of the range the change amounts to, when a mutator names one.
8
+ * Part of the range the change amounts to, when the mutator names one or the
9
+ * change removes an array element or an object member with its comma.
9
10
  */
10
11
  focus?: { replacement: string; start: number; end: number }
11
12
 
@@ -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,37 @@
1
+ import { ObjectExpression, ArrayExpression } from 'oxc-parser';
2
+ import { MutantKind } from './mutant-kind.js';
3
+ /**
4
+ * Removal of one element of an array literal or one member of an object
5
+ * literal, which a mutator asks for with an empty replacement text.
6
+ */
7
+ export interface ListRemoval {
8
+ /**
9
+ * Kind of the narrowed removal: `element` in an array, `property` in an
10
+ * object.
11
+ */
12
+ kind: Extract<MutantKind, 'property' | 'element'>
13
+
14
+ /**
15
+ * Literal the element or member is removed from.
16
+ */
17
+ list: ObjectExpression | ArrayExpression
18
+
19
+ /**
20
+ * Whether the removal is narrowed to the element and hosted with the other
21
+ * removals of its literal; false when it replaces the whole literal: for
22
+ * every element of an array with a hole, for a member that a spread would
23
+ * change, such as an accessor, and for every removal in a Svelte template.
24
+ */
25
+ narrow: boolean
26
+
27
+ /**
28
+ * Number of elements or members of the literal whose removal is not narrowed,
29
+ * each of which takes a copy of the whole literal.
30
+ */
31
+ copies: number
32
+
33
+ /**
34
+ * Position of the element or member in the literal.
35
+ */
36
+ index: number
37
+ }
@@ -1,12 +1,17 @@
1
1
  import { RegisteredMutator } from '../mutator/registered-mutator.js';
2
2
  import { SourceRange } from '../source/source-range.js';
3
- import { TextEdit } from '../source/text-edit.js';
4
3
  import { IgnoreRule } from './ignore-rule.js';
4
+ import { MutantHost } from './mutant-host.js';
5
5
  /**
6
6
  * Replacement accepted from a visitor, before ids, the solitary rule and
7
- * deduplication.
7
+ * deduplication, with how the mutant switch would host it (see `MutantHost`).
8
8
  */
9
- export interface MutantCandidate {
9
+ export type MutantCandidate = CandidateFields & MutantHost
10
+
11
+ /**
12
+ * Fields of every candidate, whatever its host.
13
+ */
14
+ interface CandidateFields {
10
15
  /**
11
16
  * Ranges of the nodes whose effect the mutant removes as a whole, or null
12
17
  * when the solitary rule does not apply.
@@ -23,39 +28,28 @@ export interface MutantCandidate {
23
28
  */
24
29
  registered: RegisteredMutator
25
30
 
26
- /**
27
- * How the mutant is switched on, derived from the replaced node.
28
- */
29
- kind: 'expression' | 'block'
30
-
31
31
  /**
32
32
  * Dotted names of the declarations around the replaced node.
33
33
  */
34
34
  scope: string | null
35
35
 
36
- /**
37
- * Edit inside the replaced range that the mutant amounts to, which reports
38
- * show in place of the whole range; absent when the mutator names none.
39
- */
40
- focus?: TextEdit
41
-
42
36
  /**
43
37
  * Position in the order in which visitors returned replacements.
44
38
  */
45
39
  emission: number
46
40
 
47
41
  /**
48
- * Start of the replaced node.
42
+ * Start of the replaced range.
49
43
  */
50
44
  start: number
51
45
 
52
46
  /**
53
- * Text written in place of the node.
47
+ * Text written in place of the range.
54
48
  */
55
49
  text: string
56
50
 
57
51
  /**
58
- * End of the replaced node.
52
+ * End of the replaced range.
59
53
  */
60
54
  end: number
61
55
  }
@@ -0,0 +1,49 @@
1
+ import { SourceRange } from '../source/source-range.js';
2
+ import { TextEdit } from '../source/text-edit.js';
3
+ /**
4
+ * How the mutant switch hosts a mutant, with what the host needs: a mutant that
5
+ * replaces a range is hosted around that range, and the removal of an array
6
+ * element or an object member is hosted with the other removals of its
7
+ * literal.
8
+ */
9
+ export type MutantHost = RemovalHost | RangeHost
10
+
11
+ /**
12
+ * Mutant hosted around the range it replaces.
13
+ */
14
+ interface RangeHost {
15
+ /**
16
+ * `expression` for a conditional expression around the replaced expression,
17
+ * `block` for an `if`/`else` around the replaced statement.
18
+ */
19
+ kind: 'expression' | 'block'
20
+
21
+ /**
22
+ * Edit inside the replaced range that the mutant amounts to, which reports
23
+ * show in place of the whole range; absent when the mutator names none.
24
+ */
25
+ focus?: TextEdit
26
+ }
27
+
28
+ /**
29
+ * Removal of an array element (`element`) or an object member (`property`),
30
+ * hosted at its literal: the switched file runs the literal as written unless
31
+ * one of its removals is active, and then a copy without that element.
32
+ */
33
+ interface RemovalHost {
34
+ /**
35
+ * `element` in an array literal, `property` in an object literal.
36
+ */
37
+ kind: 'property' | 'element'
38
+
39
+ /**
40
+ * Range of the literal the element or member is removed from.
41
+ */
42
+ list: SourceRange
43
+
44
+ /**
45
+ * The removed element or member, with an empty text; reports show it in place
46
+ * of the whole range.
47
+ */
48
+ focus: TextEdit
49
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * How the mutant switch hosts a mutant, and so how a mutant is applied to the
3
+ * file:
4
+ *
5
+ * - `expression`: a conditional expression around the replaced expression; the
6
+ * replacement is written inside parentheses, and in place of a quoted JSX
7
+ * attribute value inside braces around them, as in `type={("")}`.
8
+ * - `block`: an `if`/`else` around the replaced statement; the replacement is
9
+ * written inside braces.
10
+ * - `element`: the removal of an element of an array literal, hosted with the
11
+ * other removals of the literal: the switched file runs the literal as
12
+ * written unless one of them is active, and then a copy of it that leaves
13
+ * that element out. The replacement, an empty text, is written as is, which
14
+ * deletes the element with its comma.
15
+ * - `property`: the removal of a member of an object literal, hosted and written
16
+ * like `element`.
17
+ */
18
+ export type MutantKind = 'expression' | 'property' | 'element' | 'block'
@@ -1,14 +1,12 @@
1
+ import { MutantKind } from './mutant-kind.js';
1
2
  import { Mutant } from './mutant.js';
2
3
  /**
3
4
  * Mutants that replace the same range of a file, with the groups of the ranges
4
- * inside it. The switched file hosts each group once.
5
+ * inside it. The switched file hosts each group once. The range of a group of
6
+ * removals of array elements or object members is their literal, which they are
7
+ * hosted around together.
5
8
  */
6
9
  export interface MutantRange {
7
- /**
8
- * How the group is hosted: a conditional expression or an `if` statement.
9
- */
10
- kind: 'expression' | 'block'
11
-
12
10
  /**
13
11
  * Groups of the ranges inside this one, sorted by start.
14
12
  */
@@ -20,12 +18,21 @@ export interface MutantRange {
20
18
  mutants: Mutant[]
21
19
 
22
20
  /**
23
- * Offset of the first replaced code unit.
21
+ * How the group is hosted: a conditional expression, an `if` statement, or a
22
+ * conditional expression around an array or object literal with a copy of it
23
+ * for the removals of its elements or members.
24
+ */
25
+ kind: MutantKind
26
+
27
+ /**
28
+ * Offset of the first replaced code unit, or of the literal of an `element`
29
+ * or `property` group.
24
30
  */
25
31
  start: number
26
32
 
27
33
  /**
28
- * Offset just past the last replaced code unit.
34
+ * Offset just past the last replaced code unit, or past the literal of an
35
+ * `element` or `property` group.
29
36
  */
30
37
  end: number
31
38
  }
@@ -1,22 +1,22 @@
1
1
  import { IgnoreSource } from './ignore-source.js';
2
2
  import { MutantStatus } from './mutant-status.js';
3
- import { TextEdit } from '../source/text-edit.js';
3
+ import { MutantHost } from './mutant-host.js';
4
4
  /**
5
- * Change to the source code that tests are expected to detect.
5
+ * Change to the source code that tests are expected to detect, with how the
6
+ * mutant switch hosts it (see `MutantHost`).
6
7
  */
7
- export interface Mutant {
8
+ export type Mutant = MutantFields & MutantHost
9
+
10
+ /**
11
+ * Fields of every mutant, whatever its host.
12
+ */
13
+ interface MutantFields {
8
14
  /**
9
15
  * Ignore directive comment that excluded the mutant, or null while the mutant
10
16
  * is pending.
11
17
  */
12
18
  ignoredBy: IgnoreSource | null
13
19
 
14
- /**
15
- * How the mutant will be switched on: as a ternary around an expression, or
16
- * as an `if`/`else` around a statement.
17
- */
18
- kind: 'expression' | 'block'
19
-
20
20
  /**
21
21
  * Why the mutant is not tested: the reason of the ignore directive that
22
22
  * covers it. Null while the mutant is pending.
@@ -39,12 +39,6 @@ export interface Mutant {
39
39
  */
40
40
  replacement: string
41
41
 
42
- /**
43
- * Edit inside the replaced range that the mutant amounts to, which reports
44
- * show in place of the whole range; absent when the mutator names none.
45
- */
46
- focus?: TextEdit
47
-
48
42
  /**
49
43
  * Id of the mutator that produced the mutant: `name` or `plugin/name`.
50
44
  */
@@ -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
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * How switched code at one place of a file reaches the mutant runtime.
3
+ */
4
+ export interface SiteSyntax {
5
+ /**
6
+ * Writes the id of a mutant as a string literal that the place accepts.
7
+ */
8
+ quote(id: string): string
9
+
10
+ /**
11
+ * Expression that reads the runtime; undefined where none is installed.
12
+ */
13
+ runtime: string
14
+ }
@@ -15,7 +15,9 @@ export interface SkipJustifier {
15
15
  mutator: string
16
16
 
17
17
  /**
18
- * Offset of the node the justifying mutant replaces.
18
+ * Offset where the justifying mutant is placed: at its removed element for
19
+ * kinds `element` and `property`, and at the start of the range it replaces
20
+ * otherwise.
19
21
  */
20
22
  start: number
21
23
  }