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
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Writes an expression as a branch of the mutant switch, in parentheses, which
3
+ * keep a sequence whole. The oxc parser, which Vite 8 reads modules with, takes
4
+ * a regular expression literal whose pattern starts with `<!--` right after a
5
+ * `(` that opens an expression for an HTML comment, white space and comments
6
+ * between them aside, which a module does not allow, so the module would not
7
+ * load. The nearest `(` before such a literal, of the branch or of the text, is
8
+ * followed by `0, ` when its parentheses hold a value, which keeps it: `(0,
9
+ * /<!--/g)`. Parentheses around a callee, a tag or a write target stay as they
10
+ * are, since `0, ` would lose the `this` of the call or the target. Only the
11
+ * start of a text lands somewhere new in the switched code; every other `(`
12
+ * stays after the code the source or the mutator put before it.
13
+ *
14
+ * @param text - Replacement or original text of the branch.
15
+ * @returns Text to write as the branch.
16
+ */
17
+ export declare function renderBranch(text: string): string;
@@ -0,0 +1,81 @@
1
+ import { isExpressionWrapper as e } from "../tree/is-expression-wrapper.js";
2
+ import { parseExpression as t } from "../text/parse-expression.js";
3
+ const n = [
4
+ "ts",
5
+ "tsx",
6
+ "jsx"
7
+ ], r = /^\s*<!--/u;
8
+ function i(e) {
9
+ let r = `(${e})`;
10
+ if (!e.includes("<!--")) return r;
11
+ for (let i of n) {
12
+ let n = t(e, i);
13
+ if (n?.type === "ParenthesizedExpression") {
14
+ let e = o(n);
15
+ if (e === null) return r;
16
+ let t = e - n.start + 1;
17
+ return `${r.slice(0, t)}0, ${r.slice(t)}`;
18
+ }
19
+ }
20
+ return r;
21
+ }
22
+ function a(t) {
23
+ if (e(t) || t.type === "ChainExpression") return {
24
+ node: t.expression,
25
+ value: null
26
+ };
27
+ switch (t.type) {
28
+ case "TaggedTemplateExpression": return {
29
+ node: t.tag,
30
+ value: !1
31
+ };
32
+ case "ConditionalExpression": return {
33
+ node: t.test,
34
+ value: !0
35
+ };
36
+ case "AssignmentExpression": return {
37
+ node: t.left,
38
+ value: !1
39
+ };
40
+ case "SequenceExpression": return {
41
+ node: t.expressions[0],
42
+ value: !0
43
+ };
44
+ case "LogicalExpression":
45
+ case "BinaryExpression": return {
46
+ node: t.left,
47
+ value: !0
48
+ };
49
+ case "UpdateExpression": return t.prefix ? null : {
50
+ node: t.argument,
51
+ value: !1
52
+ };
53
+ case "MemberExpression": return {
54
+ node: t.object,
55
+ value: !0
56
+ };
57
+ case "CallExpression": return {
58
+ node: t.callee,
59
+ value: !1
60
+ };
61
+ default: return null;
62
+ }
63
+ }
64
+ function o(e) {
65
+ let t = {
66
+ start: e.start,
67
+ value: !0
68
+ }, n = !0, i = e, o = a(i);
69
+ for (; o !== null;) {
70
+ let { node: e } = o;
71
+ n = o.value ?? n, e.type === "ParenthesizedExpression" ? t = {
72
+ start: e.start,
73
+ value: n
74
+ } : i.type !== "ParenthesizedExpression" && e.start !== i.start && (t = {
75
+ start: e.start,
76
+ value: !1
77
+ }), i = e, o = a(i);
78
+ }
79
+ return i.type === "Literal" && "regex" in i && r.test(i.regex.pattern) && t.value ? t.start : null;
80
+ }
81
+ export { i as renderBranch };
@@ -1,22 +1,33 @@
1
1
  import { MutantRange } from '../../types/mutant/mutant-range.js';
