@d-es-ign/stryker-js-core 9.6.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 (631) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +96 -0
  3. package/bin/stryker +2 -0
  4. package/bin/stryker.js +6 -0
  5. package/dist/src/checker/checker-child-process-proxy.d.ts +16 -0
  6. package/dist/src/checker/checker-child-process-proxy.d.ts.map +1 -0
  7. package/dist/src/checker/checker-child-process-proxy.js +22 -0
  8. package/dist/src/checker/checker-child-process-proxy.js.map +1 -0
  9. package/dist/src/checker/checker-facade.d.ts +9 -0
  10. package/dist/src/checker/checker-facade.d.ts.map +1 -0
  11. package/dist/src/checker/checker-facade.js +52 -0
  12. package/dist/src/checker/checker-facade.js.map +1 -0
  13. package/dist/src/checker/checker-factory.d.ts +10 -0
  14. package/dist/src/checker/checker-factory.d.ts.map +1 -0
  15. package/dist/src/checker/checker-factory.js +10 -0
  16. package/dist/src/checker/checker-factory.js.map +1 -0
  17. package/dist/src/checker/checker-resource.d.ts +8 -0
  18. package/dist/src/checker/checker-resource.d.ts.map +1 -0
  19. package/dist/src/checker/checker-resource.js +2 -0
  20. package/dist/src/checker/checker-resource.js.map +1 -0
  21. package/dist/src/checker/checker-retry-decorator.d.ts +12 -0
  22. package/dist/src/checker/checker-retry-decorator.d.ts.map +1 -0
  23. package/dist/src/checker/checker-retry-decorator.js +37 -0
  24. package/dist/src/checker/checker-retry-decorator.js.map +1 -0
  25. package/dist/src/checker/checker-worker.d.ts +14 -0
  26. package/dist/src/checker/checker-worker.d.ts.map +1 -0
  27. package/dist/src/checker/checker-worker.js +41 -0
  28. package/dist/src/checker/checker-worker.js.map +1 -0
  29. package/dist/src/checker/index.d.ts +4 -0
  30. package/dist/src/checker/index.d.ts.map +1 -0
  31. package/dist/src/checker/index.js +4 -0
  32. package/dist/src/checker/index.js.map +1 -0
  33. package/dist/src/child-proxy/child-process-crashed-error.d.ts +8 -0
  34. package/dist/src/child-proxy/child-process-crashed-error.d.ts.map +1 -0
  35. package/dist/src/child-proxy/child-process-crashed-error.js +16 -0
  36. package/dist/src/child-proxy/child-process-crashed-error.js.map +1 -0
  37. package/dist/src/child-proxy/child-process-proxy-worker.d.ts +32 -0
  38. package/dist/src/child-proxy/child-process-proxy-worker.d.ts.map +1 -0
  39. package/dist/src/child-proxy/child-process-proxy-worker.js +148 -0
  40. package/dist/src/child-proxy/child-process-proxy-worker.js.map +1 -0
  41. package/dist/src/child-proxy/child-process-proxy.d.ts +45 -0
  42. package/dist/src/child-proxy/child-process-proxy.d.ts.map +1 -0
  43. package/dist/src/child-proxy/child-process-proxy.js +232 -0
  44. package/dist/src/child-proxy/child-process-proxy.js.map +1 -0
  45. package/dist/src/child-proxy/id-generator.d.ts +5 -0
  46. package/dist/src/child-proxy/id-generator.d.ts.map +1 -0
  47. package/dist/src/child-proxy/id-generator.js +7 -0
  48. package/dist/src/child-proxy/id-generator.js.map +1 -0
  49. package/dist/src/child-proxy/message-protocol.d.ts +71 -0
  50. package/dist/src/child-proxy/message-protocol.d.ts.map +1 -0
  51. package/dist/src/child-proxy/message-protocol.js +34 -0
  52. package/dist/src/child-proxy/message-protocol.js.map +1 -0
  53. package/dist/src/child-proxy/out-of-memory-error.d.ts +5 -0
  54. package/dist/src/child-proxy/out-of-memory-error.d.ts.map +1 -0
  55. package/dist/src/child-proxy/out-of-memory-error.js +11 -0
  56. package/dist/src/child-proxy/out-of-memory-error.js.map +1 -0
  57. package/dist/src/concurrent/concurrency-token-provider.d.ts +20 -0
  58. package/dist/src/concurrent/concurrency-token-provider.d.ts.map +1 -0
  59. package/dist/src/concurrent/concurrency-token-provider.js +68 -0
  60. package/dist/src/concurrent/concurrency-token-provider.js.map +1 -0
  61. package/dist/src/concurrent/index.d.ts +4 -0
  62. package/dist/src/concurrent/index.d.ts.map +1 -0
  63. package/dist/src/concurrent/index.js +4 -0
  64. package/dist/src/concurrent/index.js.map +1 -0
  65. package/dist/src/concurrent/pool.d.ts +49 -0
  66. package/dist/src/concurrent/pool.d.ts.map +1 -0
  67. package/dist/src/concurrent/pool.js +137 -0
  68. package/dist/src/concurrent/pool.js.map +1 -0
  69. package/dist/src/concurrent/resource-decorator.d.ts +14 -0
  70. package/dist/src/concurrent/resource-decorator.d.ts.map +1 -0
  71. package/dist/src/concurrent/resource-decorator.js +24 -0
  72. package/dist/src/concurrent/resource-decorator.js.map +1 -0
  73. package/dist/src/config/config-file-formats.d.ts +6 -0
  74. package/dist/src/config/config-file-formats.d.ts.map +1 -0
  75. package/dist/src/config/config-file-formats.js +23 -0
  76. package/dist/src/config/config-file-formats.js.map +1 -0
  77. package/dist/src/config/config-reader.d.ts +23 -0
  78. package/dist/src/config/config-reader.d.ts.map +1 -0
  79. package/dist/src/config/config-reader.js +141 -0
  80. package/dist/src/config/config-reader.js.map +1 -0
  81. package/dist/src/config/file-matcher.d.ts +10 -0
  82. package/dist/src/config/file-matcher.d.ts.map +1 -0
  83. package/dist/src/config/file-matcher.js +31 -0
  84. package/dist/src/config/file-matcher.js.map +1 -0
  85. package/dist/src/config/index.d.ts +6 -0
  86. package/dist/src/config/index.d.ts.map +1 -0
  87. package/dist/src/config/index.js +6 -0
  88. package/dist/src/config/index.js.map +1 -0
  89. package/dist/src/config/meta-schema-builder.d.ts +10 -0
  90. package/dist/src/config/meta-schema-builder.d.ts.map +1 -0
  91. package/dist/src/config/meta-schema-builder.js +30 -0
  92. package/dist/src/config/meta-schema-builder.js.map +1 -0
  93. package/dist/src/config/options-validator.d.ts +28 -0
  94. package/dist/src/config/options-validator.d.ts.map +1 -0
  95. package/dist/src/config/options-validator.js +213 -0
  96. package/dist/src/config/options-validator.js.map +1 -0
  97. package/dist/src/config/validation-errors.d.ts +7 -0
  98. package/dist/src/config/validation-errors.d.ts.map +1 -0
  99. package/dist/src/config/validation-errors.js +154 -0
  100. package/dist/src/config/validation-errors.js.map +1 -0
  101. package/dist/src/di/core-tokens.d.ts +40 -0
  102. package/dist/src/di/core-tokens.d.ts.map +1 -0
  103. package/dist/src/di/core-tokens.js +40 -0
  104. package/dist/src/di/core-tokens.js.map +1 -0
  105. package/dist/src/di/index.d.ts +4 -0
  106. package/dist/src/di/index.d.ts.map +1 -0
  107. package/dist/src/di/index.js +4 -0
  108. package/dist/src/di/index.js.map +1 -0
  109. package/dist/src/di/plugin-creator.d.ts +10 -0
  110. package/dist/src/di/plugin-creator.d.ts.map +1 -0
  111. package/dist/src/di/plugin-creator.js +51 -0
  112. package/dist/src/di/plugin-creator.js.map +1 -0
  113. package/dist/src/di/plugin-loader.d.ts +41 -0
  114. package/dist/src/di/plugin-loader.d.ts.map +1 -0
  115. package/dist/src/di/plugin-loader.js +153 -0
  116. package/dist/src/di/plugin-loader.js.map +1 -0
  117. package/dist/src/errors.d.ts +5 -0
  118. package/dist/src/errors.d.ts.map +1 -0
  119. package/dist/src/errors.js +13 -0
  120. package/dist/src/errors.js.map +1 -0
  121. package/dist/src/fs/file-system.d.ts +19 -0
  122. package/dist/src/fs/file-system.d.ts.map +1 -0
  123. package/dist/src/fs/file-system.js +52 -0
  124. package/dist/src/fs/file-system.js.map +1 -0
  125. package/dist/src/fs/index.d.ts +5 -0
  126. package/dist/src/fs/index.d.ts.map +1 -0
  127. package/dist/src/fs/index.js +5 -0
  128. package/dist/src/fs/index.js.map +1 -0
  129. package/dist/src/fs/project-file.d.ts +26 -0
  130. package/dist/src/fs/project-file.d.ts.map +1 -0
  131. package/dist/src/fs/project-file.js +87 -0
  132. package/dist/src/fs/project-file.js.map +1 -0
  133. package/dist/src/fs/project-reader.d.ts +51 -0
  134. package/dist/src/fs/project-reader.d.ts.map +1 -0
  135. package/dist/src/fs/project-reader.js +335 -0
  136. package/dist/src/fs/project-reader.js.map +1 -0
  137. package/dist/src/fs/project.d.ts +22 -0
  138. package/dist/src/fs/project.d.ts.map +1 -0
  139. package/dist/src/fs/project.js +65 -0
  140. package/dist/src/fs/project.js.map +1 -0
  141. package/dist/src/index.d.ts +5 -0
  142. package/dist/src/index.d.ts.map +1 -0
  143. package/dist/src/index.js +6 -0
  144. package/dist/src/index.js.map +1 -0
  145. package/dist/src/initializer/custom-initializers/angular-initializer.d.ts +17 -0
  146. package/dist/src/initializer/custom-initializers/angular-initializer.d.ts.map +1 -0
  147. package/dist/src/initializer/custom-initializers/angular-initializer.js +74 -0
  148. package/dist/src/initializer/custom-initializers/angular-initializer.js.map +1 -0
  149. package/dist/src/initializer/custom-initializers/custom-initializer.d.ts +13 -0
  150. package/dist/src/initializer/custom-initializers/custom-initializer.d.ts.map +1 -0
  151. package/dist/src/initializer/custom-initializers/custom-initializer.js +2 -0
  152. package/dist/src/initializer/custom-initializers/custom-initializer.js.map +1 -0
  153. package/dist/src/initializer/custom-initializers/index.d.ts +14 -0
  154. package/dist/src/initializer/custom-initializers/index.d.ts.map +1 -0
  155. package/dist/src/initializer/custom-initializers/index.js +16 -0
  156. package/dist/src/initializer/custom-initializers/index.js.map +1 -0
  157. package/dist/src/initializer/custom-initializers/react-initializer.d.ts +12 -0
  158. package/dist/src/initializer/custom-initializers/react-initializer.d.ts.map +1 -0
  159. package/dist/src/initializer/custom-initializers/react-initializer.js +25 -0
  160. package/dist/src/initializer/custom-initializers/react-initializer.js.map +1 -0
  161. package/dist/src/initializer/custom-initializers/svelte-initializer.d.ts +6 -0
  162. package/dist/src/initializer/custom-initializers/svelte-initializer.d.ts.map +1 -0
  163. package/dist/src/initializer/custom-initializers/svelte-initializer.js +33 -0
  164. package/dist/src/initializer/custom-initializers/svelte-initializer.js.map +1 -0
  165. package/dist/src/initializer/custom-initializers/vue-js-initializer.d.ts +11 -0
  166. package/dist/src/initializer/custom-initializers/vue-js-initializer.d.ts.map +1 -0
  167. package/dist/src/initializer/custom-initializers/vue-js-initializer.js +20 -0
  168. package/dist/src/initializer/custom-initializers/vue-js-initializer.js.map +1 -0
  169. package/dist/src/initializer/gitignore-writer.d.ts +7 -0
  170. package/dist/src/initializer/gitignore-writer.d.ts.map +1 -0
  171. package/dist/src/initializer/gitignore-writer.js +28 -0
  172. package/dist/src/initializer/gitignore-writer.js.map +1 -0
  173. package/dist/src/initializer/index.d.ts +6 -0
  174. package/dist/src/initializer/index.d.ts.map +1 -0
  175. package/dist/src/initializer/index.js +29 -0
  176. package/dist/src/initializer/index.js.map +1 -0
  177. package/dist/src/initializer/initializer-tokens.d.ts +9 -0
  178. package/dist/src/initializer/initializer-tokens.d.ts.map +1 -0
  179. package/dist/src/initializer/initializer-tokens.js +9 -0
  180. package/dist/src/initializer/initializer-tokens.js.map +1 -0
  181. package/dist/src/initializer/inquire.d.ts +12 -0
  182. package/dist/src/initializer/inquire.d.ts.map +1 -0
  183. package/dist/src/initializer/inquire.js +12 -0
  184. package/dist/src/initializer/inquire.js.map +1 -0
  185. package/dist/src/initializer/npm-client.d.ts +22 -0
  186. package/dist/src/initializer/npm-client.d.ts.map +1 -0
  187. package/dist/src/initializer/npm-client.js +65 -0
  188. package/dist/src/initializer/npm-client.js.map +1 -0
  189. package/dist/src/initializer/npm-registry.d.ts +13 -0
  190. package/dist/src/initializer/npm-registry.d.ts.map +1 -0
  191. package/dist/src/initializer/npm-registry.js +36 -0
  192. package/dist/src/initializer/npm-registry.js.map +1 -0
  193. package/dist/src/initializer/package-info.d.ts +10 -0
  194. package/dist/src/initializer/package-info.d.ts.map +1 -0
  195. package/dist/src/initializer/package-info.js +2 -0
  196. package/dist/src/initializer/package-info.js.map +1 -0
  197. package/dist/src/initializer/prompt-option.d.ts +6 -0
  198. package/dist/src/initializer/prompt-option.d.ts.map +1 -0
  199. package/dist/src/initializer/prompt-option.js +2 -0
  200. package/dist/src/initializer/prompt-option.js.map +1 -0
  201. package/dist/src/initializer/stryker-config-writer.d.ts +27 -0
  202. package/dist/src/initializer/stryker-config-writer.d.ts.map +1 -0
  203. package/dist/src/initializer/stryker-config-writer.js +106 -0
  204. package/dist/src/initializer/stryker-config-writer.js.map +1 -0
  205. package/dist/src/initializer/stryker-initializer.d.ts +45 -0
  206. package/dist/src/initializer/stryker-initializer.d.ts.map +1 -0
  207. package/dist/src/initializer/stryker-initializer.js +184 -0
  208. package/dist/src/initializer/stryker-initializer.js.map +1 -0
  209. package/dist/src/initializer/stryker-inquirer.d.ts +15 -0
  210. package/dist/src/initializer/stryker-inquirer.d.ts.map +1 -0
  211. package/dist/src/initializer/stryker-inquirer.js +72 -0
  212. package/dist/src/initializer/stryker-inquirer.js.map +1 -0
  213. package/dist/src/logging/index.d.ts +6 -0
  214. package/dist/src/logging/index.d.ts.map +1 -0
  215. package/dist/src/logging/index.js +5 -0
  216. package/dist/src/logging/index.js.map +1 -0
  217. package/dist/src/logging/logger-impl.d.ts +19 -0
  218. package/dist/src/logging/logger-impl.d.ts.map +1 -0
  219. package/dist/src/logging/logger-impl.js +64 -0
  220. package/dist/src/logging/logger-impl.js.map +1 -0
  221. package/dist/src/logging/logging-backend.d.ts +22 -0
  222. package/dist/src/logging/logging-backend.d.ts.map +1 -0
  223. package/dist/src/logging/logging-backend.js +65 -0
  224. package/dist/src/logging/logging-backend.js.map +1 -0
  225. package/dist/src/logging/logging-client.d.ts +16 -0
  226. package/dist/src/logging/logging-client.d.ts.map +1 -0
  227. package/dist/src/logging/logging-client.js +44 -0
  228. package/dist/src/logging/logging-client.js.map +1 -0
  229. package/dist/src/logging/logging-event.d.ts +23 -0
  230. package/dist/src/logging/logging-event.d.ts.map +1 -0
  231. package/dist/src/logging/logging-event.js +63 -0
  232. package/dist/src/logging/logging-event.js.map +1 -0
  233. package/dist/src/logging/logging-server.d.ts +15 -0
  234. package/dist/src/logging/logging-server.d.ts.map +1 -0
  235. package/dist/src/logging/logging-server.js +43 -0
  236. package/dist/src/logging/logging-server.js.map +1 -0
  237. package/dist/src/logging/logging-sink.d.ts +7 -0
  238. package/dist/src/logging/logging-sink.d.ts.map +1 -0
  239. package/dist/src/logging/logging-sink.js +2 -0
  240. package/dist/src/logging/logging-sink.js.map +1 -0
  241. package/dist/src/logging/priority.d.ts +12 -0
  242. package/dist/src/logging/priority.d.ts.map +1 -0
  243. package/dist/src/logging/priority.js +13 -0
  244. package/dist/src/logging/priority.js.map +1 -0
  245. package/dist/src/logging/provide-logging.d.ts +30 -0
  246. package/dist/src/logging/provide-logging.d.ts.map +1 -0
  247. package/dist/src/logging/provide-logging.js +45 -0
  248. package/dist/src/logging/provide-logging.js.map +1 -0
  249. package/dist/src/mutants/diff-statistics-collector.d.ts +14 -0
  250. package/dist/src/mutants/diff-statistics-collector.d.ts.map +1 -0
  251. package/dist/src/mutants/diff-statistics-collector.js +40 -0
  252. package/dist/src/mutants/diff-statistics-collector.js.map +1 -0
  253. package/dist/src/mutants/incremental-differ.d.ts +39 -0
  254. package/dist/src/mutants/incremental-differ.d.ts.map +1 -0
  255. package/dist/src/mutants/incremental-differ.js +547 -0
  256. package/dist/src/mutants/incremental-differ.js.map +1 -0
  257. package/dist/src/mutants/index.d.ts +4 -0
  258. package/dist/src/mutants/index.d.ts.map +1 -0
  259. package/dist/src/mutants/index.js +4 -0
  260. package/dist/src/mutants/index.js.map +1 -0
  261. package/dist/src/mutants/mutant-test-planner.d.ts +36 -0
  262. package/dist/src/mutants/mutant-test-planner.d.ts.map +1 -0
  263. package/dist/src/mutants/mutant-test-planner.js +237 -0
  264. package/dist/src/mutants/mutant-test-planner.js.map +1 -0
  265. package/dist/src/mutants/test-coverage.d.ts +22 -0
  266. package/dist/src/mutants/test-coverage.d.ts.map +1 -0
  267. package/dist/src/mutants/test-coverage.js +87 -0
  268. package/dist/src/mutants/test-coverage.js.map +1 -0
  269. package/dist/src/process/1-prepare-executor.d.ts +22 -0
  270. package/dist/src/process/1-prepare-executor.d.ts.map +1 -0
  271. package/dist/src/process/1-prepare-executor.js +86 -0
  272. package/dist/src/process/1-prepare-executor.js.map +1 -0
  273. package/dist/src/process/2-mutant-instrumenter-executor.d.ts +39 -0
  274. package/dist/src/process/2-mutant-instrumenter-executor.d.ts.map +1 -0
  275. package/dist/src/process/2-mutant-instrumenter-executor.js +58 -0
  276. package/dist/src/process/2-mutant-instrumenter-executor.js.map +1 -0
  277. package/dist/src/process/3-dry-run-executor.d.ts +50 -0
  278. package/dist/src/process/3-dry-run-executor.d.ts.map +1 -0
  279. package/dist/src/process/3-dry-run-executor.js +164 -0
  280. package/dist/src/process/3-dry-run-executor.js.map +1 -0
  281. package/dist/src/process/4-mutation-test-executor.d.ts +56 -0
  282. package/dist/src/process/4-mutation-test-executor.d.ts.map +1 -0
  283. package/dist/src/process/4-mutation-test-executor.js +152 -0
  284. package/dist/src/process/4-mutation-test-executor.js.map +1 -0
  285. package/dist/src/process/index.d.ts +5 -0
  286. package/dist/src/process/index.d.ts.map +1 -0
  287. package/dist/src/process/index.js +5 -0
  288. package/dist/src/process/index.js.map +1 -0
  289. package/dist/src/reporters/broadcast-reporter.d.ts +25 -0
  290. package/dist/src/reporters/broadcast-reporter.d.ts.map +1 -0
  291. package/dist/src/reporters/broadcast-reporter.js +74 -0
  292. package/dist/src/reporters/broadcast-reporter.js.map +1 -0
  293. package/dist/src/reporters/ci/circle-provider.d.ts +11 -0
  294. package/dist/src/reporters/ci/circle-provider.d.ts.map +1 -0
  295. package/dist/src/reporters/ci/circle-provider.js +33 -0
  296. package/dist/src/reporters/ci/circle-provider.js.map +1 -0
  297. package/dist/src/reporters/ci/github-actions-provider.d.ts +9 -0
  298. package/dist/src/reporters/ci/github-actions-provider.d.ts.map +1 -0
  299. package/dist/src/reporters/ci/github-actions-provider.js +21 -0
  300. package/dist/src/reporters/ci/github-actions-provider.js.map +1 -0
  301. package/dist/src/reporters/ci/provider.d.ts +22 -0
  302. package/dist/src/reporters/ci/provider.d.ts.map +1 -0
  303. package/dist/src/reporters/ci/provider.js +24 -0
  304. package/dist/src/reporters/ci/provider.js.map +1 -0
  305. package/dist/src/reporters/ci/travis-provider.d.ts +9 -0
  306. package/dist/src/reporters/ci/travis-provider.d.ts.map +1 -0
  307. package/dist/src/reporters/ci/travis-provider.js +19 -0
  308. package/dist/src/reporters/ci/travis-provider.js.map +1 -0
  309. package/dist/src/reporters/clear-text-reporter.d.ts +23 -0
  310. package/dist/src/reporters/clear-text-reporter.d.ts.map +1 -0
  311. package/dist/src/reporters/clear-text-reporter.js +174 -0
  312. package/dist/src/reporters/clear-text-reporter.js.map +1 -0
  313. package/dist/src/reporters/clear-text-score-table.d.ts +22 -0
  314. package/dist/src/reporters/clear-text-score-table.d.ts.map +1 -0
  315. package/dist/src/reporters/clear-text-score-table.js +191 -0
  316. package/dist/src/reporters/clear-text-score-table.js.map +1 -0
  317. package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.d.ts +19 -0
  318. package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.d.ts.map +1 -0
  319. package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.js +54 -0
  320. package/dist/src/reporters/dashboard-reporter/dashboard-reporter-client.js.map +1 -0
  321. package/dist/src/reporters/dashboard-reporter/dashboard-reporter.d.ts +21 -0
  322. package/dist/src/reporters/dashboard-reporter/dashboard-reporter.d.ts.map +1 -0
  323. package/dist/src/reporters/dashboard-reporter/dashboard-reporter.js +62 -0
  324. package/dist/src/reporters/dashboard-reporter/dashboard-reporter.js.map +1 -0
  325. package/dist/src/reporters/dashboard-reporter/index.d.ts +7 -0
  326. package/dist/src/reporters/dashboard-reporter/index.d.ts.map +1 -0
  327. package/dist/src/reporters/dashboard-reporter/index.js +15 -0
  328. package/dist/src/reporters/dashboard-reporter/index.js.map +1 -0
  329. package/dist/src/reporters/dashboard-reporter/report.d.ts +6 -0
  330. package/dist/src/reporters/dashboard-reporter/report.d.ts.map +1 -0
  331. package/dist/src/reporters/dashboard-reporter/report.js +2 -0
  332. package/dist/src/reporters/dashboard-reporter/report.js.map +1 -0
  333. package/dist/src/reporters/dashboard-reporter/tokens.d.ts +6 -0
  334. package/dist/src/reporters/dashboard-reporter/tokens.d.ts.map +1 -0
  335. package/dist/src/reporters/dashboard-reporter/tokens.js +6 -0
  336. package/dist/src/reporters/dashboard-reporter/tokens.js.map +1 -0
  337. package/dist/src/reporters/dots-reporter.d.ts +7 -0
  338. package/dist/src/reporters/dots-reporter.d.ts.map +1 -0
  339. package/dist/src/reporters/dots-reporter.js +29 -0
  340. package/dist/src/reporters/dots-reporter.js.map +1 -0
  341. package/dist/src/reporters/event-recorder-reporter.d.ts +22 -0
  342. package/dist/src/reporters/event-recorder-reporter.d.ts.map +1 -0
  343. package/dist/src/reporters/event-recorder-reporter.js +53 -0
  344. package/dist/src/reporters/event-recorder-reporter.js.map +1 -0
  345. package/dist/src/reporters/html-reporter.d.ts +14 -0
  346. package/dist/src/reporters/html-reporter.d.ts.map +1 -0
  347. package/dist/src/reporters/html-reporter.js +65 -0
  348. package/dist/src/reporters/html-reporter.js.map +1 -0
  349. package/dist/src/reporters/index.d.ts +6 -0
  350. package/dist/src/reporters/index.d.ts.map +1 -0
  351. package/dist/src/reporters/index.js +24 -0
  352. package/dist/src/reporters/index.js.map +1 -0
  353. package/dist/src/reporters/json-reporter.d.ts +15 -0
  354. package/dist/src/reporters/json-reporter.d.ts.map +1 -0
  355. package/dist/src/reporters/json-reporter.js +29 -0
  356. package/dist/src/reporters/json-reporter.js.map +1 -0
  357. package/dist/src/reporters/mutation-test-report-helper.d.ts +40 -0
  358. package/dist/src/reporters/mutation-test-report-helper.d.ts.map +1 -0
  359. package/dist/src/reporters/mutation-test-report-helper.js +298 -0
  360. package/dist/src/reporters/mutation-test-report-helper.js.map +1 -0
  361. package/dist/src/reporters/mutation-timings-reporter.d.ts +14 -0
  362. package/dist/src/reporters/mutation-timings-reporter.d.ts.map +1 -0
  363. package/dist/src/reporters/mutation-timings-reporter.js +49 -0
  364. package/dist/src/reporters/mutation-timings-reporter.js.map +1 -0
  365. package/dist/src/reporters/progress-append-only-reporter.d.ts +10 -0
  366. package/dist/src/reporters/progress-append-only-reporter.d.ts.map +1 -0
  367. package/dist/src/reporters/progress-append-only-reporter.js +25 -0
  368. package/dist/src/reporters/progress-append-only-reporter.js.map +1 -0
  369. package/dist/src/reporters/progress-bar.d.ts +8 -0
  370. package/dist/src/reporters/progress-bar.d.ts.map +1 -0
  371. package/dist/src/reporters/progress-bar.js +6 -0
  372. package/dist/src/reporters/progress-bar.js.map +1 -0
  373. package/dist/src/reporters/progress-keeper.d.ts +27 -0
  374. package/dist/src/reporters/progress-keeper.d.ts.map +1 -0
  375. package/dist/src/reporters/progress-keeper.js +77 -0
  376. package/dist/src/reporters/progress-keeper.js.map +1 -0
  377. package/dist/src/reporters/progress-reporter.d.ts +11 -0
  378. package/dist/src/reporters/progress-reporter.d.ts.map +1 -0
  379. package/dist/src/reporters/progress-reporter.js +40 -0
  380. package/dist/src/reporters/progress-reporter.js.map +1 -0
  381. package/dist/src/reporters/reporter-util.d.ts +5 -0
  382. package/dist/src/reporters/reporter-util.d.ts.map +1 -0
  383. package/dist/src/reporters/reporter-util.js +19 -0
  384. package/dist/src/reporters/reporter-util.js.map +1 -0
  385. package/dist/src/reporters/strict-reporter.d.ts +3 -0
  386. package/dist/src/reporters/strict-reporter.d.ts.map +1 -0
  387. package/dist/src/reporters/strict-reporter.js +2 -0
  388. package/dist/src/reporters/strict-reporter.js.map +1 -0
  389. package/dist/src/sandbox/create-preprocessor.d.ts +7 -0
  390. package/dist/src/sandbox/create-preprocessor.d.ts.map +1 -0
  391. package/dist/src/sandbox/create-preprocessor.js +16 -0
  392. package/dist/src/sandbox/create-preprocessor.js.map +1 -0
  393. package/dist/src/sandbox/disable-type-checks-preprocessor.d.ts +18 -0
  394. package/dist/src/sandbox/disable-type-checks-preprocessor.d.ts.map +1 -0
  395. package/dist/src/sandbox/disable-type-checks-preprocessor.js +43 -0
  396. package/dist/src/sandbox/disable-type-checks-preprocessor.js.map +1 -0
  397. package/dist/src/sandbox/file-preprocessor.d.ts +10 -0
  398. package/dist/src/sandbox/file-preprocessor.d.ts.map +1 -0
  399. package/dist/src/sandbox/file-preprocessor.js +2 -0
  400. package/dist/src/sandbox/file-preprocessor.js.map +1 -0
  401. package/dist/src/sandbox/index.d.ts +4 -0
  402. package/dist/src/sandbox/index.d.ts.map +1 -0
  403. package/dist/src/sandbox/index.js +3 -0
  404. package/dist/src/sandbox/index.js.map +1 -0
  405. package/dist/src/sandbox/multi-preprocessor.d.ts +8 -0
  406. package/dist/src/sandbox/multi-preprocessor.d.ts.map +1 -0
  407. package/dist/src/sandbox/multi-preprocessor.js +12 -0
  408. package/dist/src/sandbox/multi-preprocessor.js.map +1 -0
  409. package/dist/src/sandbox/sandbox.d.ts +43 -0
  410. package/dist/src/sandbox/sandbox.d.ts.map +1 -0
  411. package/dist/src/sandbox/sandbox.js +134 -0
  412. package/dist/src/sandbox/sandbox.js.map +1 -0
  413. package/dist/src/sandbox/ts-config-preprocessor.d.ts +46 -0
  414. package/dist/src/sandbox/ts-config-preprocessor.d.ts.map +1 -0
  415. package/dist/src/sandbox/ts-config-preprocessor.js +112 -0
  416. package/dist/src/sandbox/ts-config-preprocessor.js.map +1 -0
  417. package/dist/src/stryker-cli.d.ts +15 -0
  418. package/dist/src/stryker-cli.d.ts.map +1 -0
  419. package/dist/src/stryker-cli.js +168 -0
  420. package/dist/src/stryker-cli.js.map +1 -0
  421. package/dist/src/stryker-package.d.ts +5 -0
  422. package/dist/src/stryker-package.d.ts.map +1 -0
  423. package/dist/src/stryker-package.js +7 -0
  424. package/dist/src/stryker-package.js.map +1 -0
  425. package/dist/src/stryker-server.d.ts +40 -0
  426. package/dist/src/stryker-server.d.ts.map +1 -0
  427. package/dist/src/stryker-server.js +234 -0
  428. package/dist/src/stryker-server.js.map +1 -0
  429. package/dist/src/stryker.d.ts +31 -0
  430. package/dist/src/stryker.d.ts.map +1 -0
  431. package/dist/src/stryker.js +86 -0
  432. package/dist/src/stryker.js.map +1 -0
  433. package/dist/src/test-runner/child-process-test-runner-proxy.d.ts +19 -0
  434. package/dist/src/test-runner/child-process-test-runner-proxy.d.ts.map +1 -0
  435. package/dist/src/test-runner/child-process-test-runner-proxy.js +45 -0
  436. package/dist/src/test-runner/child-process-test-runner-proxy.js.map +1 -0
  437. package/dist/src/test-runner/child-process-test-runner-worker.d.ts +14 -0
  438. package/dist/src/test-runner/child-process-test-runner-worker.d.ts.map +1 -0
  439. package/dist/src/test-runner/child-process-test-runner-worker.js +45 -0
  440. package/dist/src/test-runner/child-process-test-runner-worker.js.map +1 -0
  441. package/dist/src/test-runner/command-test-runner.d.ts +31 -0
  442. package/dist/src/test-runner/command-test-runner.d.ts.map +1 -0
  443. package/dist/src/test-runner/command-test-runner.js +144 -0
  444. package/dist/src/test-runner/command-test-runner.js.map +1 -0
  445. package/dist/src/test-runner/index.d.ts +11 -0
  446. package/dist/src/test-runner/index.d.ts.map +1 -0
  447. package/dist/src/test-runner/index.js +18 -0
  448. package/dist/src/test-runner/index.js.map +1 -0
  449. package/dist/src/test-runner/max-test-runner-reuse-decorator.d.ts +14 -0
  450. package/dist/src/test-runner/max-test-runner-reuse-decorator.d.ts.map +1 -0
  451. package/dist/src/test-runner/max-test-runner-reuse-decorator.js +25 -0
  452. package/dist/src/test-runner/max-test-runner-reuse-decorator.js.map +1 -0
  453. package/dist/src/test-runner/reload-environment-decorator.d.ts +11 -0
  454. package/dist/src/test-runner/reload-environment-decorator.d.ts.map +1 -0
  455. package/dist/src/test-runner/reload-environment-decorator.js +56 -0
  456. package/dist/src/test-runner/reload-environment-decorator.js.map +1 -0
  457. package/dist/src/test-runner/retry-rejected-decorator.d.ts +15 -0
  458. package/dist/src/test-runner/retry-rejected-decorator.d.ts.map +1 -0
  459. package/dist/src/test-runner/retry-rejected-decorator.js +59 -0
  460. package/dist/src/test-runner/retry-rejected-decorator.js.map +1 -0
  461. package/dist/src/test-runner/test-runner-decorator.d.ts +8 -0
  462. package/dist/src/test-runner/test-runner-decorator.d.ts.map +1 -0
  463. package/dist/src/test-runner/test-runner-decorator.js +13 -0
  464. package/dist/src/test-runner/test-runner-decorator.js.map +1 -0
  465. package/dist/src/test-runner/timeout-decorator.d.ts +15 -0
  466. package/dist/src/test-runner/timeout-decorator.d.ts.map +1 -0
  467. package/dist/src/test-runner/timeout-decorator.js +51 -0
  468. package/dist/src/test-runner/timeout-decorator.js.map +1 -0
  469. package/dist/src/unexpected-exit-handler.d.ts +13 -0
  470. package/dist/src/unexpected-exit-handler.d.ts.map +1 -0
  471. package/dist/src/unexpected-exit-handler.js +28 -0
  472. package/dist/src/unexpected-exit-handler.js.map +1 -0
  473. package/dist/src/utils/file-utils.d.ts +30 -0
  474. package/dist/src/utils/file-utils.d.ts.map +1 -0
  475. package/dist/src/utils/file-utils.js +101 -0
  476. package/dist/src/utils/file-utils.js.map +1 -0
  477. package/dist/src/utils/index.d.ts +7 -0
  478. package/dist/src/utils/index.d.ts.map +1 -0
  479. package/dist/src/utils/index.js +7 -0
  480. package/dist/src/utils/index.js.map +1 -0
  481. package/dist/src/utils/json-rpc-event-deserializer.d.ts +5 -0
  482. package/dist/src/utils/json-rpc-event-deserializer.d.ts.map +1 -0
  483. package/dist/src/utils/json-rpc-event-deserializer.js +42 -0
  484. package/dist/src/utils/json-rpc-event-deserializer.js.map +1 -0
  485. package/dist/src/utils/object-utils.d.ts +37 -0
  486. package/dist/src/utils/object-utils.d.ts.map +1 -0
  487. package/dist/src/utils/object-utils.js +91 -0
  488. package/dist/src/utils/object-utils.js.map +1 -0
  489. package/dist/src/utils/string-builder.d.ts +9 -0
  490. package/dist/src/utils/string-builder.d.ts.map +1 -0
  491. package/dist/src/utils/string-builder.js +26 -0
  492. package/dist/src/utils/string-builder.js.map +1 -0
  493. package/dist/src/utils/string-utils.d.ts +12 -0
  494. package/dist/src/utils/string-utils.d.ts.map +1 -0
  495. package/dist/src/utils/string-utils.js +54 -0
  496. package/dist/src/utils/string-utils.js.map +1 -0
  497. package/dist/src/utils/temporary-directory.d.ts +18 -0
  498. package/dist/src/utils/temporary-directory.d.ts.map +1 -0
  499. package/dist/src/utils/temporary-directory.js +63 -0
  500. package/dist/src/utils/temporary-directory.js.map +1 -0
  501. package/dist/src/utils/timer.d.ts +14 -0
  502. package/dist/src/utils/timer.d.ts.map +1 -0
  503. package/dist/src/utils/timer.js +53 -0
  504. package/dist/src/utils/timer.js.map +1 -0
  505. package/package.json +106 -0
  506. package/schema/stryker-schema.json +855 -0
  507. package/src/checker/checker-child-process-proxy.ts +67 -0
  508. package/src/checker/checker-facade.ts +90 -0
  509. package/src/checker/checker-factory.ts +46 -0
  510. package/src/checker/checker-resource.ts +12 -0
  511. package/src/checker/checker-retry-decorator.ts +57 -0
  512. package/src/checker/checker-worker.ts +62 -0
  513. package/src/checker/index.ts +3 -0
  514. package/src/child-proxy/child-process-crashed-error.ts +16 -0
  515. package/src/child-proxy/child-process-proxy-worker.ts +203 -0
  516. package/src/child-proxy/child-process-proxy.ts +353 -0
  517. package/src/child-proxy/id-generator.ts +6 -0
  518. package/src/child-proxy/message-protocol.ts +87 -0
  519. package/src/child-proxy/out-of-memory-error.ts +11 -0
  520. package/src/concurrent/concurrency-token-provider.ts +106 -0
  521. package/src/concurrent/index.ts +3 -0
  522. package/src/concurrent/pool.ts +209 -0
  523. package/src/concurrent/resource-decorator.ts +28 -0
  524. package/src/config/config-file-formats.ts +31 -0
  525. package/src/config/config-reader.ts +193 -0
  526. package/src/config/file-matcher.ts +36 -0
  527. package/src/config/index.ts +5 -0
  528. package/src/config/meta-schema-builder.ts +50 -0
  529. package/src/config/options-validator.ts +317 -0
  530. package/src/config/validation-errors.ts +192 -0
  531. package/src/di/core-tokens.ts +39 -0
  532. package/src/di/index.ts +4 -0
  533. package/src/di/plugin-creator.ts +102 -0
  534. package/src/di/plugin-loader.ts +245 -0
  535. package/src/errors.ts +12 -0
  536. package/src/fs/file-system.ts +63 -0
  537. package/src/fs/index.ts +4 -0
  538. package/src/fs/project-file.ts +100 -0
  539. package/src/fs/project-reader.ts +493 -0
  540. package/src/fs/project.ts +98 -0
  541. package/src/index.ts +7 -0
  542. package/src/initializer/custom-initializers/angular-initializer.ts +95 -0
  543. package/src/initializer/custom-initializers/custom-initializer.ts +14 -0
  544. package/src/initializer/custom-initializers/index.ts +31 -0
  545. package/src/initializer/custom-initializers/react-initializer.ts +35 -0
  546. package/src/initializer/custom-initializers/svelte-initializer.ts +40 -0
  547. package/src/initializer/custom-initializers/vue-js-initializer.ts +30 -0
  548. package/src/initializer/gitignore-writer.ts +33 -0
  549. package/src/initializer/index.ts +35 -0
  550. package/src/initializer/initializer-tokens.ts +8 -0
  551. package/src/initializer/inquire.ts +17 -0
  552. package/src/initializer/npm-client.ts +103 -0
  553. package/src/initializer/npm-registry.ts +48 -0
  554. package/src/initializer/package-info.ts +10 -0
  555. package/src/initializer/prompt-option.ts +6 -0
  556. package/src/initializer/stryker-config-writer.ts +158 -0
  557. package/src/initializer/stryker-initializer.ts +278 -0
  558. package/src/initializer/stryker-inquirer.ts +101 -0
  559. package/src/logging/index.ts +5 -0
  560. package/src/logging/logger-impl.ts +81 -0
  561. package/src/logging/logging-backend.ts +90 -0
  562. package/src/logging/logging-client.ts +56 -0
  563. package/src/logging/logging-event.ts +94 -0
  564. package/src/logging/logging-server.ts +56 -0
  565. package/src/logging/logging-sink.ts +7 -0
  566. package/src/logging/priority.ts +15 -0
  567. package/src/logging/provide-logging.ts +70 -0
  568. package/src/mutants/diff-statistics-collector.ts +47 -0
  569. package/src/mutants/incremental-differ.ts +771 -0
  570. package/src/mutants/index.ts +3 -0
  571. package/src/mutants/mutant-test-planner.ts +357 -0
  572. package/src/mutants/test-coverage.ts +125 -0
  573. package/src/process/1-prepare-executor.ts +133 -0
  574. package/src/process/2-mutant-instrumenter-executor.ts +122 -0
  575. package/src/process/3-dry-run-executor.ts +262 -0
  576. package/src/process/4-mutation-test-executor.ts +272 -0
  577. package/src/process/index.ts +4 -0
  578. package/src/reporters/broadcast-reporter.ts +129 -0
  579. package/src/reporters/ci/circle-provider.ts +50 -0
  580. package/src/reporters/ci/github-actions-provider.ts +22 -0
  581. package/src/reporters/ci/provider.ts +42 -0
  582. package/src/reporters/ci/travis-provider.ts +24 -0
  583. package/src/reporters/clear-text-reporter.ts +245 -0
  584. package/src/reporters/clear-text-score-table.ts +305 -0
  585. package/src/reporters/dashboard-reporter/dashboard-reporter-client.ts +89 -0
  586. package/src/reporters/dashboard-reporter/dashboard-reporter.ts +97 -0
  587. package/src/reporters/dashboard-reporter/index.ts +30 -0
  588. package/src/reporters/dashboard-reporter/report.ts +6 -0
  589. package/src/reporters/dashboard-reporter/tokens.ts +5 -0
  590. package/src/reporters/dots-reporter.ts +33 -0
  591. package/src/reporters/event-recorder-reporter.ts +88 -0
  592. package/src/reporters/html-reporter.ts +87 -0
  593. package/src/reporters/index.ts +48 -0
  594. package/src/reporters/json-reporter.ts +45 -0
  595. package/src/reporters/mutation-test-report-helper.ts +425 -0
  596. package/src/reporters/mutation-timings-reporter.ts +78 -0
  597. package/src/reporters/progress-append-only-reporter.ts +36 -0
  598. package/src/reporters/progress-bar.ts +6 -0
  599. package/src/reporters/progress-keeper.ts +113 -0
  600. package/src/reporters/progress-reporter.ts +62 -0
  601. package/src/reporters/reporter-util.ts +20 -0
  602. package/src/reporters/strict-reporter.ts +3 -0
  603. package/src/sandbox/create-preprocessor.ts +27 -0
  604. package/src/sandbox/disable-type-checks-preprocessor.ts +70 -0
  605. package/src/sandbox/file-preprocessor.ts +10 -0
  606. package/src/sandbox/index.ts +3 -0
  607. package/src/sandbox/multi-preprocessor.ts +13 -0
  608. package/src/sandbox/sandbox.ts +198 -0
  609. package/src/sandbox/ts-config-preprocessor.ts +168 -0
  610. package/src/stryker-cli.ts +363 -0
  611. package/src/stryker-package.ts +19 -0
  612. package/src/stryker-server.ts +334 -0
  613. package/src/stryker.ts +126 -0
  614. package/src/test-runner/child-process-test-runner-proxy.ts +94 -0
  615. package/src/test-runner/child-process-test-runner-worker.ts +66 -0
  616. package/src/test-runner/command-test-runner.ts +190 -0
  617. package/src/test-runner/index.ts +74 -0
  618. package/src/test-runner/max-test-runner-reuse-decorator.ts +41 -0
  619. package/src/test-runner/reload-environment-decorator.ts +72 -0
  620. package/src/test-runner/retry-rejected-decorator.ts +79 -0
  621. package/src/test-runner/test-runner-decorator.ts +22 -0
  622. package/src/test-runner/timeout-decorator.ts +71 -0
  623. package/src/unexpected-exit-handler.ts +36 -0
  624. package/src/utils/file-utils.ts +113 -0
  625. package/src/utils/index.ts +6 -0
  626. package/src/utils/json-rpc-event-deserializer.ts +48 -0
  627. package/src/utils/object-utils.ts +106 -0
  628. package/src/utils/string-builder.ts +30 -0
  629. package/src/utils/string-utils.ts +61 -0
  630. package/src/utils/temporary-directory.ts +83 -0
  631. package/src/utils/timer.ts +58 -0
