mootant 0.1.0 → 0.2.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 (244) hide show
  1. package/dist/adapters/jest/build-dry-file.d.ts +12 -12
  2. package/dist/adapters/jest/collect-jest-dependencies.d.ts +8 -7
  3. package/dist/adapters/jest/runner.d.ts +1 -1
  4. package/dist/adapters/jest/runner.js +1 -1
  5. package/dist/adapters/jest/types/jest-record.d.ts +4 -4
  6. package/dist/adapters/jest/types/unit-worker.d.ts +16 -8
  7. package/dist/adapters/jest/types/worker-session.d.ts +6 -7
  8. package/dist/adapters/jest/worker/boot-worker.d.ts +4 -3
  9. package/dist/adapters/jest/worker/run-unit.d.ts +20 -18
  10. package/dist/adapters/jest/worker/vm-setup.js +1 -1
  11. package/dist/adapters/jest/worker/worker.js +1 -1
  12. package/dist/adapters/jest/write-worker-session.d.ts +1 -2
  13. package/dist/adapters/jest/write-worker-session.js +2 -2
  14. package/dist/adapters/node-test/collect-node-dependencies.d.ts +5 -5
  15. package/dist/adapters/node-test/preload/preload.js +4 -1
  16. package/dist/adapters/node-test/run-test-file.js +1 -0
  17. package/dist/adapters/node-test/types/node-test-record.d.ts +3 -3
  18. package/dist/adapters/node-test/types/node-test-unit.d.ts +6 -1
  19. package/dist/adapters/shared/create-input-filter.d.ts +26 -0
  20. package/dist/adapters/shared/create-input-filter.js +32 -0
  21. package/dist/adapters/shared/track-file-inputs.d.ts +7 -3
  22. package/dist/adapters/shared/track-file-inputs.js +16 -7
  23. package/dist/adapters/shared/track-file-reads.d.ts +12 -8
  24. package/dist/adapters/shared/track-file-reads.js +110 -57
  25. package/dist/adapters/shared/track-inputs.d.ts +13 -6
  26. package/dist/adapters/shared/track-inputs.js +7 -7
  27. package/dist/adapters/shared/types/file-input-tracking.d.ts +6 -0
  28. package/dist/adapters/shared/types/input-tracking.d.ts +3 -3
  29. package/dist/adapters/vitest/collect-dependencies.d.ts +4 -3
  30. package/dist/adapters/vitest/collect-dependencies.js +25 -24
  31. package/dist/adapters/vitest/get-cache-inputs.js +3 -1
  32. package/dist/adapters/vitest/is-virtual-module.d.ts +11 -0
  33. package/dist/adapters/vitest/is-virtual-module.js +8 -0
  34. package/dist/adapters/vitest/read-out-files.d.ts +7 -2
  35. package/dist/adapters/vitest/read-out-files.js +5 -5
  36. package/dist/adapters/vitest/read-out-records.d.ts +17 -0
  37. package/dist/adapters/vitest/read-out-records.js +27 -0
  38. package/dist/adapters/vitest/read-strays.d.ts +20 -0
  39. package/dist/adapters/vitest/read-strays.js +53 -0
  40. package/dist/adapters/vitest/read-unit-inputs.d.ts +7 -1
  41. package/dist/adapters/vitest/read-unit-inputs.js +1 -1
  42. package/dist/adapters/vitest/run-dry.js +16 -16
  43. package/dist/adapters/vitest/run-plan.d.ts +3 -1
  44. package/dist/adapters/vitest/run-plan.js +15 -15
  45. package/dist/adapters/vitest/run-specifications.d.ts +3 -2
  46. package/dist/adapters/vitest/runner.d.ts +38 -23
  47. package/dist/adapters/vitest/runner.js +84 -85
  48. package/dist/adapters/vitest/types/stray-decisions.d.ts +8 -0
  49. package/dist/adapters/vitest/types/unit-outcome.d.ts +2 -1
  50. package/dist/adapters/vitest/types/vitest-worker.d.ts +83 -12
  51. package/dist/adapters/vitest/worker/encode-stray.d.ts +16 -0
  52. package/dist/adapters/vitest/worker/encode-stray.js +16 -0
  53. package/dist/adapters/vitest/worker/intercept-strays.d.ts +26 -0
  54. package/dist/adapters/vitest/worker/intercept-strays.js +13 -0
  55. package/dist/adapters/vitest/worker/read-try-facts.d.ts +5 -4
  56. package/dist/adapters/vitest/worker/write-out-record.d.ts +2 -2
  57. package/dist/cli/html/build-html-report.js +1 -1
  58. package/dist/cli/html/client/main.js +1 -1
  59. package/dist/cli/html/client/render-change.d.ts +3 -2
  60. package/dist/cli/html/client/render-code.d.ts +1 -1
  61. package/dist/cli/html/pack-replacement.d.ts +1 -1
  62. package/dist/cli/parse-arguments.js +1 -1
  63. package/dist/cli/report/build-list-report.js +1 -1
  64. package/dist/cli/report/build-run-report.js +1 -1
  65. package/dist/cli/report/format-file-groups.d.ts +1 -1
  66. package/dist/cli/run-mutation.js +31 -31
  67. package/dist/cli/terminal/create-spinner.d.ts +1 -1
  68. package/dist/cli/terminal/get-text-style.js +4 -4
  69. package/dist/core/cache/get-environment-key.js +2 -2
  70. package/dist/core/cache/hash-files.d.ts +7 -3
  71. package/dist/core/cache/hash-files.js +16 -17
  72. package/dist/core/cache/prepare-run-cache.d.ts +29 -7
  73. package/dist/core/cache/prepare-run-cache.js +96 -62
  74. package/dist/core/cache/save-run-cache.d.ts +8 -7
  75. package/dist/core/cache/save-run-cache.js +2 -1
  76. package/dist/core/cache/unknown-hash.d.ts +7 -0
  77. package/dist/core/cache/unknown-hash.js +2 -0
  78. package/dist/core/files/select-changed-mutants.d.ts +11 -6
  79. package/dist/core/files/select-changed-mutants.js +38 -13
  80. package/dist/core/generate/apply-solitary-rule.d.ts +8 -5
  81. package/dist/core/generate/apply-solitary-rule.js +36 -29
  82. package/dist/core/generate/collect-candidates.d.ts +18 -4
  83. package/dist/core/generate/collect-candidates.js +168 -86
  84. package/dist/core/generate/compare-targets.d.ts +14 -0
  85. package/dist/core/generate/compare-targets.js +6 -0
  86. package/dist/core/generate/deduplicate-candidates.d.ts +6 -4
  87. package/dist/core/generate/deduplicate-candidates.js +11 -9
  88. package/dist/core/generate/find-list-removal.d.ts +20 -0
  89. package/dist/core/generate/find-list-removal.js +26 -0
  90. package/dist/core/generate/generate-file-mutants.js +47 -46
  91. package/dist/core/generate/get-mutant-site.d.ts +18 -0
  92. package/dist/core/generate/get-mutant-site.js +4 -0
  93. package/dist/core/generate/get-target.d.ts +14 -0
  94. package/dist/core/generate/get-target.js +4 -0
  95. package/dist/core/generate/pick-host.d.ts +10 -0
  96. package/dist/core/generate/pick-host.js +16 -0
  97. package/dist/core/generate/validate-replacement.d.ts +15 -4
  98. package/dist/core/generate/validate-replacement.js +28 -13
  99. package/dist/core/ignore/find-ignore-rule.d.ts +8 -7
  100. package/dist/core/instrument/find-attribute-values.d.ts +12 -0
  101. package/dist/core/instrument/find-attribute-values.js +13 -0
  102. package/dist/core/instrument/get-site-syntax.d.ts +14 -0
  103. package/dist/core/instrument/get-site-syntax.js +12 -0
  104. package/dist/core/instrument/group-mutant-ranges.d.ts +7 -3
  105. package/dist/core/instrument/group-mutant-ranges.js +25 -19
  106. package/dist/core/instrument/instrument-file.d.ts +5 -3
  107. package/dist/core/instrument/instrument-file.js +10 -9
  108. package/dist/core/instrument/instrumenter-version.d.ts +1 -1
  109. package/dist/core/instrument/render-branch.d.ts +17 -0
  110. package/dist/core/instrument/render-branch.js +81 -0
  111. package/dist/core/instrument/render-mutant-range.d.ts +17 -6
  112. package/dist/core/instrument/render-mutant-range.js +39 -13
  113. package/dist/core/list-mutants.d.ts +7 -5
  114. package/dist/core/list-mutants.js +2 -2
  115. package/dist/core/mutators/array-element.d.ts +7 -6
  116. package/dist/core/mutators/array-element.js +13 -13
  117. package/dist/core/mutators/assignment-operator.js +34 -33
  118. package/dist/core/mutators/boolean-literal.d.ts +3 -2
  119. package/dist/core/mutators/number-literal.d.ts +1 -1
  120. package/dist/core/mutators/object-property.d.ts +4 -3
  121. package/dist/core/mutators/object-property.js +7 -8
  122. package/dist/core/mutators/return-value.js +65 -33
  123. package/dist/core/mutators/shared/get-branch-copy-skip.d.ts +12 -7
  124. package/dist/core/mutators/shared/get-branch-copy-skip.js +34 -35
  125. package/dist/core/mutators/shared/get-canonical-falsy-default.d.ts +32 -0
  126. package/dist/core/mutators/shared/get-canonical-falsy-default.js +11 -0
  127. package/dist/core/mutators/shared/get-comparison-plan.js +86 -85
  128. package/dist/core/mutators/shared/get-condition-constants.d.ts +8 -8
  129. package/dist/core/mutators/shared/get-condition-constants.js +3 -3
  130. package/dist/core/mutators/shared/get-endless-value.d.ts +20 -0
  131. package/dist/core/mutators/shared/get-endless-value.js +25 -0
  132. package/dist/core/mutators/shared/get-forced-test-justifier.d.ts +44 -0
  133. package/dist/core/mutators/shared/get-forced-test-justifier.js +25 -0
  134. package/dist/core/mutators/shared/get-group-constant.d.ts +4 -4
  135. package/dist/core/mutators/shared/get-group-constant.js +2 -2
  136. package/dist/core/mutators/shared/get-literal-skip.d.ts +6 -6
  137. package/dist/core/mutators/shared/get-literal-skip.js +2 -2
  138. package/dist/core/mutators/shared/get-logical-drops.d.ts +8 -8
  139. package/dist/core/mutators/shared/get-logical-drops.js +80 -82
  140. package/dist/core/mutators/shared/get-owner-constant.d.ts +3 -1
  141. package/dist/core/mutators/shared/get-running-value.d.ts +5 -4
  142. package/dist/core/mutators/shared/get-toward-mutant.d.ts +10 -2
  143. package/dist/core/mutators/shared/get-toward-mutant.js +45 -40
  144. package/dist/core/mutators/shared/has-other-exit.js +16 -36
  145. package/dist/core/mutators/shared/is-loop-exit.d.ts +20 -0
  146. package/dist/core/mutators/shared/is-loop-exit.js +32 -0
  147. package/dist/core/mutators/shared/is-read-only.d.ts +26 -0
  148. package/dist/core/mutators/shared/is-read-only.js +53 -0
  149. package/dist/core/mutators/statement-removal.d.ts +4 -3
  150. package/dist/core/mutators/statement-removal.js +69 -73
  151. package/dist/core/mutators/string-literal.d.ts +15 -5
  152. package/dist/core/mutators/string-literal.js +79 -50
  153. package/dist/core/presets/recommended.d.ts +2 -2
  154. package/dist/core/presets/strict.d.ts +4 -2
  155. package/dist/core/run/apply-batch-result.d.ts +23 -22
  156. package/dist/core/run/apply-batch-result.js +5 -5
  157. package/dist/core/run/apply-isolated-result.d.ts +18 -17
  158. package/dist/core/run/apply-isolated-result.js +1 -0
  159. package/dist/core/run/classify-try.d.ts +9 -8
  160. package/dist/core/run/get-test-file-limits.d.ts +13 -0
  161. package/dist/core/run/get-test-file-limits.js +13 -0
  162. package/dist/core/run/get-unit-evidence.d.ts +6 -3
  163. package/dist/core/run/get-unit-evidence.js +1 -1
  164. package/dist/core/run/plan-batch.d.ts +6 -3
  165. package/dist/core/run/plan-batch.js +36 -31
  166. package/dist/core/run/plan-isolated.d.ts +3 -1
  167. package/dist/core/run/plan-isolated.js +8 -14
  168. package/dist/core/run/read-isolated-unit.d.ts +4 -4
  169. package/dist/core/run/run-batch-phases.d.ts +4 -3
  170. package/dist/core/run/run-dry-phase.d.ts +35 -19
  171. package/dist/core/run/run-dry-phase.js +127 -77
  172. package/dist/core/run/run-isolated-rounds.d.ts +6 -5
  173. package/dist/core/run/run-isolated-rounds.js +1 -0
  174. package/dist/core/run-mutants.d.ts +26 -21
  175. package/dist/core/run-mutants.js +72 -64
  176. package/dist/core/runtime/create-hit-limit-error.d.ts +5 -3
  177. package/dist/core/runtime/create-hit-limit-error.js +1 -1
  178. package/dist/core/runtime/install-mutant-runtime.js +23 -6
  179. package/dist/core/runtime/runtime-version.d.ts +4 -4
  180. package/dist/core/skips/skip-rules.d.ts +4 -0
  181. package/dist/core/skips/skip-rules.js +4 -0
  182. package/dist/core/syntax/is-brace-sensitive-attribute.d.ts +18 -0
  183. package/dist/core/syntax/is-brace-sensitive-attribute.js +28 -0
  184. package/dist/core/syntax/is-spread-safe-member.d.ts +18 -0
  185. package/dist/core/syntax/is-spread-safe-member.js +18 -0
  186. package/dist/core/syntax/is-value-position.d.ts +3 -1
  187. package/dist/core/text/get-list-removal-range.d.ts +22 -0
  188. package/dist/core/text/get-list-removal-range.js +46 -0
  189. package/dist/core/text/is-plain-attribute-string.d.ts +10 -0
  190. package/dist/core/text/is-plain-attribute-string.js +5 -0
  191. package/dist/core/text/parse-expression.d.ts +8 -4
  192. package/dist/core/text/parse-expression.js +1 -0
  193. package/dist/core/text/remove-list-element.d.ts +2 -4
  194. package/dist/core/text/remove-list-element.js +4 -45
  195. package/dist/docs/styles/colors.js +1 -1
  196. package/dist/package.js +1 -1
  197. package/dist/types/adapter/dry-file.d.ts +2 -1
  198. package/dist/types/adapter/dry-run-request.d.ts +5 -4
  199. package/dist/types/adapter/mutant-runtime.d.ts +30 -1
  200. package/dist/types/cli/text-style.d.ts +1 -1
  201. package/dist/types/config/preset-settings.d.ts +2 -2
  202. package/dist/types/config/run-config.d.ts +12 -4
  203. package/dist/types/html/indexed-mutant.d.ts +4 -2
  204. package/dist/types/html/shown-change.d.ts +4 -3
  205. package/dist/types/mutant/list-removal.d.ts +37 -0
  206. package/dist/types/mutant/mutant-candidate.d.ts +11 -17
  207. package/dist/types/mutant/mutant-host.d.ts +49 -0
  208. package/dist/types/mutant/mutant-kind.d.ts +18 -0
  209. package/dist/types/mutant/mutant-range.d.ts +15 -8
  210. package/dist/types/mutant/mutant.d.ts +9 -15
  211. package/dist/types/mutant/site-syntax.d.ts +14 -0
  212. package/dist/types/mutant/skip-justifier.d.ts +3 -1
  213. package/dist/types/mutant/skipped-candidate.d.ts +13 -10
  214. package/dist/types/mutant/skipped-mutant.d.ts +9 -6
  215. package/dist/types/mutator/replacement.d.ts +14 -3
  216. package/dist/types/report/html-report.d.ts +10 -7
  217. package/dist/types/report/list-report-focus.d.ts +3 -2
  218. package/dist/types/report/list-report-justifier.d.ts +4 -2
  219. package/dist/types/report/list-report-mutant.d.ts +15 -9
  220. package/dist/types/report/list-report-skipped.d.ts +3 -2
  221. package/dist/types/report/list-report.d.ts +1 -1
  222. package/dist/types/report/run-report.d.ts +2 -2
  223. package/dist/types/report/slim-list-report.d.ts +6 -3
  224. package/dist/types/report/slim-run-report.d.ts +1 -1
  225. package/dist/types/run/isolated-reason.d.ts +4 -3
  226. package/dist/types/run/mutant-state.d.ts +1 -1
  227. package/dist/types/run/run-event.d.ts +1 -1
  228. package/dist/types/run/run-kind.d.ts +3 -2
  229. package/dist/types/run/run-result.d.ts +6 -3
  230. package/dist/types/run/run-state.d.ts +9 -1
  231. package/dist/types/run/run-status.d.ts +2 -2
  232. package/dist/types/run/try-cause.d.ts +8 -6
  233. package/dist/types/syntax/syntax-helpers.d.ts +5 -3
  234. package/package.json +5 -5
  235. package/skills/mootant/SKILL.md +14 -12
  236. package/skills/mootant/references/mutators.md +3 -1
  237. package/dist/core/instrument/get-site-check.d.ts +0 -9
  238. package/dist/core/instrument/get-site-check.js +0 -5
  239. package/dist/core/instrument/get-template-site-check.d.ts +0 -12
  240. package/dist/core/instrument/get-template-site-check.js +0 -5
  241. /package/dist/cli/{built-in-adapters.d.ts → get-built-in-adapters.d.ts} +0 -0
  242. /package/dist/cli/{built-in-adapters.js → get-built-in-adapters.js} +0 -0
  243. /package/dist/cli/terminal/{colors.d.ts → create-colors.d.ts} +0 -0
  244. /package/dist/cli/terminal/{colors.js → create-colors.js} +0 -0