2
+ import { SiteSyntax } from '../../types/mutant/site-syntax.js';
2
3
  /**
3
4
  * Renders the host of one group of mutants, the hosts of its nested groups
4
5
  * first. An expression group becomes a chain of conditional expressions, a
5
6
  * block group a chain of `if` statements; the last branch holds the original
6
- * text with the nested hosts in it, and replacement texts are used verbatim. An
7
- * expression group that starts a statement of a statement list gets the guard
8
- * of that statement in front.
7
+ * text with the nested hosts in it, and replacement texts are used verbatim.
8
+ * The branches of an expression group are in parentheses (see `renderBranch`).
9
+ * A group of removals of array elements or object members becomes one
10
+ * conditional expression around their literal: while none of them is active it
11
+ * runs the literal as written, with the nested hosts in it, and otherwise a
12
+ * copy of the literal that leaves the active element out (see `renderCopy`). An
13
+ * expression group or a group of removals that starts a statement of a
14
+ * statement list gets the guard of that statement in front. An expression group
15
+ * at a quoted JSX attribute value is hosted in braces, where a conditional
16
+ * expression may stand for the value.
9
17
  *
10
18
  * @param range - Group to render.
11
19
  * @param source - Text of the file the mutants belong to.
12
20
  * @param context - Where the group sits.
13
21
  * @param context.statementStarts - Guards by the offsets where the expression
14
22
  * statements of statement lists start (see `findStatementStarts`).
15
- * @param context.getCheck - Builds the check of a site from a mutant id; the
16
- * check of the runtime global when omitted.
23
+ * @param context.attributeValues - Offsets where quoted JSX attribute values
24
+ * start (see `findAttributeValues`); none when omitted.
25
+ * @param context.syntax - How the code reaches the mutant runtime; the syntax
26
+ * of script code when omitted.
17
27
  * @returns Text that replaces the range in the switched file.
18
28
  */
19
29
  export declare function renderMutantRange(range: MutantRange, source: string, context: {
20
30
  statementStarts: ReadonlyMap<number, string>;
21
- getCheck?(id: string): string;
31
+ attributeValues?: ReadonlySet<number>;
32
+ syntax?: SiteSyntax;
22
33
  }): string;