@@ -0,0 +1,3 @@
1
+ export * from './mutant-test-planner.js';
2
+ export * from './incremental-differ.js';
3
+ export * from './test-coverage.js';
@@ -0,0 +1,357 @@
1
+ import path from 'path';
2
+
3
+ import { TestResult } from '@stryker-mutator/api/test-runner';
4
+ import {
5
+ MutantRunPlan,
6
+ MutantTestPlan,
7
+ PlanKind,
8
+ Mutant,
9
+ StrykerOptions,
10
+ MutantStatus,
11
+ MutantEarlyResultPlan,
12
+ } from '@stryker-mutator/api/core';
13
+ import { commonTokens, tokens } from '@stryker-mutator/api/plugin';
14
+ import { Logger } from '@stryker-mutator/api/logging';
15
+ import { I, notEmpty, split } from '@stryker-mutator/util';
16
+
17
+ import { coreTokens } from '../di/index.js';
18
+ import { StrictReporter } from '../reporters/strict-reporter.js';
19
+ import { Sandbox } from '../sandbox/index.js';
20
+ import { objectUtils } from '../utils/object-utils.js';
21
+ import { optionsPath } from '../utils/index.js';
22
+ import { Project } from '../fs/project.js';
23
+
24
+ import {
25
+ IncrementalDiffer,
26
+ toRelativeNormalizedFileName,
27
+ } from './incremental-differ.js';
28
+ import { TestCoverage } from './test-coverage.js';
29
+
30
+ /**
31
+ * The factor by which hit count from dry run is multiplied to calculate the hit limit for a mutant.
32
+ * This is intentionally a high value to prevent false positives.
33
+ *
34
+ * For example, a property testing library might execute a failing scenario multiple times to determine the smallest possible counterexample.
35
+ * @see https://jsverify.github.io/#minimal-counterexample
36
+ */
37
+ const HIT_LIMIT_FACTOR = 100;
38
+
39
+ /**
40
+ * Responsible for determining the tests to execute for each mutant, as well as other run option specific details
41
+ *
42
+ */
43
+ export class MutantTestPlanner {
44
+ public static readonly inject = tokens(
45
+ coreTokens.testCoverage,
46
+ coreTokens.incrementalDiffer,
47
+ coreTokens.reporter,
48
+ coreTokens.sandbox,
49
+ coreTokens.project,
50
+ coreTokens.timeOverheadMS,
51
+ commonTokens.options,
52
+ commonTokens.logger,
53
+ );
54
+ private readonly timeSpentAllTests: number;
55
+ private readonly globalTestFilter: string[] | undefined;
56
+
57
+ constructor(
58
+ private readonly testCoverage: I<TestCoverage>,
59
+ private readonly incrementalDiffer: IncrementalDiffer,
60
+ private readonly reporter: StrictReporter,
61
+ private readonly sandbox: I<Sandbox>,
62
+ private readonly project: I<Project>,
63
+ private readonly timeOverheadMS: number,
64
+ private readonly options: StrykerOptions,
65
+ private readonly logger: Logger,
66
+ ) {
67
+ this.timeSpentAllTests = calculateTotalTime(
68
+ this.testCoverage.testsById.values(),
69
+ );
70
+ this.globalTestFilter =
71
+ this.project.testFiles.length > 0
72
+ ? this.project.testFiles.map((file) =>
73
+ this.sandbox.sandboxFileFor(file),
74
+ )
75
+ : undefined;
76
+ }
77
+
78
+ public async makePlan(
79
+ mutants: readonly Mutant[],
80
+ ): Promise<readonly MutantTestPlan[]> {
81
+ const mutantsDiff = await this.incrementalDiff(mutants);
82
+ const mutantPlans = mutantsDiff.map((mutant) => this.planMutant(mutant));
83
+ this.reporter.onMutationTestingPlanReady({ mutantPlans });
84
+ this.warnAboutSlow(mutantPlans);
85
+ return mutantPlans;
86
+ }
87
+
88
+ private planMutant(mutant: Mutant): MutantTestPlan {
89
+ const isStatic = this.testCoverage.hasStaticCoverage(mutant.id);
90
+
91
+ if (mutant.status) {
92
+ // If this mutant was already ignored, early result
93
+ return this.createMutantEarlyResultPlan(mutant, {
94
+ isStatic,
95
+ coveredBy: mutant.coveredBy,
96
+ killedBy: mutant.killedBy,
97
+ status: mutant.status,
98
+ statusReason: mutant.statusReason,
99
+ });
100
+ } else if (this.testCoverage.hasCoverage) {
101
+ // If there was coverage information (coverageAnalysis not "off")
102
+ const tests = this.testCoverage.testsByMutantId.get(mutant.id) ?? [];
103
+ const coveredBy = toTestIds(tests);
104
+ if (!isStatic || (this.options.ignoreStatic && coveredBy.length)) {
105
+ // If not static, or it was "hybrid" (both static and perTest coverage) and ignoreStatic is on.
106
+ // Only run covered tests with mutant active during runtime
107
+ const netTime = calculateTotalTime(tests);
108
+ return this.createMutantRunPlan(mutant, {
109
+ netTime,
110
+ coveredBy,
111
+ isStatic,
112
+ testFilter: coveredBy,
113
+ });
114
+ } else if (this.options.ignoreStatic) {
115
+ // Static (w/o perTest coverage) and ignoreStatic is on -> Ignore.
116
+ return this.createMutantEarlyResultPlan(mutant, {
117
+ status: 'Ignored',
118
+ statusReason: 'Static mutant (and "ignoreStatic" was enabled)',
119
+ isStatic,
120
+ coveredBy,
121
+ });
122
+ } else {
123
+ // Static (or hybrid) and `ignoreStatic` is off -> run all tests
124
+ return this.createMutantRunPlan(mutant, {
125
+ netTime: this.timeSpentAllTests,
126
+ isStatic,
127
+ coveredBy,
128
+ testFilter: this.globalTestFilter,
129
+ });
130
+ }
131
+ } else {
132
+ // No coverage information exists, all tests need to run
133
+ return this.createMutantRunPlan(mutant, {
134
+ netTime: this.timeSpentAllTests,
135
+ testFilter: this.globalTestFilter,
136
+ });
137
+ }
138
+ }
139
+
140
+ private createMutantEarlyResultPlan(
141
+ mutant: Mutant,
142
+ {
143
+ isStatic,
144
+ status,
145
+ statusReason,
146
+ coveredBy,
147
+ killedBy,
148
+ }: {
149
+ isStatic: boolean | undefined;
150
+ status: MutantStatus;
151
+ statusReason?: string;
152
+ coveredBy?: string[];
153
+ killedBy?: string[];
154
+ },
155
+ ): MutantEarlyResultPlan {
156
+ return {
157
+ plan: PlanKind.EarlyResult,
158
+ mutant: {
159
+ ...mutant,
160
+ status,
161
+ static: isStatic,
162
+ statusReason,
163
+ coveredBy,
164
+ killedBy,
165
+ },
166
+ };
167
+ }
168
+
169
+ private createMutantRunPlan(
170
+ mutant: Mutant,
171
+ {
172
+ netTime,
173
+ testFilter,
174
+ isStatic,
175
+ coveredBy,
176
+ }: {
177
+ netTime: number;
178
+ testFilter?: string[] | undefined;
179
+ isStatic?: boolean | undefined;
180
+ coveredBy?: string[] | undefined;
181
+ },
182
+ ): MutantRunPlan {
183
+ const { disableBail, timeoutMS, timeoutFactor } = this.options;
184
+ const timeout = timeoutFactor * netTime + timeoutMS + this.timeOverheadMS;
185
+ const hitCount = this.testCoverage.hitsByMutantId.get(mutant.id);
186
+ const hitLimit =
187
+ hitCount === undefined ? undefined : hitCount * HIT_LIMIT_FACTOR;
188
+
189
+ // Hot swap is only safe when:
190
+ // 1. We have a specific test filter (not running all tests)
191
+ // 2. The mutant is NOT static (static mutants require full reload)
192
+ const canHotSwap = !!testFilter && isStatic === false;
193
+
194
+ return {
195
+ plan: PlanKind.Run,
196
+ netTime,
197
+ mutant: {
198
+ ...mutant,
199
+ coveredBy,
200
+ static: isStatic,
201
+ },
202
+ runOptions: {
203
+ // Copy over relevant mutant fields, we don't want to copy over "static" and "coveredBy", test runners should only care about the testFilter
204
+ activeMutant: {
205
+ id: mutant.id,
206
+ fileName: mutant.fileName,
207
+ location: mutant.location,
208
+ mutatorName: mutant.mutatorName,
209
+ replacement: mutant.replacement,
210
+ },
211
+ mutantActivation: testFilter ? 'runtime' : 'static',
212
+ timeout,
213
+ testFilter,
214
+ sandboxFileName: this.sandbox.sandboxFileFor(mutant.fileName),
215
+ hitLimit,
216
+ disableBail,
217
+ reloadEnvironment: !canHotSwap,
218
+ },
219
+ };
220
+ }
221
+
222
+ private warnAboutSlow(mutantPlans: readonly MutantTestPlan[]) {
223
+ if (
224
+ !this.options.ignoreStatic &&
225
+ objectUtils.isWarningEnabled('slow', this.options.warnings)
226
+ ) {
227
+ // Only warn when the estimated time to run all static mutants exceeds 40%
228
+ // ... and when the average performance impact of a static mutant is estimated to be twice that (or more) of a non-static mutant
229
+ const ABSOLUTE_CUT_OFF_PERUNAGE = 0.4;
230
+ const RELATIVE_CUT_OFF_FACTOR = 2;
231
+ const zeroIfNaN = (n: number) => (isNaN(n) ? 0 : n);
232
+ const totalNetTime = (runPlans: MutantRunPlan[]) =>
233
+ runPlans.reduce((acc, { netTime }) => acc + netTime, 0);
234
+ const runPlans = mutantPlans.filter(isRunPlan);
235
+ const [staticRunPlans, runTimeRunPlans] = split(runPlans, ({ mutant }) =>
236
+ Boolean(mutant.static),
237
+ );
238
+ const estimatedTimeForStaticMutants = totalNetTime(staticRunPlans);
239
+ const estimatedTimeForRunTimeMutants = totalNetTime(runTimeRunPlans);
240
+ const estimatedTotalTime =
241
+ estimatedTimeForRunTimeMutants + estimatedTimeForStaticMutants;
242
+ const avgTimeForAStaticMutant = zeroIfNaN(
243
+ estimatedTimeForStaticMutants / staticRunPlans.length,
244
+ );
245
+ const avgTimeForARunTimeMutant = zeroIfNaN(
246
+ estimatedTimeForRunTimeMutants / runTimeRunPlans.length,
247
+ );
248
+ const relativeTimeForStaticMutants =
249
+ estimatedTimeForStaticMutants / estimatedTotalTime;
250
+ const absoluteCondition =
251
+ relativeTimeForStaticMutants >= ABSOLUTE_CUT_OFF_PERUNAGE;
252
+ const relativeCondition =
253
+ avgTimeForAStaticMutant >=
254
+ RELATIVE_CUT_OFF_FACTOR * avgTimeForARunTimeMutant;
255
+ if (relativeCondition && absoluteCondition) {
256
+ const percentage = (perunage: number) => Math.round(perunage * 100);
257
+ this.logger.warn(
258
+ `Detected ${staticRunPlans.length} static mutants (${percentage(
259
+ staticRunPlans.length / runPlans.length,
260
+ )}% of total) that are estimated to take ${percentage(
261
+ relativeTimeForStaticMutants,
262
+ )}% of the time running the tests!\n You might want to enable "ignoreStatic" to ignore these static mutants for your next run. \n For more information about static mutants visit: https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants\n (disable "${optionsPath(
263
+ 'warnings',
264
+ 'slow',
265
+ )}" to ignore this warning)`,
266
+ );
267
+ }
268
+ }
269
+ }
270
+
271
+ private async incrementalDiff(
272
+ currentMutants: readonly Mutant[],
273
+ ): Promise<readonly Mutant[]> {
274
+ const { incrementalReport } = this.project;
275
+
276
+ if (incrementalReport) {
277
+ const currentFiles = await this.readAllOriginalFiles(
278
+ currentMutants,
279
+ this.testCoverage.testsById.values(),
280
+ Object.keys(incrementalReport.files),
281
+ Object.keys(incrementalReport.testFiles ?? {}),
282
+ );
283
+ const diffedMutants = this.incrementalDiffer.diff(
284
+ currentMutants,
285
+ this.testCoverage,
286
+ incrementalReport,
287
+ currentFiles,
288
+ );
289
+
290
+ return diffedMutants;
291
+ }
292
+ return currentMutants;
293
+ }
294
+
295
+ private async readAllOriginalFiles(
296
+ ...thingsWithFileNamesOrFileNames: Array<
297
+ Iterable<string | { fileName?: string }>
298
+ >
299
+ ): Promise<Map<string, string>> {
300
+ const uniqueFileNames = [
301
+ ...new Set(
302
+ thingsWithFileNamesOrFileNames
303
+ .flatMap((container) =>
304
+ [...container].map((thing) =>
305
+ typeof thing === 'string' ? thing : thing.fileName,
306
+ ),
307
+ )
308
+ .filter(notEmpty)
309
+ .map((fileName) => path.resolve(fileName)),
310
+ ),
311
+ ];
312
+ const result = await Promise.all(
313
+ uniqueFileNames.map(async (fileName) => {
314
+ const originalContent = await this.project.files
315
+ .get(fileName)
316
+ ?.readOriginal();
317
+ if (originalContent) {
318
+ return [
319
+ toRelativeNormalizedFileName(fileName),
320
+ originalContent,
321
+ ] as const;
322
+ } else {
323
+ return undefined;
324
+ }
325
+ }),
326
+ );
327
+
328
+ return new Map(result.filter(notEmpty));
329
+ }
330
+ }
331
+
332
+ function calculateTotalTime(testResults: Iterable<TestResult>): number {
333
+ let total = 0;
334
+ for (const test of testResults) {
335
+ total += test.timeSpentMs;
336
+ }
337
+ return total;
338
+ }
339
+
340
+ function toTestIds(testResults: Iterable<TestResult>): string[] {
341
+ const result = [];
342
+ for (const test of testResults) {
343
+ result.push(test.id);
344
+ }
345
+ return result;
346
+ }
347
+
348
+ export function isEarlyResult(
349
+ mutantPlan: MutantTestPlan,
350
+ ): mutantPlan is MutantEarlyResultPlan {
351
+ return mutantPlan.plan === PlanKind.EarlyResult;
352
+ }
353
+ export function isRunPlan(
354
+ mutantPlan: MutantTestPlan,
355
+ ): mutantPlan is MutantRunPlan {
356
+ return mutantPlan.plan === PlanKind.Run;
357
+ }
@@ -0,0 +1,125 @@
1
+ import { CoverageData } from '@stryker-mutator/api/core';
2
+ import { Logger } from '@stryker-mutator/api/logging';
3
+ import { commonTokens } from '@stryker-mutator/api/plugin';
4
+ import {
5
+ CompleteDryRunResult,
6
+ TestResult,
7
+ } from '@stryker-mutator/api/test-runner';
8
+ import { notEmpty } from '@stryker-mutator/util';
9
+
10
+ import { coreTokens } from '../di/index.js';
11
+
12
+ export class TestCoverage {
13
+ readonly #testsByMutantId;
14
+ readonly #testsById;
15
+ readonly #staticCoverage;
16
+ readonly #hitsByMutantId;
17
+
18
+ constructor(
19
+ testsByMutantId: Map<string, Set<TestResult>>,
20
+ testsById: Map<string, TestResult>,
21
+ staticCoverage: CoverageData | undefined,
22
+ hitsByMutantId: Map<string, number>,
23
+ ) {
24
+ this.#testsByMutantId = testsByMutantId;
25
+ this.#testsById = testsById;
26
+ this.#staticCoverage = staticCoverage;
27
+ this.#hitsByMutantId = hitsByMutantId;
28
+ }
29
+
30
+ public get testsByMutantId(): ReadonlyMap<string, Set<TestResult>> {
31
+ return this.#testsByMutantId;
32
+ }
33
+ public get testsById(): ReadonlyMap<string, TestResult> {
34
+ return this.#testsById;
35
+ }
36
+ public get hitsByMutantId(): ReadonlyMap<string, number> {
37
+ return this.#hitsByMutantId;
38
+ }
39
+
40
+ public get hasCoverage(): boolean {
41
+ // Since static coverage should always be reported when coverage analysis succeeded (albeit an empty object),
42
+ // we can use that to determine if there is any coverage at all
43
+ return !!this.#staticCoverage;
44
+ }
45
+
46
+ public hasStaticCoverage(mutantId: string): boolean {
47
+ return !!(this.#staticCoverage && this.#staticCoverage[mutantId] > 0);
48
+ }
49
+
50
+ public addTest(testResult: TestResult): void {
51
+ this.#testsById.set(testResult.id, testResult);
52
+ }
53
+
54
+ public addCoverage(mutantId: string, testIds: string[]): void {
55
+ const tests = this.#testsByMutantId.get(mutantId) ?? new Set();
56
+ this.#testsByMutantId.set(mutantId, tests);
57
+ testIds
58
+ .map((testId) => this.#testsById.get(testId))
59
+ .filter(notEmpty)
60
+ .forEach((test) => tests.add(test));
61
+ }
62
+
63
+ public forMutant(mutantId: string): ReadonlySet<TestResult> | undefined {
64
+ return this.#testsByMutantId.get(mutantId);
65
+ }
66
+
67
+ public static from = testCoverageFrom;
68
+ }
69
+
70
+ function testCoverageFrom(
71
+ { tests, mutantCoverage }: CompleteDryRunResult,
72
+ logger: Logger,
73
+ ): TestCoverage {
74
+ const hitsByMutantId = new Map<string, number>();
75
+ const testsByMutantId = new Map<string, Set<TestResult>>();
76
+ const testsById = tests.reduce(
77
+ (acc, test) => acc.set(test.id, test),
78
+ new Map<string, TestResult>(),
79
+ );
80
+ if (mutantCoverage) {
81
+ Object.entries(mutantCoverage.perTest).forEach(([testId, coverage]) => {
82
+ const foundTest = testsById.get(testId);
83
+ if (!foundTest) {
84
+ logger.warn(
85
+ `Found test with id "${testId}" in coverage data, but not in the test results of the dry run. Not taking coverage data for this test into account.`,
86
+ );
87
+ return;
88
+ }
89
+ Object.entries(coverage).forEach(([mutantId, count]) => {
90
+ if (count > 0) {
91
+ let cov = testsByMutantId.get(mutantId);
92
+ if (!cov) {
93
+ cov = new Set();
94
+ testsByMutantId.set(mutantId, cov);
95
+ }
96
+ cov.add(foundTest);
97
+ }
98
+ });
99
+ });
100
+
101
+ // We don't care about the exact tests in this case, just the total number of hits
102
+ const coverageResultsPerMutant = [
103
+ mutantCoverage.static,
104
+ ...Object.values(mutantCoverage.perTest),
105
+ ];
106
+ coverageResultsPerMutant.forEach((coverageByMutantId) => {
107
+ Object.entries(coverageByMutantId).forEach(([mutantId, count]) => {
108
+ hitsByMutantId.set(
109
+ mutantId,
110
+ (hitsByMutantId.get(mutantId) ?? 0) + count,
111
+ );
112
+ });
113
+ });
114
+ }
115
+ return new TestCoverage(
116
+ testsByMutantId,
117
+ testsById,
118
+ mutantCoverage?.static,
119
+ hitsByMutantId,
120
+ );
121
+ }
122
+ testCoverageFrom.inject = [
123
+ coreTokens.dryRunResult,
124
+ commonTokens.logger,
125
+ ] as const;
@@ -0,0 +1,133 @@
1
+ import {
2
+ StrykerOptions,
3
+ PartialStrykerOptions,
4
+ strykerCoreSchema,
5
+ } from '@stryker-mutator/api/core';
6
+ import {
7
+ BaseContext,
8
+ commonTokens,
9
+ Injector,
10
+ tokens,
11
+ } from '@stryker-mutator/api/plugin';
12
+ import { frameworkPluginsFileUrl } from '@stryker-mutator/instrumenter';
13
+ import { deepFreeze } from '@stryker-mutator/util';
14
+ import { execaCommand } from 'execa';
15
+
16
+ import { ConfigReader } from '../config/config-reader.js';
17
+ import { coreTokens, PluginCreator } from '../di/index.js';
18
+ import { TemporaryDirectory } from '../utils/temporary-directory.js';
19
+ import { ConfigError } from '../errors.js';
20
+ import { PluginLoader } from '../di/plugin-loader.js';
21
+ import { reporterPluginsFileUrl } from '../reporters/index.js';
22
+ import { Timer } from '../utils/timer.js';
23
+ import { MetaSchemaBuilder, OptionsValidator } from '../config/index.js';
24
+ import { BroadcastReporter } from '../reporters/broadcast-reporter.js';
25
+ import { UnexpectedExitHandler } from '../unexpected-exit-handler.js';
26
+
27
+ import { FileSystem, ProjectReader } from '../fs/index.js';
28
+
29
+ import { MutantInstrumenterContext } from './index.js';
30
+ import { Reporter } from '@stryker-mutator/api/report';
31
+ import { LoggingBackend, LoggingServerAddress } from '../logging/index.js';
32
+
33
+ export interface PrepareExecutorContext extends BaseContext {
34
+ [coreTokens.loggingServerAddress]: LoggingServerAddress;
35
+ [coreTokens.reporterOverride]?: Reporter;
36
+ }
37
+
38
+ export interface PrepareExecutorArgs {
39
+ cliOptions: PartialStrykerOptions;
40
+ targetMutatePatterns: string[] | undefined;
41
+ }
42
+
43
+ export class PrepareExecutor {
44
+ public static readonly inject = tokens(
45
+ commonTokens.injector,
46
+ coreTokens.loggingSink,
47
+ );
48
+ constructor(
49
+ private readonly injector: Injector<PrepareExecutorContext>,
50
+ private readonly loggingBackend: LoggingBackend,
51
+ ) {}
52
+
53
+ public async execute({
54
+ cliOptions,
55
+ targetMutatePatterns,
56
+ }: PrepareExecutorArgs): Promise<Injector<MutantInstrumenterContext>> {
57
+ // greedy initialize, so the time starts immediately
58
+ const timer = new Timer();
59
+
60
+ // Already configure the logger, so next classes can use them
61
+ this.loggingBackend.configure(cliOptions);
62
+
63
+ // Read the config file
64
+ const configReaderInjector = this.injector
65
+ .provideValue(coreTokens.validationSchema, strykerCoreSchema)
66
+ .provideClass(coreTokens.optionsValidator, OptionsValidator);
67
+ const configReader = configReaderInjector.injectClass(ConfigReader);
68
+ const options: StrykerOptions = await configReader.readConfig(cliOptions);
69
+
70
+ // Load plugins
71
+ const pluginLoader = configReaderInjector.injectClass(PluginLoader);
72
+ const pluginDescriptors = [
73
+ ...options.plugins,
74
+ frameworkPluginsFileUrl,
75
+ reporterPluginsFileUrl,
76
+ ...options.appendPlugins,
77
+ ];
78
+ const loadedPlugins = await pluginLoader.load(pluginDescriptors);
79
+
80
+ // Revalidate the options with plugin schema additions
81
+ const metaSchemaBuilder =
82
+ configReaderInjector.injectClass(MetaSchemaBuilder);
83
+ const metaSchema = metaSchemaBuilder.buildMetaSchema(
84
+ loadedPlugins.schemaContributions,
85
+ );
86
+ const optionsValidatorInjector = configReaderInjector.provideValue(
87
+ coreTokens.validationSchema,
88
+ metaSchema,
89
+ );
90
+ const validator: OptionsValidator =
91
+ optionsValidatorInjector.injectClass(OptionsValidator);
92
+ validator.validate(options, true);
93
+
94
+ // Done reading config, deep freeze it so it won't change unexpectedly
95
+ deepFreeze(options);
96
+
97
+ // Final logging configuration, update the logging configuration with the latest results
98
+ this.loggingBackend.configure(options);
99
+
100
+ // Resolve input files
101
+ const projectFileReaderInjector = optionsValidatorInjector
102
+ .provideValue(commonTokens.options, options)
103
+ .provideClass(coreTokens.temporaryDirectory, TemporaryDirectory)
104
+ .provideClass(coreTokens.fs, FileSystem)
105
+ .provideValue(coreTokens.pluginsByKind, loadedPlugins.pluginsByKind);
106
+ const project = await projectFileReaderInjector
107
+ .injectClass(ProjectReader)
108
+ .read(targetMutatePatterns);
109
+
110
+ if (project.isEmpty) {
111
+ throw new ConfigError('No input files found.');
112
+ } else {
113
+ // Done preparing, finish up and return
114
+ await projectFileReaderInjector
115
+ .resolve(coreTokens.temporaryDirectory)
116
+ .initialize();
117
+ return projectFileReaderInjector
118
+ .provideValue(coreTokens.project, project)
119
+ .provideValue(commonTokens.fileDescriptions, project.fileDescriptions)
120
+ .provideClass(coreTokens.pluginCreator, PluginCreator)
121
+ .provideClass(coreTokens.reporter, BroadcastReporter)
122
+ .provideValue(coreTokens.timer, timer)
123
+ .provideValue(coreTokens.project, project)
124
+ .provideValue(coreTokens.execa, execaCommand)
125
+ .provideValue(coreTokens.process, process)
126
+ .provideClass(coreTokens.unexpectedExitRegistry, UnexpectedExitHandler)
127
+ .provideValue(
128
+ coreTokens.pluginModulePaths,
129
+ loadedPlugins.pluginModulePaths,
130
+ );
131
+ }
132
+ }
133
+ }