@@ -26,18 +26,18 @@ interface DryFileReport {
26
26
  * ids of tests hold the project, or the core keys the tests of two projects as
27
27
  * one. Per-test coverage is wrong in a file with concurrent tests, as their
28
28
  * bodies interleave, so the file holds what ran while it loaded and every try
29
- * what ran after that. Covers stay on a file that failed to load, as an empty
30
- * list would make the core drop every switched file. A tracker error fails the
31
- * file, as the `try` it lost would leave a test out with no word. A failed
32
- * `beforeAll` fails the tests under it, as in plain Jest, which forgives it
33
- * when they pass on retry or are all `test.todo`, so the file says nothing of
34
- * it. A snapshot no test checked, such as one of a deleted test, or one that
35
- * failed in a test that still passed, fails a plain run of Jest with every test
36
- * passing, so then it fails the file; next to a failed test, that test tells
37
- * it. What the file depended on comes from the `finish` record
38
- * (`collectJestDependencies`), and so do the variables the code read and the
39
- * files it read and changed itself, whose contents the cache then compares, as
40
- * their times say nothing of edits.
29
+ * what ran after that. Covers stay on a file that failed to load, as they are
30
+ * what the core can blame when it cannot tell what the file depends on, instead
31
+ * of every switched file. A tracker error fails the file, as the `try` it lost
32
+ * would leave a test out with no word. A failed `beforeAll` fails the tests
33
+ * under it, as in plain Jest, which forgives it when they pass on retry or are
34
+ * all `test.todo`, so the file says nothing of it. A snapshot no test checked,
35
+ * such as one of a deleted test, or one that failed in a test that still
36
+ * passed, fails a plain run of Jest with every test passing, so then it fails
37
+ * the file; next to a failed test, that test tells it. What the file depended
38
+ * on comes from the `finish` record (`collectJestDependencies`), and so do the
39
+ * variables the code read and the files it read and changed itself, whose
40
+ * contents the cache then compares, as their times say nothing of edits.
41
41
  *
42
42
  * @param outcome - What the unit left behind.
43
43
  * @param input - Test file, project and root.
@@ -9,13 +9,14 @@ import { JestTimedRecord } from './types/jest-timed-record.js';
9
9
  * beside it, whether it exists or not. The file a custom snapshot resolver
10
10
  * gives is among the reads, as Jest looks for it when the unit starts. The
11
11
  * worker leaves out of the reads what is under `node_modules`, which the
12
- * lockfile stands for, mootant's own files, what Jest's resolver read, as a
13
- * real load is read anyway, and what only the transformers, the test
14
- * environment and the test runner in their own calls, or a project's own
15
- * resolver read, which every verdict depends on: through `getJestCacheInputs`
16
- * when a dry run read it, a missing file there only when named as a
17
- * configuration file (`isTransformInput`), else through `state.lateTransforms`,
18
- * which `runIsolated` adds.
12
+ * lockfile stands for, mootant's own files and, outside the directories of the
13
+ * session, the root itself and what `createInputFilter` leaves out, what Jest's
14
+ * resolver read, as a real load is read anyway, and what only the transformers,
15
+ * the test environment and the test runner in their own calls, or a project's
16
+ * own resolver read, which every verdict depends on: through
17
+ * `getJestCacheInputs` when a dry run read it, a missing file there only when
18
+ * named as a configuration file (`isTransformInput`), else through
19
+ * `state.lateTransforms`, which `runIsolated` adds.
19
20
  *
20
21
  * @param records - Records of the unit.
21
22
  * @param file - Absolute path of the test file.
@@ -4,7 +4,7 @@ import { HostTest } from './types/host-test.js';
4
4
  * The host's `--runner`. Jest loads it once it has read its configuration,
5
5
  * built the haste map and run global setup.
6
6
  */
7
- export default class MootantHostRunner {
7
+ export default class Runner {
8
8
  /**
9
9
  * Parks Jest until mootant asks to close or goes away.
10
10
  */
@@ -1,2 +1,2 @@
1
- var e = "// adapters/jest/runner.ts\n/**\n* The host's `--runner`. Jest loads it once it has read its configuration,\n* built the haste map and run global setup.\n*/\nvar MootantHostRunner = class {\n /**\n * Parks Jest until mootant asks to close or goes away.\n */\n runTests;\n /**\n * Tells Jest this runner has no workers of its own; Jest only passes this on\n * as `serial`, which this runner ignores.\n */\n isSerial = true;\n /**\n * Keeps the global configuration for `ready`.\n *\n * @param globalConfig - Global configuration Jest resolved.\n */\n constructor(globalConfig) {\n this.runTests = (tests) => parkHost(tests, globalConfig);\n }\n};\n/**\n* Sends what workers need to know and waits; once this returns, Jest runs\n* global teardown. Listeners are installed here only, because a listener keeps\n* the channel, and with it a host that never gets here, alive. A channel that\n* closed before Jest got here ends the wait at once, so teardown runs then\n* too.\n*\n* @param tests - Every test file Jest would run, of every project.\n* @param globalConfig - Global configuration Jest resolved.\n* @returns A promise that resolves on `close` or when the channel closes.\n*/\nfunction parkHost(tests, globalConfig) {\n return new Promise((resolve) => {\n if (!process.connected) {\n resolve();\n return;\n }\n process.on(\"disconnect\", resolve);\n process.on(\"message\", (message) => {\n if (message.type === \"close\") resolve();\n });\n let ready = {\n moduleMaps: Object.fromEntries(tests.map((test) => [test.context.config.id, test.context.moduleMap.toJSON()])),\n configs: Object.fromEntries(tests.map((test) => [test.context.config.id, test.context.config])),\n tests: tests.map((test) => ({\n project: test.context.config.id,\n path: test.path\n })),\n env: process.env,\n loaded: Object.keys(require.cache),\n umask: process.umask(),\n cwd: process.cwd(),\n type: \"ready\",\n globalConfig\n };\n process.send(ready);\n });\n}\nmodule.exports = MootantHostRunner;\n";
1
+ var e = "// adapters/jest/runner.ts\n/**\n* The host's `--runner`. Jest loads it once it has read its configuration,\n* built the haste map and run global setup.\n*/\nvar Runner = class {\n /**\n * Parks Jest until mootant asks to close or goes away.\n */\n runTests;\n /**\n * Tells Jest this runner has no workers of its own; Jest only passes this on\n * as `serial`, which this runner ignores.\n */\n isSerial = true;\n /**\n * Keeps the global configuration for `ready`.\n *\n * @param globalConfig - Global configuration Jest resolved.\n */\n constructor(globalConfig) {\n this.runTests = (tests) => parkHost(tests, globalConfig);\n }\n};\n/**\n* Sends what workers need to know and waits; once this returns, Jest runs\n* global teardown. Listeners are installed here only, because a listener keeps\n* the channel, and with it a host that never gets here, alive. A channel that\n* closed before Jest got here ends the wait at once, so teardown runs then\n* too.\n*\n* @param tests - Every test file Jest would run, of every project.\n* @param globalConfig - Global configuration Jest resolved.\n* @returns A promise that resolves on `close` or when the channel closes.\n*/\nfunction parkHost(tests, globalConfig) {\n return new Promise((resolve) => {\n if (!process.connected) {\n resolve();\n return;\n }\n process.on(\"disconnect\", resolve);\n process.on(\"message\", (message) => {\n if (message.type === \"close\") resolve();\n });\n let ready = {\n moduleMaps: Object.fromEntries(tests.map((test) => [test.context.config.id, test.context.moduleMap.toJSON()])),\n configs: Object.fromEntries(tests.map((test) => [test.context.config.id, test.context.config])),\n tests: tests.map((test) => ({\n project: test.context.config.id,\n path: test.path\n })),\n env: process.env,\n loaded: Object.keys(require.cache),\n umask: process.umask(),\n cwd: process.cwd(),\n type: \"ready\",\n globalConfig\n };\n process.send(ready);\n });\n}\nmodule.exports = Runner;\n";
2
2
  export { e as default };
@@ -105,10 +105,10 @@ export type JestRecord =
105
105
 
106
106
  /**
107
107
  * Files and directories the code read that count, sorted: under the
108
- * project root or a project's directories, or with an extension of a
109
- * module or a snapshot outside the temporary directory, never under
110
- * `node_modules` or mootant's files. Neither what the resolver read nor
111
- * what only a transformer read is among them.
108
+ * project root or a project's directories, and elsewhere as
109
+ * `createInputFilter` tells, never under `node_modules` or in mootant's
110
+ * files, nor as the root itself outside those directories. Neither what
111
+ * the resolver read nor what only a transformer read is among them.
112
112
  */
113
113
  reads: string[]
114
114
 
@@ -14,21 +14,29 @@ export interface UnitWorker {
14
14
  */
15
15
  reads: {
16
16
  /**
17
- * Extensions, without the dot, of the files that count wherever they are
18
- * but in a temporary directory.
17
+ * Absolute directories whose files count, even those that hold the root.
19
18
  */
20
- extensions: ReadonlySet<string>
19
+ directories: readonly string[]
21
20
 
22
21
  /**
23
- * Absolute directories whose files count.
22
+ * Tells whether a path outside the directories counts
23
+ * (`createInputFilter`).
24
24
  */
25
- directories: readonly string[]
25
+ inputs(file: string): boolean
26
+
27
+ /**
28
+ * Modules of the own realm of the worker that a unit wrote itself, such as
29
+ * a helper a test environment wrote in a directory of `mkdtemp`: they stay
30
+ * out of the loaded modules of every later unit too, as the module cache of
31
+ * the worker keeps them.
32
+ */
33
+ own: Set<string>
26
34
 
27
35
  /**
28
- * The temporary directory as Node gives it and, when it exists, as its real
29
- * path, whose files count only under a directory of the session.
36
+ * Real path of the project root, which itself counts only under one of the
37
+ * directories.
30
38
  */
31
- temporary: readonly string[]
39
+ root: string
32
40
  }
33
41
 
34
42
  /**
@@ -12,18 +12,17 @@ export interface WorkerSession {
12
12
  */
13
13
  reads: {
14
14
  /**
15
- * Absolute directories whose files count: the real path of the project
16
- * root, and the `rootDir` and `roots` of every project.
15
+ * Absolute directories whose files count, even those that hold the root:
16
+ * the real path of the project root, and the `rootDir` and `roots` of every
17
+ * project.
17
18
  */
18
19
  directories: string[]
19
20
 
20
21
  /**
21
- * Extensions, without the dot, of the files that count wherever they are
22
- * but in the temporary directory: the `moduleFileExtensions` of every
23
- * project, and `snap`, since a custom snapshot resolver may put a snapshot
24
- * file anywhere.
22
+ * Real path of the project root, which itself counts only under one of the
23
+ * directories.
25
24
  */
26
- extensions: string[]
25
+ root: string
27
26
  }
28
27
 
29
28
  /**
@@ -14,9 +14,10 @@ import { WorkerProcess } from '../types/worker-process.js';
14
14
  * what it gets in plain Jest. Types are stripped only where the project's Jest
15
15
  * strips them, which needs Node's function. One count of the calls into the
16
16
  * resolvers and transformers of the projects serves every unit, which tells
17
- * what they read apart from what tests read. The temporary directory, as Node
18
- * gives it and as its real path, is where tests put what they make, under a new
19
- * name each run.
17
+ * what they read apart from what tests read. Which reads count outside the
18
+ * directories of the session is decided by the work directory, the one that
19
+ * holds the directory of `session.json`, and the project root
20
+ * (`createInputFilter`), taken here, before any unit runs.
20
21
  *
21
22
  * @param input - What the worker runs with.
22
23
  * @param input.process - The worker's process, with `MOOTANT_SESSION`, the
@@ -23,25 +23,27 @@ import { JestUnit } from '../types/jest-unit.js';
23
23
  * messages, as tests may read them. What the console kept is emptied once
24
24
  * `finish` is written, since with `--experimental-vm-modules` the vm of every
25
25
  * unit, its console with it, stays in the worker. A read counts under the
26
- * directories of the session, or with one of its extensions outside the
27
- * temporary directory, where tests make files under new names each run, but
26
+ * directories of the session, and elsewhere as `createInputFilter` tells, but
28
27
  * never under `node_modules`, which the lockfile stands for, in mootant's
29
- * files, or as a `node:` name that a stack frame gave and the tracker made a
30
- * path of. What Jest's resolver reads does not count, as it keeps what it found
31
- * across units and a real load is read anyway, but what a project's own
32
- * resolver reads, a file it only looks for too, decides what it gives, Jest's
33
- * default one aside when it hands that a request
34
- * (`WorkerCalls.defaultResolver`); that and what a transformer reads go apart,
35
- * as the session's, since a warm worker reads them only once, and stay among
36
- * the reads too when code outside the transformers read them, as a test file
37
- * loads a source the language service of ts-jest read first. The CommonJS
38
- * modules the own realm of the worker loaded so far count as reads do, since a
39
- * warm worker does not read a transformer, a test environment or a resolver
40
- * again, nor what they import; ES modules are not in `require.cache`, so one of
41
- * those counts only in the unit that loaded it. A transform still running when
42
- * the run ended, of an import the unit never awaited, ends the worker: what it
43
- * reads from then on reaches no unit, and a later unit would get the module
44
- * from the worker's memory.
28
+ * files, as a `node:` name that a stack frame gave and the tracker made a path
29
+ * of, or as the project root itself outside the directories of the session,
30
+ * which Babel and Browserslist look through in every worker, while its names
31
+ * change with whatever appears beside the project's own files. What Jest's
32
+ * resolver reads does not count, as it keeps what it found across units and a
33
+ * real load is read anyway, but what a project's own resolver reads, a file it
34
+ * only looks for too, decides what it gives, Jest's default one aside when it
35
+ * hands that a request (`WorkerCalls.defaultResolver`); that and what a
36
+ * transformer reads go apart, as the session's, since a warm worker reads them
37
+ * only once, and stay among the reads too when code outside the transformers
38
+ * read them, as a test file loads a source the language service of ts-jest read
39
+ * first. The CommonJS modules the own realm of the worker loaded so far count
40
+ * as reads do, since a warm worker does not read a transformer, a test
41
+ * environment or a resolver again, nor what they import, but not one that this
42
+ * or an earlier unit of the worker wrote itself (`UnitWorker.reads.own`); ES
43
+ * modules are not in `require.cache`, so one of those counts only in the unit
44
+ * that loaded it. A transform still running when the run ended, of an import
45
+ * the unit never awaited, ends the worker: what it reads from then on reaches
46
+ * no unit, and a later unit would get the module from the worker's memory.
45
47
  *
46
48
  * @param unit - Test file, project, mutant, switch plan and out file.
47
49
  * @param worker - What the boot of the worker made.
@@ -1,2 +1,2 @@
1
- var e = "// core/runtime/create-hit-limit-error.ts\n/**\n* Error that stops a try whose code evaluated more mutant sites than allowed.\n*/\nvar MootantHitLimitError = class extends Error {\n /**\n * Name that tells the error apart, even across realms.\n */\n name = \"MootantHitLimitError\";\n};\n/**\n* Creates the error that stops a try whose code evaluated more mutant sites\n* than its hit limit allows, such as a loop that a mutant made endless.\n*\n* @param id - Id of the mutant whose site went over the limit.\n* @param limit - Site evaluations the try was allowed.\n* @returns Error named `MootantHitLimitError`.\n*/\nfunction createHitLimitError(id, limit) {\n return new MootantHitLimitError(`mootant stopped the test after ${limit} evaluations of mutant sites, at mutant ${id}; the code is likely stuck in a loop.`);\n}\n// core/runtime/runtime-symbol-key.ts\n/**\n* Key of the registered symbol under which `Math` holds the mutant runtime:\n* `Math[Symbol.for('mootant')]`. Vue templates reach the runtime there, since\n* the Vue compiler reads every other global name, `globalThis` included, as a\n* property of the component, but leaves `Math` and `Symbol` alone.\n*/\nvar RUNTIME_SYMBOL_KEY = \"mootant\";\n// core/runtime/runtime-global.ts\n/**\n* Name of the global through which switched code reaches the mutant runtime:\n* `globalThis.__mootant`.\n*/\nvar RUNTIME_GLOBAL = \"__mootant\";\n// core/runtime/install-mutant-runtime.ts\n/**\n* Installs the mutant runtime as `globalThis.__mootant`, where switched code\n* calls `hit` at every mutant site, and as `Math[Symbol.for('mootant')]`, where\n* switched Vue templates call it. The property of `Math` is not enumerable, and\n* `Object.getOwnPropertyNames(Math)` does not list a symbol key, so code that\n* walks `Math` does not see it. A runtime already installed in the process is\n* returned as is, since switched code may already hold it. A new runtime starts\n* with the original code active, no coverage and no hit limit.\n*\n* @returns The runtime of the process.\n*/\nfunction installMutantRuntime() {\n let runtime = Reflect.get(globalThis, \"__mootant\") ?? createRuntime();\n Reflect.set(globalThis, RUNTIME_GLOBAL, runtime);\n Object.defineProperty(Math, Symbol.for(RUNTIME_SYMBOL_KEY), {\n configurable: true,\n enumerable: false,\n value: runtime,\n writable: true\n });\n return runtime;\n}\n/**\n* Creates a runtime with the original code active, no coverage and no hit\n* limit.\n*\n* @returns The new runtime.\n*/\nfunction createRuntime() {\n let runtime = {\n hit(id) {\n runtime.hits += 1;\n if (runtime.hits > runtime.hitLimit) throw createHitLimitError(id, runtime.hitLimit);\n if (runtime.coverage !== null) runtime.coverage.add(id);\n if (runtime.active === id) {\n runtime.reached = true;\n return true;\n }\n return false;\n },\n hitLimit: Infinity,\n coverage: null,\n reached: false,\n active: null,\n hits: 0\n };\n return runtime;\n}\n// adapters/shared/environment-slot.ts\n/**\n* Global slot of the tracking state of the process; a tracking proxy answers\n* that it has this key, which tells it from a plain object.\n*/\nvar ENVIRONMENT_SLOT = Symbol.for(\"mootant.environment\");\n// adapters/shared/create-environment-proxy.ts\n/**\n* Wraps an object of environment variables in a proxy that reports to the\n* receiver of the state the names read and `*` when they are listed. The fields\n* of the state are read at every trap, since their owner replaces them later.\n*\n* @param target - Object to wrap.\n* @param state - Tracking state; `listing` is written here too.\n* @returns The proxy; it answers that it has `ENVIRONMENT_SLOT`, so a caller\n* can tell it from a plain object.\n*/\nfunction createEnvironmentProxy(target, state) {\n let schedule = queueMicrotask;\n /**\n * Reports a variable read by its name.\n *\n * @param name - Property key read.\n */\n function report(name) {\n if (typeof name === \"string\" && !state.listing && !state.ignored.has(name)) state.record?.(name);\n }\n return new Proxy(target, {\n ownKeys: (object) => {\n state.record?.(\"*\");\n if (!state.listing) {\n state.listing = true;\n schedule(() => {\n state.listing = false;\n });\n }\n return Reflect.ownKeys(object);\n },\n getOwnPropertyDescriptor: (object, name) => {\n report(name);\n return Reflect.getOwnPropertyDescriptor(object, name);\n },\n has: (object, name) => {\n report(name);\n return name === ENVIRONMENT_SLOT || Reflect.has(object, name);\n },\n get: (object, name) => {\n report(name);\n return Reflect.get(object, name);\n },\n set: (object, name, value) => Reflect.set(object, name, value)\n });\n}\n// adapters/jest/worker/install-vm-side.ts\n/**\n* Timer functions of a vm, each with the function that clears its handles.\n*/\nvar TIMERS = [\n [\"setTimeout\", \"clearTimeout\"],\n [\"setInterval\", \"clearInterval\"],\n [\"setImmediate\", \"clearImmediate\"]\n];\n/**\n* Sets up a test's vm before any project code, and registers on the channel\n* what the worker reads and stops once the unit ended; it registers last, so a\n* worker that sees no side knows the setup never ran. The file does not change\n* how a timer behaves, and fake timers pass around the wrappers. Nothing is\n* ignored in the environment: Node's loader reads the real `process.env`, not\n* this one.\n*\n* @param input - What the setup works with.\n*/\nfunction installVmSide(input) {\n let { channel, install, target } = input;\n let { token } = channel;\n let unit = channel.unit;\n Reflect.deleteProperty(target, RUNTIME_GLOBAL);\n let runtime = install();\n Object.defineProperty(target, RUNTIME_GLOBAL, {\n configurable: true,\n enumerable: false,\n value: runtime,\n writable: true\n });\n Reflect.set(runtime, Symbol.for(\"$$jest-protect-from-deletion\"), true);\n let { hit } = runtime;\n let reached = false;\n let closed = false;\n runtime.hit = (id) => {\n if (closed) return false;\n let active = hit(id);\n if (active && !reached) {\n reached = true;\n channel.write(token, {\n hits: runtime.hits,\n kind: \"reached\"\n });\n }\n return active;\n };\n let stops = [];\n for (let names of TIMERS) wrapTimer(target, names, stops);\n let seen = /* @__PURE__ */ new Set();\n target.process.env = createEnvironmentProxy(target.process.env, {\n record: (name) => {\n seen.add(name);\n },\n ignored: /* @__PURE__ */ new Set(),\n listing: false\n });\n runtime.active = unit.mutant;\n runtime.hitLimit = unit.hitLimit ?? Infinity;\n runtime.coverage = unit.mutant === null ? /* @__PURE__ */ new Set() : null;\n channel.vm = {\n stopTimers() {\n for (let stop of stops.splice(0)) stop();\n },\n addVariable(name) {\n seen.add(name);\n },\n close() {\n closed = true;\n },\n listVariables: () => [...seen],\n realmError: target.Error,\n isReached: () => reached,\n runtime\n };\n}\n/**\n* Replaces a timer function of the vm, if it has it (jsdom has no\n* `setImmediate`) and the function that clears its handles, with one that\n* remembers how to clear each handle and keeps the original's own properties,\n* above all `util.promisify.custom`.\n*\n* @param target - The vm's `globalThis`.\n* @param names - Names of the function and of the one that clears its handles.\n* @param stops - Receives a function that clears each handle.\n*/\nfunction wrapTimer(target, names, stops) {\n let [startName, clearName] = names;\n let start = Reflect.get(target, startName);\n let clear = Reflect.get(target, clearName);\n if (start === void 0 || clear === void 0) return;\n /**\n * Starts the timer and remembers its handle.\n *\n * @param parameters - Arguments of the call.\n * @returns The handle.\n */\n function wrapper(...parameters) {\n let handle = start.apply(this, parameters);\n stops.push(() => {\n clear.call(target, handle);\n });\n return handle;\n }\n let { prototype, length, name, ...own } = Object.getOwnPropertyDescriptors(start);\n Object.defineProperties(wrapper, own);\n Reflect.set(target, startName, wrapper);\n}\n// adapters/jest/worker/channel-slot.ts\n/**\n* Key of the worker's channel on `process`: a test's vm gets a copy of it that\n* holds what a symbol key holds as it is, so the vm reaches the same object,\n* and the bundle of the vm's setup has no module in common with the worker's.\n*/\nvar CHANNEL_SLOT = Symbol.for(\"mootant.channel\");\n// adapters/jest/worker/vm-setup.ts\n/**\n* First of a project's `setupFiles`. It runs inside the test's vm, where\n* `require` goes through `moduleNameMapper` and automock, so neither this file\n* nor what it imports has a `node:` import. The channel comes on the vm's\n* `process`, since Jest 30.5 sends `process.getBuiltinModule` through\n* `moduleNameMapper` as well.\n*/\ninstallVmSide({\n channel: Reflect.get(process, CHANNEL_SLOT),\n install: installMutantRuntime,\n target: globalThis\n});\n";
1
+ var e = "// core/runtime/create-hit-limit-error.ts\n/**\n* Error that stops a try whose code evaluated more mutant sites than allowed.\n*/\nvar MootantHitLimitError = class extends Error {\n /**\n * Name that tells the error apart, even across realms.\n */\n name = \"MootantHitLimitError\";\n};\n/**\n* Creates the error that stops a batch try, or a test file run with a mutant,\n* whose code evaluated more mutant sites than allowed: a loop that a mutant\n* made endless, or code that a mutant made far hotter, such as a cache turned\n* off.\n*\n* @param id - Id of the mutant whose site went over the limit.\n* @param limit - Site evaluations allowed.\n* @returns Error named `MootantHitLimitError`.\n*/\nfunction createHitLimitError(id, limit) {\n return new MootantHitLimitError(`mootant stopped the test after ${limit} evaluations of mutant sites, at mutant ${id}; the code may loop endlessly or do far more work than without mutants (see run.hitLimit).`);\n}\n// core/runtime/runtime-symbol-key.ts\n/**\n* Key of the registered symbol under which `Math` holds the mutant runtime:\n* `Math[Symbol.for('mootant')]`. Vue templates reach the runtime there, since\n* the Vue compiler reads every other global name, `globalThis` included, as a\n* property of the component, but leaves `Math` and `Symbol` alone.\n*/\nvar RUNTIME_SYMBOL_KEY = \"mootant\";\n// core/runtime/runtime-global.ts\n/**\n* Name of the global through which switched code reaches the mutant runtime:\n* `globalThis.__mootant`.\n*/\nvar RUNTIME_GLOBAL = \"__mootant\";\n// core/runtime/install-mutant-runtime.ts\n/**\n* Installs the mutant runtime as `globalThis.__mootant`, where switched code\n* calls `hit` at every mutant site, and as `Math[Symbol.for('mootant')]`, where\n* switched Vue templates call it. The property of `Math` is not enumerable, and\n* `Object.getOwnPropertyNames(Math)` does not list a symbol key, so code that\n* walks `Math` does not see it. A runtime already installed in the process is\n* returned as is, since switched code may already hold it. A new runtime starts\n* with the original code active, no coverage and no hit limit.\n*\n* @returns The runtime of the process.\n*/\nfunction installMutantRuntime() {\n let runtime = Reflect.get(globalThis, \"__mootant\") ?? createRuntime();\n Reflect.set(globalThis, RUNTIME_GLOBAL, runtime);\n Object.defineProperty(Math, Symbol.for(RUNTIME_SYMBOL_KEY), {\n configurable: true,\n enumerable: false,\n value: runtime,\n writable: true\n });\n return runtime;\n}\n/**\n* Creates a runtime with the original code active, no coverage and no hit\n* limit. Its helpers for the removal of array elements use index loops over\n* arrays the switched code builds, never an array iterator or a method of the\n* array prototype, which tests may replace.\n*\n* @returns The new runtime.\n*/\nfunction createRuntime() {\n let gap = Symbol(\"mootant gap\");\n let runtime = {\n hit(id) {\n runtime.hits += 1;\n if (runtime.hits > runtime.hitLimit) throw createHitLimitError(id, runtime.hitLimit);\n if (runtime.coverage !== null) runtime.coverage.add(id);\n if (runtime.active === id) {\n runtime.reached = true;\n return true;\n }\n return false;\n },\n hitAny(ids) {\n for (let index = 0; index < ids.length; index++) if (runtime.hit(ids[index])) return true;\n return false;\n },\n cut(array) {\n let kept = 0;\n for (let index = 0; index < array.length; index++) {\n let value = array[index];\n if (value !== gap) {\n array[kept] = value;\n kept += 1;\n }\n }\n array.length = kept;\n return array;\n },\n none: { [Symbol.iterator]: () => ({ next: () => ({\n value: void 0,\n done: true\n }) }) },\n hitLimit: Infinity,\n coverage: null,\n reached: false,\n active: null,\n hits: 0,\n gap\n };\n return runtime;\n}\n// adapters/shared/environment-slot.ts\n/**\n* Global slot of the tracking state of the process; a tracking proxy answers\n* that it has this key, which tells it from a plain object.\n*/\nvar ENVIRONMENT_SLOT = Symbol.for(\"mootant.environment\");\n// adapters/shared/create-environment-proxy.ts\n/**\n* Wraps an object of environment variables in a proxy that reports to the\n* receiver of the state the names read and `*` when they are listed. The fields\n* of the state are read at every trap, since their owner replaces them later.\n*\n* @param target - Object to wrap.\n* @param state - Tracking state; `listing` is written here too.\n* @returns The proxy; it answers that it has `ENVIRONMENT_SLOT`, so a caller\n* can tell it from a plain object.\n*/\nfunction createEnvironmentProxy(target, state) {\n /**\n * A test's fake timers replace the global after this.\n */\n let schedule = queueMicrotask;\n /**\n * Reports a variable read by its name.\n *\n * @param name - Property key read.\n */\n function report(name) {\n if (typeof name === \"string\" && !state.listing && !state.ignored.has(name)) state.record?.(name);\n }\n return new Proxy(target, {\n ownKeys: (object) => {\n state.record?.(\"*\");\n if (!state.listing) {\n state.listing = true;\n schedule(() => {\n state.listing = false;\n });\n }\n return Reflect.ownKeys(object);\n },\n getOwnPropertyDescriptor: (object, name) => {\n report(name);\n return Reflect.getOwnPropertyDescriptor(object, name);\n },\n has: (object, name) => {\n report(name);\n return name === ENVIRONMENT_SLOT || Reflect.has(object, name);\n },\n get: (object, name) => {\n report(name);\n return Reflect.get(object, name);\n },\n set: (object, name, value) => Reflect.set(object, name, value)\n });\n}\n// adapters/jest/worker/install-vm-side.ts\n/**\n* Timer functions of a vm, each with the function that clears its handles.\n*/\nvar TIMERS = [\n [\"setTimeout\", \"clearTimeout\"],\n [\"setInterval\", \"clearInterval\"],\n [\"setImmediate\", \"clearImmediate\"]\n];\n/**\n* Sets up a test's vm before any project code, and registers on the channel\n* what the worker reads and stops once the unit ended; it registers last, so a\n* worker that sees no side knows the setup never ran. The file does not change\n* how a timer behaves, and fake timers pass around the wrappers. Nothing is\n* ignored in the environment: Node's loader reads the real `process.env`, not\n* this one.\n*\n* @param input - What the setup works with.\n*/\nfunction installVmSide(input) {\n let { channel, install, target } = input;\n let { token } = channel;\n let unit = channel.unit;\n /**\n * Jest's node environment copies the worker's globals as it loads, the stub\n * in `__mootant` too, and `install` would keep that as a runtime.\n */\n Reflect.deleteProperty(target, RUNTIME_GLOBAL);\n let runtime = install();\n Object.defineProperty(target, RUNTIME_GLOBAL, {\n configurable: true,\n enumerable: false,\n value: runtime,\n writable: true\n });\n /**\n * Jest 30's cleanup of a vm's globals spares what carries this mark.\n */\n Reflect.set(runtime, Symbol.for(\"$$jest-protect-from-deletion\"), true);\n let { hit } = runtime;\n let reached = false;\n let closed = false;\n runtime.hit = (id) => {\n if (closed) return false;\n let active = hit(id);\n if (active && !reached) {\n reached = true;\n /**\n * The only durable proof of a reach, so it cannot wait.\n */\n channel.write(token, {\n hits: runtime.hits,\n kind: \"reached\"\n });\n }\n return active;\n };\n let stops = [];\n for (let names of TIMERS) wrapTimer(target, names, stops);\n let seen = /* @__PURE__ */ new Set();\n target.process.env = createEnvironmentProxy(target.process.env, {\n record: (name) => {\n seen.add(name);\n },\n ignored: /* @__PURE__ */ new Set(),\n listing: false\n });\n runtime.active = unit.mutant;\n runtime.hitLimit = unit.hitLimit ?? Infinity;\n runtime.coverage = unit.mutant === null ? /* @__PURE__ */ new Set() : null;\n channel.vm = {\n stopTimers() {\n for (let stop of stops.splice(0)) stop();\n },\n addVariable(name) {\n seen.add(name);\n },\n close() {\n closed = true;\n },\n listVariables: () => [...seen],\n realmError: target.Error,\n isReached: () => reached,\n runtime\n };\n}\n/**\n* Replaces a timer function of the vm, if it has it (jsdom has no\n* `setImmediate`) and the function that clears its handles, with one that\n* remembers how to clear each handle and keeps the original's own properties,\n* above all `util.promisify.custom`.\n*\n* @param target - The vm's `globalThis`.\n* @param names - Names of the function and of the one that clears its handles.\n* @param stops - Receives a function that clears each handle.\n*/\nfunction wrapTimer(target, names, stops) {\n let [startName, clearName] = names;\n let start = Reflect.get(target, startName);\n let clear = Reflect.get(target, clearName);\n if (start === void 0 || clear === void 0) return;\n /**\n * Starts the timer and remembers its handle.\n *\n * @param parameters - Arguments of the call.\n * @returns The handle.\n */\n function wrapper(...parameters) {\n let handle = start.apply(this, parameters);\n stops.push(() => {\n clear.call(target, handle);\n });\n return handle;\n }\n let { prototype, length, name, ...own } = Object.getOwnPropertyDescriptors(start);\n Object.defineProperties(wrapper, own);\n Reflect.set(target, startName, wrapper);\n}\n// adapters/jest/worker/channel-slot.ts\n/**\n* Key of the worker's channel on `process`: a test's vm gets a copy of it that\n* holds what a symbol key holds as it is, so the vm reaches the same object,\n* and the bundle of the vm's setup has no module in common with the worker's.\n*/\nvar CHANNEL_SLOT = Symbol.for(\"mootant.channel\");\n// adapters/jest/worker/vm-setup.ts\n/**\n* First of a project's `setupFiles`. It runs inside the test's vm, where\n* `require` goes through `moduleNameMapper` and automock, so neither this file\n* nor what it imports has a `node:` import. The channel comes on the vm's\n* `process`, since Jest 30.5 sends `process.getBuiltinModule` through\n* `moduleNameMapper` as well.\n*/\ninstallVmSide({\n channel: Reflect.get(process, CHANNEL_SLOT),\n install: installMutantRuntime,\n target: globalThis\n});\n";
2
2
  export { e as default };