@@ -1,18 +1,44 @@
1
- import { getSiteCheck as e } from "./get-site-check.js";
2
- function t(t, r, i) {
3
- return n(t, r, {
4
- getCheck: i.getCheck ?? e,
1
+ import { getSiteSyntax as e } from "./get-site-syntax.js";
2
+ import { renderBranch as t } from "./render-branch.js";
3
+ function n(t, n, i) {
4
+ return r(t, n, {
5
+ attributeValues: i.attributeValues ?? /* @__PURE__ */ new Set(),
6
+ syntax: i.syntax ?? e(!1),
5
7
  statementStarts: i.statementStarts,
6
8
  guarded: !0
7
9
  });
8
10
  }
9
- function n(e, t, r) {
10
- let { statementStarts: i, getCheck: a, guarded: o } = r, s = "", c = e.start;
11
- for (let r of e.children) s += t.slice(c, r.start), s += n(r, t, {
12
- guarded: e.kind === "block" || r.start !== e.start,
13
- statementStarts: i,
14
- getCheck: a
15
- }), c = r.end;
16
- return s += t.slice(c, e.end), e.kind === "block" ? `{ ${e.mutants.map((e) => `if (${a(e.id)}) {${e.replacement}}`).join(" else ")} else {${s}} }` : `${o ? i.get(e.start) ?? "" : ""}(${e.mutants.map((e) => `${a(e.id)} ? (${e.replacement}) : `).join("")}(${s}))`;
11
+ function r(e, n, a) {
12
+ let { attributeValues: o, statementStarts: s, guarded: c, syntax: l } = a, { runtime: u, quote: d } = l, f = "", p = e.start;
13
+ for (let t of e.children) f += n.slice(p, t.start), f += r(t, n, {
14
+ guarded: e.kind === "block" || t.start !== e.start,
15
+ attributeValues: o,
16
+ statementStarts: s,
17
+ syntax: l
18
+ }), p = t.end;
19
+ if (f += n.slice(p, e.end), e.kind === "block") return `{ ${e.mutants.map((e) => `if (${u}?.hit(${d(e.id)})) {${e.replacement}}`).join(" else ")} else {${f}} }`;
20
+ let m = c ? s.get(e.start) ?? "" : "";
21
+ if (e.kind !== "expression") return `${m}(${u}?.hitAny([${e.mutants.map((e) => d(e.id)).join(", ")}]) ? ${i(e, n, l)} : ${f})`;
22
+ let h = `${m}(${e.mutants.map((e) => `${u}?.hit(${d(e.id)}) ? ${t(e.replacement)} : `).join("")}${t(f)})`;
23
+ return o.has(e.start) ? `{${h}}` : h;
17
24
  }
18
- export { t as renderMutantRange };
25
+ function i(e, t, n) {
26
+ let { runtime: r, quote: i } = n, o = e.mutants.filter(a), s = /* @__PURE__ */ new Map();
27
+ for (let { focus: e, id: t } of o) {
28
+ let n = s.get(e.start);
29
+ n === void 0 ? s.set(e.start, {
30
+ ids: [t],
31
+ focus: e
32
+ }) : n.ids.push(t);
33
+ }
34
+ let c = [...s.values()].toSorted((e, t) => e.focus.start - t.focus.start), l = "", u = e.start;
35
+ for (let { focus: n, ids: a } of c) {
36
+ let o = a.map((e) => `${r}.active === ${i(e)}`).join(" || "), s = t.slice(n.start, n.end);
37
+ l += t.slice(u, n.start), e.kind === "property" ? l += `...(${o} ? {} : { ${s} })` : s.startsWith("...") ? l += `...(${o} ? ${r}.none : ${s.slice(3)})` : l += `(${o} ? ${r}.gap : ${s})`, u = n.end;
38
+ }
39
+ return l += t.slice(u, e.end), e.kind === "property" ? l : `${r}.cut(${l})`;
40
+ }
41
+ function a(e) {
42
+ return e.kind === "element" || e.kind === "property";
43
+ }
44
+ export { n as renderMutantRange };
@@ -24,7 +24,8 @@ interface ListMutantsOptions {
24
24
  preset?: string;
25
25
  /**
26
26
  * Git revision given with `--since`: only mutants on lines changed since its
27
- * merge base with `HEAD` are listed.
27
+ * merge base with `HEAD` are listed, and the mutants that skipped candidates
28
+ * on those lines are left to.
28
29
  */
29
30
  since?: string;
30
31
  /**
@@ -37,10 +38,11 @@ interface ListMutantsOptions {
37
38
  * and its plugins, resolves the presets, expands the paths with display paths
38
39
  * relative to the project root, reads every file and generates its mutants one
39
40
  * file at a time. A file that cannot be read or parsed is reported and the
40
- * others are still listed. Skipped candidates are collected only on request and
41
- * never change the mutants. With `--since`, only the mutants and skipped
42
- * candidates on lines changed since the merge base of the revision and `HEAD`
43
- * are listed, and only the changed files.
41
+ * others are still listed. Skipped candidates are listed only on request. With
42
+ * `--since`, only the mutants and skipped candidates on lines changed since the
43
+ * merge base of the revision and `HEAD` are listed, with the mutants that those
44
+ * skipped candidates are left to, and only the changed files (see
45
+ * `selectChangedMutants`).
44
46
  *
45
47
  * @param options - Paths, configuration, preset and working directory of the
46
48
  * run.
@@ -4,20 +4,20 @@ import { listFileMutants as n } from "./files/list-file-mutants.js";
4
4
  import { prepareRun as r } from "./config/prepare-run.js";
5
5
  async function i(i) {
6
6
  let { knownMutatorIds: a, mutators: o, settings: s, preset: c, root: l } = await r(i), u = i.skipped ?? !1, d = i.since === void 0 ? null : await t(l, i.since), { diagnostics: f, files: p } = await n({
7
+ skipped: u || d !== null,
7
8
  paths: i.paths,
8
9
  cwd: i.cwd,
9
10
  knownMutatorIds: a,
10
11
  settings: s,
11
12
  mutators: o,
12
- skipped: u,
13
13
  root: l
14
14
  });
15
15
  return {
16
+ files: d === null ? p : e(p, d.files, u),
16
17
  since: d === null ? null : {
17
18
  ref: i.since,
18
19
  base: d.base
19
20
  },
20
- files: d === null ? p : e(p, d.files),
21
21
  diagnostics: f,
22
22
  mutators: o,
23
23
  skipped: u,
@@ -1,12 +1,13 @@
1
1
  import { Mutator } from '../../types/mutator/mutator.js';
2
2
  /**
3
3
  * Removes one element from an array literal, or puts undefined into an empty
4
- * one (catalog 4.2). Each removal (T6) is solitary over the removed element, so
5
- * the pipeline drops it while a mutant inside the element will run. Arrays with
6
- * holes get nothing; the `[undefined]` of the empty dependency list of a React
7
- * hook, and of an array that is only pushed to and joined with an empty
8
- * separator (see `isJoinedArray`), follows as a skipped replacement when the
9
- * name `undefined` surely holds the global value (see `isGlobalName`): a
4
+ * one (catalog 4.2). A removal replaces the element with an empty text, which
5
+ * removes it with its comma. Each removal (T6) is solitary over the removed
6
+ * element, so the pipeline drops it while a mutant inside the element will run.
7
+ * Arrays with holes get nothing; the `[undefined]` of the empty dependency list
8
+ * of a React hook, and of an array that is only pushed to and joined with an
9
+ * empty separator (see `isJoinedArray`), follows as a skipped replacement when
10
+ * the name `undefined` surely holds the global value (see `isGlobalName`): a
10
11
  * parameter, a local or a declaration that another script block of a component
11
12
  * makes may give it any value.
12
13
  */
@@ -2,27 +2,27 @@ import { getCalleeName as e } from "../tree/get-callee-name.js";
2
2
  const t = /^use[0-9A-Z]/u;
3
3
  let n = {
4
4
  create(e) {
5
- let { sourceCode: t, syntax: n } = e;
6
- return { ArrayExpression(i) {
7
- let { elements: a } = i;
8
- if (a.includes(null)) return [];
9
- if (a.length === 0) {
10
- let t = {
5
+ let { syntax: t } = e;
6
+ return { ArrayExpression(n) {
7
+ let { elements: i } = n;
8
+ if (i.includes(null)) return [];
9
+ if (i.length === 0) {
10
+ let i = {
11
11
  text: "[undefined]",
12
- node: i
12
+ node: n
13
13
  };
14
- return n.isGlobalName("undefined") && (r(i, e) ? t.skip = {
14
+ return t.isGlobalName("undefined") && (r(n, e) ? i.skip = {
15
15
  reason: "an empty hook dependency list and [undefined] never change, so the hook behaves the same",
16
16
  rule: "hook-dependencies"
17
- } : n.isJoinedArray(i) && (t.skip = {
17
+ } : t.isJoinedArray(n) && (i.skip = {
18
18
  reason: "the array is only pushed to and joined with '', which writes undefined as an empty string",
19
19
  rule: "joined-array"
20
- })), [t];
20
+ })), [i];
21
21
  }
22
- return a.map((e, n) => ({
23
- text: t.removeListElement(i, n),
22
+ return i.map((e) => ({
24
23
  solitary: [e],
25
- node: i
24
+ node: e,
25
+ text: ""
26
26
  }));
27
27
  } };
28
28
  },
@@ -1,13 +1,12 @@
1
- import { distinguishesNullishSwap as e } from "./shared/distinguishes-nullish-swap.js";
2
- import { isCanonicalFalsy as t } from "./shared/is-canonical-falsy.js";
1
+ import { getCanonicalFalsyDefault as e } from "./shared/get-canonical-falsy-default.js";
2
+ import { distinguishesNullishSwap as t } from "./shared/distinguishes-nullish-swap.js";
3
3
  import { isAlwaysNullish as n } from "./shared/is-always-nullish.js";
4
4
  import { getLiteralValue as r } from "./shared/get-literal-value.js";
5
5
  import { isAlwaysTruthy as i } from "./shared/is-always-truthy.js";
6
6
  import { isNumericPair as a } from "./shared/is-numeric-pair.js";
7
7
  import { isNumberType as o } from "./shared/is-number-type.js";
8
8
  import { mayBeNullish as s } from "./shared/may-be-nullish.js";
9
- import { getTypeView as c } from "./shared/get-type-view.js";
10
- let l = /* @__PURE__ */ new Map([
9
+ let c = /* @__PURE__ */ new Map([
11
10
  [">>>=", ">>="],
12
11
  ["<<=", ">>="],
13
12
  [">>=", "<<="],
@@ -20,7 +19,7 @@ let l = /* @__PURE__ */ new Map([
20
19
  ["&=", "|="],
21
20
  ["|=", "&="],
22
21
  ["^=", "|="]
23
- ]), u = /* @__PURE__ */ new Map([
22
+ ]), l = /* @__PURE__ */ new Map([
24
23
  ["*=", /* @__PURE__ */ new Set([
25
24
  -1n,
26
25
  -1,
@@ -39,7 +38,7 @@ let l = /* @__PURE__ */ new Map([
39
38
  ["+=", /* @__PURE__ */ new Set([0n, 0])],
40
39
  ["-=", /* @__PURE__ */ new Set([0n, 0])],
41
40
  ["^=", /* @__PURE__ */ new Set([0n, 0])]
42
- ]), d = {
41
+ ]), u = {
43
42
  create(e) {
44
43
  let { settings: t, syntax: n } = e;
45
44
  return { AssignmentExpression(r) {
@@ -60,25 +59,25 @@ let l = /* @__PURE__ */ new Map([
60
59
  defaultOptions: { nullishSwap: "distinguishing" }
61
60
  }
62
61
  };
63
- function f(t, r) {
64
- let { right: i, left: a } = t, o = r.hints.getType(a), c = s(o), l = e({
62
+ function d(e, r) {
63
+ let { right: i, left: a } = e, o = r.hints.getType(a), c = s(o), l = t({
65
64
  right: i,
66
65
  left: a
67
66
  }, r.hints, r.options.nullishSwap), u = n(o) ? {
68
67
  reason: "the type hints make the target always nullish, so the guard changes nothing",
69
68
  rule: "typed-constant"
70
- } : null, d = h(o, i), f = {
69
+ } : null, d = p(e, o, r), f = {
71
70
  reason: "??= and ||= differ here only on falsy values that the nullishSwap option does not count, such as the value itself",
72
71
  rule: "nullish-swap"
73
- }, p = {
72
+ }, m = {
74
73
  reason: "every test that kills the swap between ??= and ||= also kills this change",
75
74
  by: {
76
75
  mutator: "assignment-operator",
77
- node: t
76
+ node: e
78
77
  },
79
78
  rule: "swap-subsumes-drop"
80
79
  };
81
- switch (t.operator) {
80
+ switch (e.operator) {
82
81
  case "&&=": return [{
83
82
  operator: "=",
84
83
  skip: d
@@ -95,7 +94,7 @@ function f(t, r) {
95
94
  operator: "??=",
96
95
  skip: null
97
96
  }, {
98
- skip: p,
97
+ skip: m,
99
98
  operator: null
100
99
  }) : (c && e.push({
101
100
  skip: f,
@@ -114,7 +113,7 @@ function f(t, r) {
114
113
  operator: "||="
115
114
  },
116
115
  {
117
- skip: l ? p : u,
116
+ skip: l ? m : u,
118
117
  operator: "="
119
118
  },
120
119
  {
@@ -127,14 +126,14 @@ function f(t, r) {
127
126
  ];
128
127
  }
129
128
  }
130
- function p(e, t, n) {
131
- let { operator: i, right: s, left: c } = e, l = n.hints.getType(c);
132
- if (i === "+=" && !a(l, n.hints.getType(s))) return {
129
+ function f(e, t, n) {
130
+ let { operator: i, right: s, left: c } = e, u = n.hints.getType(c);
131
+ if (i === "+=" && !a(u, n.hints.getType(s))) return {
133
132
  reason: "the += is not known to be numeric, and -= on a string only gives NaN",
134
133
  rule: "non-numeric-plus"
135
134
  };
136
135
  let d = r(s);
137
- if (d !== null && u.get(i)?.has(d) && (i !== "-=" || o(l))) {
136
+ if (d !== null && l.get(i)?.has(d) && (i !== "-=" || o(u))) {
138
137
  let e = i === "+=" || i === "-=";
139
138
  return {
140
139
  reason: `with the value ${String(d)}, ${i} and ${t} give the same result`,
@@ -143,10 +142,21 @@ function p(e, t, n) {
143
142
  }
144
143
  return null;
145
144
  }
145
+ function p(t, n, r) {
146
+ if (i(n)) return {
147
+ reason: "the type hints make the target always truthy, so its truth never changes the result",
148
+ rule: "typed-constant"
149
+ };
150
+ let a = e(t.left, t.right, r);
151
+ return a && {
152
+ reason: a.because === null ? "the assigned value is the only falsy value of the target's type, so the target's truth never changes the result" : `the assigned value is the only falsy value of the target, which is never NaN (${a.because}), so the target's truth never changes the result`,
153
+ rule: "canonical-falsy-default"
154
+ };
155
+ }
146
156
  function m(e, t) {
147
- let { sourceCode: n } = t, r = l.get(e.operator);
157
+ let { sourceCode: n } = t, r = c.get(e.operator);
148
158
  if (r !== void 0) {
149
- let i = n.replaceOperator(e, r), a = p(e, r, t);
159
+ let i = n.replaceOperator(e, r), a = f(e, r, t);
150
160
  return [a ? {
151
161
  text: i,
152
162
  skip: a,
@@ -156,8 +166,8 @@ function m(e, t) {
156
166
  node: e
157
167
  }];
158
168
  }
159
- return f(e, t).map(({ operator: t, skip: r }) => {
160
- let i = t === null ? g(e, n) : n.replaceOperator(e, t);
169
+ return d(e, t).map(({ operator: t, skip: r }) => {
170
+ let i = t === null ? h(e, n) : n.replaceOperator(e, t);
161
171
  return r ? {
162
172
  text: i,
163
173
  skip: r,
@@ -168,16 +178,7 @@ function m(e, t) {
168
178
  };
169
179
  });
170
180
  }
171
- function h(e, n) {
172
- return i(e) ? {
173
- reason: "the type hints make the target always truthy, so its truth never changes the result",
174
- rule: "typed-constant"
175
- } : !s(e) && t(c(e).type, n) ? {
176
- reason: "the assigned value is the only falsy value of the target's type, so the target's truth never changes the result",
177
- rule: "canonical-falsy-default"
178
- } : null;
179
- }
180
- function g(e, t) {
181
+ function h(e, t) {
181
182
  let { comments: n, text: r } = t, i = t.getOperatorRange(e).start, a = "";
182
183
  for (let t = e.left.end; t < i; t++) {
183
184
  let e = n.find(({ start: e }) => e === t);
@@ -185,4 +186,4 @@ function g(e, t) {
185
186
  }
186
187
  return r.slice(e.start, e.left.end) + a;
187
188
  }
188
- export { d as assignmentOperator };
189
+ export { u as assignmentOperator };
@@ -8,7 +8,8 @@ import { Mutator } from '../../types/mutator/mutator.js';
8
8
  * boolean-valued branch, when the test's owner emits that constant (O19) or a
9
9
  * mutant that will run moves the test toward it (R5); the right operand of a
10
10
  * value-mode `L || true` with a nullable boolean `L` while the `??` swap will
11
- * run (R7); and a flip toward the running value of a loop unless the `timeouts`
12
- * setting is on (TIMEOUT). A skipped flip follows as a skipped replacement.
11
+ * run (R7); and a flip that may keep a loop running forever (see
12
+ * `getEndlessValue`) unless the `timeouts` setting is on (TIMEOUT). A skipped
13
+ * flip follows as a skipped replacement.
13
14
  */
14
15
  export declare let booleanLiteral: Mutator;
@@ -13,7 +13,7 @@ interface NumberLiteralOptions {
13
13
  * `-` applied directly to one, gets its value plus one (T7). Comparison
14
14
  * operands, boolean-mode operands, `void` operands, keys and (unless the
15
15
  * `caseTests` option is set) case labels are skipped, and so are changes that
16
- * keep the truth value in a boolean context, that only a timeout can kill, that
16
+ * keep the truth value in a boolean context, that may cause a timeout, that
17
17
  * keep the sign of a sort comparator's result, or that another mutant owns or
18
18
  * subsumes (branch pairs, no-op callbacks, emptied `||` defaults, `slice(-1)`).
19
19
  * A skipped change follows as a skipped replacement. Timer delays are skipped
@@ -1,8 +1,9 @@
1
1
  import { Mutator } from '../../types/mutator/mutator.js';
2
2
  /**
3
- * Removes one property or spread from an object literal (catalog 4.12). Each
4
- * removal (T6) is solitary over the removed member, so the pipeline drops it
5
- * while a mutant inside the member will run. Removing an option of an `Intl`
3
+ * Removes one property or spread from an object literal (catalog 4.12): the
4
+ * replacement of a member with an empty text, which removes it with its comma.
5
+ * Each removal (T6) is solitary over the removed member, so the pipeline drops
6
+ * it while a mutant inside the member will run. Removing an option of an `Intl`
6
7
  * constructor that holds the default value is skipped as equivalent
7
8
  * (`getDefaultOptionSkip`).
8
9
  */
@@ -1,15 +1,14 @@
1
1
  import { getDefaultOptionSkip as e } from "./shared/get-default-option-skip.js";
2
2
  let t = {
3
3
  create(t) {
4
- let { sourceCode: n } = t;
5
- return { ObjectExpression(r) {
6
- return r.properties.map((i, a) => {
7
- let o = e(i, r, t);
4
+ return { ObjectExpression(n) {
5
+ return n.properties.map((r) => {
6
+ let i = e(r, n, t);
8
7
  return {
9
- text: n.removeListElement(r, a),
10
- ...o && { skip: o },
11
- solitary: [i],
12
- node: r
8
+ ...i && { skip: i },
9
+ solitary: [r],
10
+ node: r,
11
+ text: ""
13
12
  };
14
13
  });
15
14
  } };