@eggjs/mock 6.0.6 → 6.1.0-beta.10

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 (309) hide show
  1. package/README.md +35 -56
  2. package/README.zh_CN.md +30 -50
  3. package/dist/_virtual/rolldown_runtime.js +30 -0
  4. package/dist/app/extend/agent.d.ts +39 -0
  5. package/dist/app/extend/agent.js +48 -0
  6. package/dist/app/extend/application.d.ts +175 -0
  7. package/dist/app/extend/application.js +385 -0
  8. package/dist/app/middleware/cluster_app_mock.d.ts +6 -0
  9. package/dist/app/middleware/cluster_app_mock.js +97 -0
  10. package/dist/app.d.ts +10 -0
  11. package/dist/app.js +17 -0
  12. package/dist/bootstrap.d.ts +9 -0
  13. package/dist/bootstrap.js +14 -0
  14. package/dist/index.d.ts +81 -0
  15. package/dist/index.js +47 -0
  16. package/dist/inject_mocha.d.ts +1 -0
  17. package/dist/inject_mocha.js +35 -0
  18. package/dist/lib/agent_handler.d.ts +7 -0
  19. package/dist/lib/agent_handler.js +26 -0
  20. package/dist/lib/app.d.ts +7 -0
  21. package/dist/lib/app.js +251 -0
  22. package/dist/lib/app_handler.d.ts +9 -0
  23. package/dist/lib/app_handler.js +56 -0
  24. package/dist/lib/cluster.d.ts +126 -0
  25. package/dist/lib/cluster.js +283 -0
  26. package/dist/lib/context.d.ts +4 -0
  27. package/dist/lib/context.js +12 -0
  28. package/dist/lib/format_options.d.ts +10 -0
  29. package/dist/lib/format_options.js +65 -0
  30. package/dist/lib/inject_context.d.ts +9 -0
  31. package/dist/lib/inject_context.js +106 -0
  32. package/dist/lib/mock_agent.d.ts +9 -0
  33. package/dist/lib/mock_agent.js +45 -0
  34. package/dist/lib/mock_custom_loader.d.ts +4 -0
  35. package/dist/lib/mock_custom_loader.js +35 -0
  36. package/dist/lib/mock_http_server.d.ts +6 -0
  37. package/dist/lib/mock_http_server.js +17 -0
  38. package/dist/lib/mock_httpclient.d.ts +40 -0
  39. package/dist/lib/mock_httpclient.js +110 -0
  40. package/dist/lib/parallel/agent.d.ts +24 -0
  41. package/dist/lib/parallel/agent.js +111 -0
  42. package/dist/lib/parallel/app.d.ts +24 -0
  43. package/dist/lib/parallel/app.js +99 -0
  44. package/dist/lib/parallel/util.d.ts +6 -0
  45. package/dist/lib/parallel/util.js +59 -0
  46. package/dist/lib/prerequire.d.ts +1 -0
  47. package/dist/lib/prerequire.js +1 -0
  48. package/dist/lib/request_call_function.d.ts +1 -0
  49. package/dist/lib/request_call_function.js +37 -0
  50. package/dist/lib/restore.d.ts +4 -0
  51. package/dist/lib/restore.js +16 -0
  52. package/dist/lib/start-cluster.d.ts +1 -0
  53. package/dist/lib/start-cluster.js +19 -0
  54. package/dist/lib/supertest.d.ts +16 -0
  55. package/dist/lib/supertest.js +39 -0
  56. package/dist/lib/tmp/empty.d.ts +1 -0
  57. package/dist/lib/tmp/empty.js +1 -0
  58. package/{src/lib/types.ts → dist/lib/types.d.ts} +12 -29
  59. package/dist/lib/types.js +1 -0
  60. package/dist/lib/utils.d.ts +12 -0
  61. package/dist/lib/utils.js +40 -0
  62. package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +142 -0
  63. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +157 -0
  64. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +97 -0
  65. package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +40 -0
  66. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +814 -0
  67. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +50 -0
  68. package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +68 -0
  69. package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +752 -0
  70. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +203 -0
  71. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +209 -0
  72. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +18 -0
  73. package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +215 -0
  74. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +24 -0
  75. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +33 -0
  76. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +29 -0
  77. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +185 -0
  78. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +23 -0
  79. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +26 -0
  80. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +83 -0
  81. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +51 -0
  82. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +26 -0
  83. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +151 -0
  84. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +178 -0
  85. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +168 -0
  86. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +301 -0
  87. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +137 -0
  88. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +367 -0
  89. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +91 -0
  90. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +99 -0
  91. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +23 -0
  92. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +30 -0
  93. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +22 -0
  94. package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +97 -0
  95. package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +14 -0
  96. package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +16 -0
  97. package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +4093 -0
  98. package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +14 -0
  99. package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +27 -0
  100. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +12 -0
  101. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +83 -0
  102. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +35 -0
  103. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +392 -0
  104. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +86 -0
  105. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +104 -0
  106. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +99 -0
  107. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +65 -0
  108. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +18 -0
  109. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +95 -0
  110. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +105 -0
  111. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +1037 -0
  112. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +24 -0
  113. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +152 -0
  114. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +74 -0
  115. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +22 -0
  116. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +329 -0
  117. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +314 -0
  118. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +22 -0
  119. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +417 -0
  120. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +79 -0
  121. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +75 -0
  122. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +283 -0
  123. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +40 -0
  124. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +90 -0
  125. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +145 -0
  126. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +107 -0
  127. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +77 -0
  128. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +106 -0
  129. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +57 -0
  130. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +233 -0
  131. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +92 -0
  132. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +91 -0
  133. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +261 -0
  134. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +166 -0
  135. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +346 -0
  136. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +922 -0
  137. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +72 -0
  138. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +517 -0
  139. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +105 -0
  140. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +505 -0
  141. package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +225 -0
  142. package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +124 -0
  143. package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +11 -0
  144. package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +114 -0
  145. package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +76 -0
  146. package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +89 -0
  147. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +366 -0
  148. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +248 -0
  149. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +419 -0
  150. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +27 -0
  151. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +18 -0
  152. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
  153. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +63 -0
  154. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +21 -0
  155. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +9 -0
  156. package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +277 -0
  157. package/dist/register.d.ts +10 -0
  158. package/dist/register.js +40 -0
  159. package/dist/typings/index.d.ts +1 -0
  160. package/package.json +71 -98
  161. package/dist/commonjs/app/extend/agent.d.ts +0 -34
  162. package/dist/commonjs/app/extend/agent.js +0 -49
  163. package/dist/commonjs/app/extend/application.d.ts +0 -171
  164. package/dist/commonjs/app/extend/application.js +0 -450
  165. package/dist/commonjs/app/middleware/cluster_app_mock.d.ts +0 -3
  166. package/dist/commonjs/app/middleware/cluster_app_mock.js +0 -101
  167. package/dist/commonjs/app.d.ts +0 -6
  168. package/dist/commonjs/app.js +0 -20
  169. package/dist/commonjs/bootstrap.d.ts +0 -5
  170. package/dist/commonjs/bootstrap.js +0 -59
  171. package/dist/commonjs/index.d.ts +0 -77
  172. package/dist/commonjs/index.js +0 -114
  173. package/dist/commonjs/lib/agent_handler.d.ts +0 -3
  174. package/dist/commonjs/lib/agent_handler.js +0 -28
  175. package/dist/commonjs/lib/app.d.ts +0 -3
  176. package/dist/commonjs/lib/app.js +0 -301
  177. package/dist/commonjs/lib/app_handler.d.ts +0 -5
  178. package/dist/commonjs/lib/app_handler.js +0 -71
  179. package/dist/commonjs/lib/cluster.d.ts +0 -114
  180. package/dist/commonjs/lib/cluster.js +0 -337
  181. package/dist/commonjs/lib/context.d.ts +0 -1
  182. package/dist/commonjs/lib/context.js +0 -16
  183. package/dist/commonjs/lib/format_options.d.ts +0 -5
  184. package/dist/commonjs/lib/format_options.js +0 -100
  185. package/dist/commonjs/lib/inject_context.d.ts +0 -6
  186. package/dist/commonjs/lib/inject_context.js +0 -132
  187. package/dist/commonjs/lib/mock_agent.d.ts +0 -5
  188. package/dist/commonjs/lib/mock_agent.js +0 -49
  189. package/dist/commonjs/lib/mock_custom_loader.d.ts +0 -1
  190. package/dist/commonjs/lib/mock_custom_loader.js +0 -37
  191. package/dist/commonjs/lib/mock_http_server.d.ts +0 -2
  192. package/dist/commonjs/lib/mock_http_server.js +0 -24
  193. package/dist/commonjs/lib/mock_httpclient.d.ts +0 -36
  194. package/dist/commonjs/lib/mock_httpclient.js +0 -147
  195. package/dist/commonjs/lib/parallel/agent.d.ts +0 -20
  196. package/dist/commonjs/lib/parallel/agent.js +0 -125
  197. package/dist/commonjs/lib/parallel/app.d.ts +0 -20
  198. package/dist/commonjs/lib/parallel/app.js +0 -115
  199. package/dist/commonjs/lib/parallel/util.d.ts +0 -3
  200. package/dist/commonjs/lib/parallel/util.js +0 -77
  201. package/dist/commonjs/lib/prerequire.d.ts +0 -1
  202. package/dist/commonjs/lib/prerequire.js +0 -26
  203. package/dist/commonjs/lib/request_call_function.d.ts +0 -1
  204. package/dist/commonjs/lib/request_call_function.js +0 -52
  205. package/dist/commonjs/lib/restore.d.ts +0 -1
  206. package/dist/commonjs/lib/restore.js +0 -16
  207. package/dist/commonjs/lib/start-cluster.d.ts +0 -2
  208. package/dist/commonjs/lib/start-cluster.js +0 -23
  209. package/dist/commonjs/lib/supertest.d.ts +0 -11
  210. package/dist/commonjs/lib/supertest.js +0 -48
  211. package/dist/commonjs/lib/tmp/empty.d.ts +0 -1
  212. package/dist/commonjs/lib/tmp/empty.js +0 -3
  213. package/dist/commonjs/lib/types.d.ts +0 -68
  214. package/dist/commonjs/lib/types.js +0 -3
  215. package/dist/commonjs/lib/utils.d.ts +0 -9
  216. package/dist/commonjs/lib/utils.js +0 -80
  217. package/dist/commonjs/package.json +0 -3
  218. package/dist/commonjs/register.d.ts +0 -8
  219. package/dist/commonjs/register.js +0 -80
  220. package/dist/esm/app/extend/agent.d.ts +0 -34
  221. package/dist/esm/app/extend/agent.js +0 -46
  222. package/dist/esm/app/extend/application.d.ts +0 -171
  223. package/dist/esm/app/extend/application.js +0 -444
  224. package/dist/esm/app/middleware/cluster_app_mock.d.ts +0 -3
  225. package/dist/esm/app/middleware/cluster_app_mock.js +0 -99
  226. package/dist/esm/app.d.ts +0 -6
  227. package/dist/esm/app.js +0 -17
  228. package/dist/esm/bootstrap.d.ts +0 -5
  229. package/dist/esm/bootstrap.js +0 -15
  230. package/dist/esm/index.d.ts +0 -77
  231. package/dist/esm/index.js +0 -91
  232. package/dist/esm/lib/agent_handler.d.ts +0 -3
  233. package/dist/esm/lib/agent_handler.js +0 -24
  234. package/dist/esm/lib/app.d.ts +0 -3
  235. package/dist/esm/lib/app.js +0 -295
  236. package/dist/esm/lib/app_handler.d.ts +0 -5
  237. package/dist/esm/lib/app_handler.js +0 -65
  238. package/dist/esm/lib/cluster.d.ts +0 -114
  239. package/dist/esm/lib/cluster.js +0 -328
  240. package/dist/esm/lib/context.d.ts +0 -1
  241. package/dist/esm/lib/context.js +0 -13
  242. package/dist/esm/lib/format_options.d.ts +0 -5
  243. package/dist/esm/lib/format_options.js +0 -94
  244. package/dist/esm/lib/inject_context.d.ts +0 -6
  245. package/dist/esm/lib/inject_context.js +0 -126
  246. package/dist/esm/lib/mock_agent.d.ts +0 -5
  247. package/dist/esm/lib/mock_agent.js +0 -45
  248. package/dist/esm/lib/mock_custom_loader.d.ts +0 -1
  249. package/dist/esm/lib/mock_custom_loader.js +0 -34
  250. package/dist/esm/lib/mock_http_server.d.ts +0 -2
  251. package/dist/esm/lib/mock_http_server.js +0 -18
  252. package/dist/esm/lib/mock_httpclient.d.ts +0 -36
  253. package/dist/esm/lib/mock_httpclient.js +0 -144
  254. package/dist/esm/lib/parallel/agent.d.ts +0 -20
  255. package/dist/esm/lib/parallel/agent.js +0 -117
  256. package/dist/esm/lib/parallel/app.d.ts +0 -20
  257. package/dist/esm/lib/parallel/app.js +0 -110
  258. package/dist/esm/lib/parallel/util.d.ts +0 -3
  259. package/dist/esm/lib/parallel/util.js +0 -73
  260. package/dist/esm/lib/prerequire.d.ts +0 -1
  261. package/dist/esm/lib/prerequire.js +0 -25
  262. package/dist/esm/lib/request_call_function.d.ts +0 -1
  263. package/dist/esm/lib/request_call_function.js +0 -47
  264. package/dist/esm/lib/restore.d.ts +0 -1
  265. package/dist/esm/lib/restore.js +0 -13
  266. package/dist/esm/lib/start-cluster.d.ts +0 -2
  267. package/dist/esm/lib/start-cluster.js +0 -18
  268. package/dist/esm/lib/supertest.d.ts +0 -11
  269. package/dist/esm/lib/supertest.js +0 -40
  270. package/dist/esm/lib/tmp/empty.d.ts +0 -1
  271. package/dist/esm/lib/tmp/empty.js +0 -2
  272. package/dist/esm/lib/types.d.ts +0 -68
  273. package/dist/esm/lib/types.js +0 -2
  274. package/dist/esm/lib/utils.d.ts +0 -9
  275. package/dist/esm/lib/utils.js +0 -69
  276. package/dist/esm/package.json +0 -3
  277. package/dist/esm/register.d.ts +0 -8
  278. package/dist/esm/register.js +0 -75
  279. package/dist/package.json +0 -4
  280. package/src/app/extend/agent.ts +0 -57
  281. package/src/app/extend/application.ts +0 -510
  282. package/src/app/middleware/cluster_app_mock.ts +0 -102
  283. package/src/app.ts +0 -18
  284. package/src/bootstrap.ts +0 -25
  285. package/src/index.ts +0 -112
  286. package/src/lib/agent_handler.ts +0 -28
  287. package/src/lib/app.ts +0 -314
  288. package/src/lib/app_handler.ts +0 -77
  289. package/src/lib/cluster.ts +0 -363
  290. package/src/lib/context.ts +0 -14
  291. package/src/lib/format_options.ts +0 -103
  292. package/src/lib/inject_context.ts +0 -134
  293. package/src/lib/mock_agent.ts +0 -57
  294. package/src/lib/mock_custom_loader.ts +0 -36
  295. package/src/lib/mock_http_server.ts +0 -19
  296. package/src/lib/mock_httpclient.ts +0 -183
  297. package/src/lib/parallel/agent.ts +0 -128
  298. package/src/lib/parallel/app.ts +0 -123
  299. package/src/lib/parallel/util.ts +0 -66
  300. package/src/lib/prerequire.ts +0 -25
  301. package/src/lib/request_call_function.ts +0 -49
  302. package/src/lib/restore.ts +0 -14
  303. package/src/lib/start-cluster.ts +0 -23
  304. package/src/lib/supertest.ts +0 -45
  305. package/src/lib/tmp/.gitkeep +0 -0
  306. package/src/lib/tmp/empty.ts +0 -0
  307. package/src/lib/utils.ts +0 -82
  308. package/src/register.ts +0 -80
  309. package/src/typings/index.d.ts +0 -4
@@ -0,0 +1,283 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_escape_string_regexp } from "../../../../../escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js";
3
+ import { require_utils } from "../utils.js";
4
+ import { require_runner } from "../runner.js";
5
+ import { require_base } from "./base.js";
6
+
7
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js
8
+ var require_html = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js": ((exports, module) => {
9
+ /**
10
+ * @typedef {import('../runner.js')} Runner
11
+ */
12
+ /**
13
+ * @module HTML
14
+ */
15
+ /**
16
+ * Module dependencies.
17
+ */
18
+ var Base = require_base();
19
+ var utils = require_utils();
20
+ var escapeRe = require_escape_string_regexp();
21
+ var constants = require_runner().constants;
22
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
23
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
24
+ var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
25
+ var EVENT_SUITE_END = constants.EVENT_SUITE_END;
26
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
27
+ var escape = utils.escape;
28
+ /**
29
+ * Save timer references to avoid Sinon interfering (see GH-237).
30
+ */
31
+ var Date = global.Date;
32
+ /**
33
+ * Expose `HTML`.
34
+ */
35
+ exports = module.exports = HTML;
36
+ /**
37
+ * Stats template: Result, progress, passes, failures, and duration.
38
+ */
39
+ var statsTemplate = "<ul id=\"mocha-stats\"><li class=\"result\"></li><li class=\"progress-contain\"><progress class=\"progress-element\" max=\"100\" value=\"0\"></progress><svg class=\"progress-ring\"><circle class=\"ring-flatlight\" stroke-dasharray=\"100%,0%\"/><circle class=\"ring-highlight\" stroke-dasharray=\"0%,100%\"/></svg><div class=\"progress-text\">0%</div></li><li class=\"passes\"><a href=\"javascript:void(0);\">passes:</a> <em>0</em></li><li class=\"failures\"><a href=\"javascript:void(0);\">failures:</a> <em>0</em></li><li class=\"duration\">duration: <em>0</em>s</li></ul>";
40
+ var playIcon = "&#x2023;";
41
+ /**
42
+ * Constructs a new `HTML` reporter instance.
43
+ *
44
+ * @public
45
+ * @class
46
+ * @memberof Mocha.reporters
47
+ * @extends Mocha.reporters.Base
48
+ * @param {Runner} runner - Instance triggers reporter actions.
49
+ * @param {Object} [options] - runner options
50
+ */
51
+ function HTML(runner, options) {
52
+ Base.call(this, runner, options);
53
+ var self = this;
54
+ var stats = this.stats;
55
+ var stat = fragment(statsTemplate);
56
+ var items = stat.getElementsByTagName("li");
57
+ const resultIndex = 0;
58
+ const progressIndex = 1;
59
+ const passesIndex = 2;
60
+ const failuresIndex = 3;
61
+ const durationIndex = 4;
62
+ /** Stat item containing the root suite pass or fail indicator (hasFailures ? '✖' : '✓') */
63
+ var resultIndicator = items[resultIndex];
64
+ /** Passes text and count */
65
+ const passesStat = items[passesIndex];
66
+ /** Stat item containing the pass count (not the word, just the number) */
67
+ const passesCount = passesStat.getElementsByTagName("em")[0];
68
+ /** Stat item linking to filter to show only passing tests */
69
+ const passesLink = passesStat.getElementsByTagName("a")[0];
70
+ /** Failures text and count */
71
+ const failuresStat = items[failuresIndex];
72
+ /** Stat item containing the failure count (not the word, just the number) */
73
+ const failuresCount = failuresStat.getElementsByTagName("em")[0];
74
+ /** Stat item linking to filter to show only failing tests */
75
+ const failuresLink = failuresStat.getElementsByTagName("a")[0];
76
+ /** Stat item linking to the duration time (not the word or unit, just the number) */
77
+ var duration = items[durationIndex].getElementsByTagName("em")[0];
78
+ var report = fragment("<ul id=\"mocha-report\"></ul>");
79
+ var stack = [report];
80
+ var progressText = items[progressIndex].getElementsByTagName("div")[0];
81
+ var progressBar = items[progressIndex].getElementsByTagName("progress")[0];
82
+ var progressRing = [items[progressIndex].getElementsByClassName("ring-flatlight")[0], items[progressIndex].getElementsByClassName("ring-highlight")[0]];
83
+ var root = document.getElementById("mocha");
84
+ if (!root) return error("#mocha div missing, add it to your document");
85
+ on(passesLink, "click", function(evt) {
86
+ evt.preventDefault();
87
+ unhide();
88
+ var name = /pass/.test(report.className) ? "" : " pass";
89
+ report.className = report.className.replace(/fail|pass/g, "") + name;
90
+ if (report.className.trim()) hideSuitesWithout("test pass");
91
+ });
92
+ on(failuresLink, "click", function(evt) {
93
+ evt.preventDefault();
94
+ unhide();
95
+ var name = /fail/.test(report.className) ? "" : " fail";
96
+ report.className = report.className.replace(/fail|pass/g, "") + name;
97
+ if (report.className.trim()) hideSuitesWithout("test fail");
98
+ });
99
+ root.appendChild(stat);
100
+ root.appendChild(report);
101
+ runner.on(EVENT_SUITE_BEGIN, function(suite) {
102
+ if (suite.root) return;
103
+ var url = self.suiteURL(suite);
104
+ var el = fragment("<li class=\"suite\"><h1><a href=\"%s\">%s</a></h1></li>", url, escape(suite.title));
105
+ stack[0].appendChild(el);
106
+ stack.unshift(document.createElement("ul"));
107
+ el.appendChild(stack[0]);
108
+ });
109
+ runner.on(EVENT_SUITE_END, function(suite) {
110
+ if (suite.root) {
111
+ if (stats.failures === 0) {
112
+ text(resultIndicator, "✓");
113
+ stat.className += " pass";
114
+ }
115
+ updateStats();
116
+ return;
117
+ }
118
+ stack.shift();
119
+ });
120
+ runner.on(EVENT_TEST_PASS, function(test) {
121
+ var url = self.testURL(test);
122
+ var markup = "<li class=\"test pass %e\"><h2>%e<span class=\"duration\">%ems</span> <a href=\"%s\" class=\"replay\">" + playIcon + "</a></h2></li>";
123
+ var el = fragment(markup, test.speed, test.title, test.duration, url);
124
+ self.addCodeToggle(el, test.body);
125
+ appendToStack(el);
126
+ updateStats();
127
+ });
128
+ runner.on(EVENT_TEST_FAIL, function(test) {
129
+ text(resultIndicator, "✖");
130
+ stat.className += " fail";
131
+ var el = fragment("<li class=\"test fail\"><h2>%e <a href=\"%e\" class=\"replay\">" + playIcon + "</a></h2></li>", test.title, self.testURL(test));
132
+ var stackString;
133
+ var message = test.err.toString();
134
+ if (message === "[object Error]") message = test.err.message;
135
+ if (test.err.stack) {
136
+ var indexOfMessage = test.err.stack.indexOf(test.err.message);
137
+ if (indexOfMessage === -1) stackString = test.err.stack;
138
+ else stackString = test.err.stack.slice(test.err.message.length + indexOfMessage);
139
+ } else if (test.err.sourceURL && test.err.line !== void 0) stackString = "\n(" + test.err.sourceURL + ":" + test.err.line + ")";
140
+ stackString = stackString || "";
141
+ if (test.err.htmlMessage && stackString) el.appendChild(fragment("<div class=\"html-error\">%s\n<pre class=\"error\">%e</pre></div>", test.err.htmlMessage, stackString));
142
+ else if (test.err.htmlMessage) el.appendChild(fragment("<div class=\"html-error\">%s</div>", test.err.htmlMessage));
143
+ else el.appendChild(fragment("<pre class=\"error\">%e%e</pre>", message, stackString));
144
+ self.addCodeToggle(el, test.body);
145
+ appendToStack(el);
146
+ updateStats();
147
+ });
148
+ runner.on(EVENT_TEST_PENDING, function(test) {
149
+ var el = fragment("<li class=\"test pass pending\"><h2>%e</h2></li>", test.title);
150
+ appendToStack(el);
151
+ updateStats();
152
+ });
153
+ function appendToStack(el) {
154
+ if (stack[0]) stack[0].appendChild(el);
155
+ }
156
+ function updateStats() {
157
+ var percent = stats.tests / runner.total * 100 | 0;
158
+ progressBar.value = percent;
159
+ if (progressText) {
160
+ var decimalPlaces = Math.ceil(Math.log10(runner.total / 100));
161
+ text(progressText, percent.toFixed(Math.min(Math.max(decimalPlaces, 0), 100)) + "%");
162
+ }
163
+ if (progressRing) {
164
+ var radius = parseFloat(getComputedStyle(progressRing[0]).getPropertyValue("r"));
165
+ var wholeArc = Math.PI * 2 * radius;
166
+ var highlightArc = percent * (wholeArc / 100);
167
+ progressRing[0].style["stroke-dasharray"] = `0,${highlightArc}px,${wholeArc}px`;
168
+ progressRing[1].style["stroke-dasharray"] = `${highlightArc}px,${wholeArc}px`;
169
+ }
170
+ var ms = new Date() - stats.start;
171
+ text(passesCount, stats.passes);
172
+ text(failuresCount, stats.failures);
173
+ text(duration, (ms / 1e3).toFixed(2));
174
+ }
175
+ }
176
+ /**
177
+ * Makes a URL, preserving querystring ("search") parameters.
178
+ *
179
+ * @param {string} s
180
+ * @return {string} A new URL.
181
+ */
182
+ function makeUrl(s) {
183
+ var search = window.location.search;
184
+ if (search) search = search.replace(/[?&](?:f?grep|invert)=[^&\s]*/g, "").replace(/^&/, "?");
185
+ return window.location.pathname + (search ? search + "&" : "?") + "grep=" + encodeURIComponent(s);
186
+ }
187
+ /**
188
+ * Provide suite URL.
189
+ *
190
+ * @param {Object} [suite]
191
+ */
192
+ HTML.prototype.suiteURL = function(suite) {
193
+ return makeUrl("^" + escapeRe(suite.fullTitle()) + " ");
194
+ };
195
+ /**
196
+ * Provide test URL.
197
+ *
198
+ * @param {Object} [test]
199
+ */
200
+ HTML.prototype.testURL = function(test) {
201
+ return makeUrl("^" + escapeRe(test.fullTitle()) + "$");
202
+ };
203
+ /**
204
+ * Adds code toggle functionality for the provided test's list element.
205
+ *
206
+ * @param {HTMLLIElement} el
207
+ * @param {string} contents
208
+ */
209
+ HTML.prototype.addCodeToggle = function(el, contents) {
210
+ var h2 = el.getElementsByTagName("h2")[0];
211
+ on(h2, "click", function() {
212
+ pre.style.display = pre.style.display === "none" ? "block" : "none";
213
+ });
214
+ var pre = fragment("<pre><code>%e</code></pre>", utils.clean(contents));
215
+ el.appendChild(pre);
216
+ pre.style.display = "none";
217
+ };
218
+ /**
219
+ * Display error `msg`.
220
+ *
221
+ * @param {string} msg
222
+ */
223
+ function error(msg) {
224
+ document.body.appendChild(fragment("<div id=\"mocha-error\">%s</div>", msg));
225
+ }
226
+ /**
227
+ * Return a DOM fragment from `html`.
228
+ *
229
+ * @param {string} html
230
+ */
231
+ function fragment(html) {
232
+ var args = arguments;
233
+ var div = document.createElement("div");
234
+ var i = 1;
235
+ div.innerHTML = html.replace(/%([se])/g, function(_, type) {
236
+ switch (type) {
237
+ case "s": return String(args[i++]);
238
+ case "e": return escape(args[i++]);
239
+ }
240
+ });
241
+ return div.firstChild;
242
+ }
243
+ /**
244
+ * Check for suites that do not have elements
245
+ * with `classname`, and hide them.
246
+ *
247
+ * @param {text} classname
248
+ */
249
+ function hideSuitesWithout(classname) {
250
+ var suites = document.getElementsByClassName("suite");
251
+ for (var i = 0; i < suites.length; i++) if (!suites[i].getElementsByClassName(classname).length) suites[i].className += " hidden";
252
+ }
253
+ /**
254
+ * Unhide .hidden suites.
255
+ */
256
+ function unhide() {
257
+ var els = document.getElementsByClassName("suite hidden");
258
+ while (els.length > 0) els[0].className = els[0].className.replace("suite hidden", "suite");
259
+ }
260
+ /**
261
+ * Set an element's text contents.
262
+ *
263
+ * @param {HTMLElement} el
264
+ * @param {string} contents
265
+ */
266
+ function text(el, contents) {
267
+ if (el.textContent) el.textContent = contents;
268
+ else el.innerText = contents;
269
+ }
270
+ /**
271
+ * Listen on `event` with callback `fn`.
272
+ */
273
+ function on(el, event, fn) {
274
+ if (el.addEventListener) el.addEventListener(event, fn, false);
275
+ else el.attachEvent("on" + event, fn);
276
+ }
277
+ HTML.browserOnly = true;
278
+ }) });
279
+
280
+ //#endregion
281
+ export default require_html();
282
+
283
+ export { require_html };
@@ -0,0 +1,40 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_base } from "./base.js";
3
+ import { require_dot } from "./dot.js";
4
+ import { require_doc } from "./doc.js";
5
+ import { require_tap } from "./tap.js";
6
+ import { require_json } from "./json.js";
7
+ import { require_html } from "./html.js";
8
+ import { require_list } from "./list.js";
9
+ import { require_min } from "./min.js";
10
+ import { require_spec } from "./spec.js";
11
+ import { require_nyan } from "./nyan.js";
12
+ import { require_xunit } from "./xunit.js";
13
+ import { require_markdown } from "./markdown.js";
14
+ import { require_progress } from "./progress.js";
15
+ import { require_landing } from "./landing.js";
16
+ import { require_json_stream } from "./json-stream.js";
17
+
18
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js
19
+ var require_reporters = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js": ((exports) => {
20
+ exports.Base = exports.base = require_base();
21
+ exports.Dot = exports.dot = require_dot();
22
+ exports.Doc = exports.doc = require_doc();
23
+ exports.TAP = exports.tap = require_tap();
24
+ exports.JSON = exports.json = require_json();
25
+ exports.HTML = exports.html = require_html();
26
+ exports.List = exports.list = require_list();
27
+ exports.Min = exports.min = require_min();
28
+ exports.Spec = exports.spec = require_spec();
29
+ exports.Nyan = exports.nyan = require_nyan();
30
+ exports.XUnit = exports.xunit = require_xunit();
31
+ exports.Markdown = exports.markdown = require_markdown();
32
+ exports.Progress = exports.progress = require_progress();
33
+ exports.Landing = exports.landing = require_landing();
34
+ exports.JSONStream = exports["json-stream"] = require_json_stream();
35
+ }) });
36
+
37
+ //#endregion
38
+ export default require_reporters();
39
+
40
+ export { require_reporters };
@@ -0,0 +1,90 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_runner } from "../runner.js";
3
+ import { require_base } from "./base.js";
4
+
5
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js
6
+ var require_json_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js": ((exports, module) => {
7
+ /**
8
+ * @typedef {import('../runner.js')} Runner
9
+ * @typedef {import('../test.js')} Test
10
+ */
11
+ /**
12
+ * @module JSONStream
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var constants = require_runner().constants;
19
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
20
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
21
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
22
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
23
+ /**
24
+ * Expose `JSONStream`.
25
+ */
26
+ exports = module.exports = JSONStream;
27
+ /**
28
+ * Constructs a new `JSONStream` reporter instance.
29
+ *
30
+ * @public
31
+ * @class
32
+ * @memberof Mocha.reporters
33
+ * @extends Mocha.reporters.Base
34
+ * @param {Runner} runner - Instance triggers reporter actions.
35
+ * @param {Object} [options] - runner options
36
+ */
37
+ function JSONStream(runner, options) {
38
+ Base.call(this, runner, options);
39
+ var self = this;
40
+ var total = runner.total;
41
+ runner.once(EVENT_RUN_BEGIN, function() {
42
+ writeEvent(["start", { total }]);
43
+ });
44
+ runner.on(EVENT_TEST_PASS, function(test) {
45
+ writeEvent(["pass", clean(test)]);
46
+ });
47
+ runner.on(EVENT_TEST_FAIL, function(test, err) {
48
+ test = clean(test);
49
+ test.err = err.message;
50
+ test.stack = err.stack || null;
51
+ writeEvent(["fail", test]);
52
+ });
53
+ runner.once(EVENT_RUN_END, function() {
54
+ writeEvent(["end", self.stats]);
55
+ });
56
+ }
57
+ /**
58
+ * Writes Mocha event to reporter output stream.
59
+ *
60
+ * @private
61
+ * @param {unknown[]} event - Mocha event to be output.
62
+ */
63
+ function writeEvent(event) {
64
+ process.stdout.write(JSON.stringify(event) + "\n");
65
+ }
66
+ /**
67
+ * Returns an object literal representation of `test`
68
+ * free of cyclic properties, etc.
69
+ *
70
+ * @private
71
+ * @param {Test} test - Instance used as data source.
72
+ * @return {Object} object containing pared-down test instance data
73
+ */
74
+ function clean(test) {
75
+ return {
76
+ title: test.title,
77
+ fullTitle: test.fullTitle(),
78
+ file: test.file,
79
+ duration: test.duration,
80
+ currentRetry: test.currentRetry(),
81
+ speed: test.speed
82
+ };
83
+ }
84
+ JSONStream.description = "newline delimited JSON events";
85
+ }) });
86
+
87
+ //#endregion
88
+ export default require_json_stream();
89
+
90
+ export { require_json_stream };
@@ -0,0 +1,145 @@
1
+ import { __commonJS, __require } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_errors } from "../errors.js";
4
+ import { require_runner } from "../runner.js";
5
+ import { require_base } from "./base.js";
6
+
7
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js
8
+ var require_json = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js": ((exports, module) => {
9
+ /**
10
+ * @typedef {import('../runner.js')} Runner
11
+ */
12
+ /**
13
+ * @module JSON
14
+ */
15
+ /**
16
+ * Module dependencies.
17
+ */
18
+ var Base = require_base();
19
+ var fs = __require("node:fs");
20
+ var path = __require("node:path");
21
+ const createUnsupportedError = require_errors().createUnsupportedError;
22
+ const utils = require_utils();
23
+ var constants = require_runner().constants;
24
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
25
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
26
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
27
+ var EVENT_TEST_END = constants.EVENT_TEST_END;
28
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
29
+ /**
30
+ * Expose `JSON`.
31
+ */
32
+ exports = module.exports = JSONReporter;
33
+ /**
34
+ * Constructs a new `JSON` reporter instance.
35
+ *
36
+ * @public
37
+ * @class JSON
38
+ * @memberof Mocha.reporters
39
+ * @extends Mocha.reporters.Base
40
+ * @param {Runner} runner - Instance triggers reporter actions.
41
+ * @param {Object} [options] - runner options
42
+ */
43
+ function JSONReporter(runner, options = {}) {
44
+ Base.call(this, runner, options);
45
+ var self = this;
46
+ var tests = [];
47
+ var pending = [];
48
+ var failures = [];
49
+ var passes = [];
50
+ var output;
51
+ if (options.reporterOption && options.reporterOption.output) {
52
+ if (utils.isBrowser()) throw createUnsupportedError("file output not supported in browser");
53
+ output = options.reporterOption.output;
54
+ }
55
+ runner.on(EVENT_TEST_END, function(test) {
56
+ tests.push(test);
57
+ });
58
+ runner.on(EVENT_TEST_PASS, function(test) {
59
+ passes.push(test);
60
+ });
61
+ runner.on(EVENT_TEST_FAIL, function(test) {
62
+ failures.push(test);
63
+ });
64
+ runner.on(EVENT_TEST_PENDING, function(test) {
65
+ pending.push(test);
66
+ });
67
+ runner.once(EVENT_RUN_END, function() {
68
+ var obj = {
69
+ stats: self.stats,
70
+ tests: tests.map(clean),
71
+ pending: pending.map(clean),
72
+ failures: failures.map(clean),
73
+ passes: passes.map(clean)
74
+ };
75
+ runner.testResults = obj;
76
+ var json = JSON.stringify(obj, null, 2);
77
+ if (output) try {
78
+ fs.mkdirSync(path.dirname(output), { recursive: true });
79
+ fs.writeFileSync(output, json);
80
+ } catch (err) {
81
+ console.error(`${Base.symbols.err} [mocha] writing output to "${output}" failed: ${err.message}\n`);
82
+ process.stdout.write(json);
83
+ }
84
+ else process.stdout.write(json);
85
+ });
86
+ }
87
+ /**
88
+ * Return a plain-object representation of `test`
89
+ * free of cyclic properties etc.
90
+ *
91
+ * @private
92
+ * @param {Object} test
93
+ * @return {Object}
94
+ */
95
+ function clean(test) {
96
+ var err = test.err || {};
97
+ if (err instanceof Error) err = errorJSON(err);
98
+ return {
99
+ title: test.title,
100
+ fullTitle: test.fullTitle(),
101
+ file: test.file,
102
+ duration: test.duration,
103
+ currentRetry: test.currentRetry(),
104
+ speed: test.speed,
105
+ err: cleanCycles(err)
106
+ };
107
+ }
108
+ /**
109
+ * Replaces any circular references inside `obj` with '[object Object]'
110
+ *
111
+ * @private
112
+ * @param {Object} obj
113
+ * @return {Object}
114
+ */
115
+ function cleanCycles(obj) {
116
+ var cache = [];
117
+ return JSON.parse(JSON.stringify(obj, function(key, value) {
118
+ if (typeof value === "object" && value !== null) {
119
+ if (cache.indexOf(value) !== -1) return "" + value;
120
+ cache.push(value);
121
+ }
122
+ return value;
123
+ }));
124
+ }
125
+ /**
126
+ * Transform an Error object into a JSON object.
127
+ *
128
+ * @private
129
+ * @param {Error} err
130
+ * @return {Object}
131
+ */
132
+ function errorJSON(err) {
133
+ var res = {};
134
+ Object.getOwnPropertyNames(err).forEach(function(key) {
135
+ res[key] = err[key];
136
+ }, err);
137
+ return res;
138
+ }
139
+ JSONReporter.description = "single JSON object";
140
+ }) });
141
+
142
+ //#endregion
143
+ export default require_json();
144
+
145
+ export { require_json };
@@ -0,0 +1,107 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runnable } from "../runnable.js";
4
+ import { require_runner } from "../runner.js";
5
+ import { require_base } from "./base.js";
6
+
7
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js
8
+ var require_landing = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js": ((exports, module) => {
9
+ /**
10
+ * @typedef {import('../runner.js')} Runner
11
+ */
12
+ /**
13
+ * @module Landing
14
+ */
15
+ /**
16
+ * Module dependencies.
17
+ */
18
+ var Base = require_base();
19
+ var inherits = require_utils().inherits;
20
+ var constants = require_runner().constants;
21
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
22
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
23
+ var EVENT_TEST_END = constants.EVENT_TEST_END;
24
+ var STATE_FAILED = require_runnable().constants.STATE_FAILED;
25
+ var cursor = Base.cursor;
26
+ var color = Base.color;
27
+ /**
28
+ * Expose `Landing`.
29
+ */
30
+ exports = module.exports = Landing;
31
+ /**
32
+ * Airplane color.
33
+ */
34
+ Base.colors.plane = 0;
35
+ /**
36
+ * Airplane crash color.
37
+ */
38
+ Base.colors["plane crash"] = 31;
39
+ /**
40
+ * Runway color.
41
+ */
42
+ Base.colors.runway = 90;
43
+ /**
44
+ * Constructs a new `Landing` reporter instance.
45
+ *
46
+ * @public
47
+ * @class
48
+ * @memberof Mocha.reporters
49
+ * @extends Mocha.reporters.Base
50
+ * @param {Runner} runner - Instance triggers reporter actions.
51
+ * @param {Object} [options] - runner options
52
+ */
53
+ function Landing(runner, options) {
54
+ Base.call(this, runner, options);
55
+ var self = this;
56
+ var width = Base.window.width * .75 | 0;
57
+ var stream = process.stdout;
58
+ var plane = color("plane", "✈");
59
+ var crashed = -1;
60
+ var n = 0;
61
+ var total = 0;
62
+ function runway() {
63
+ var buf = Array(width).join("-");
64
+ return " " + color("runway", buf);
65
+ }
66
+ runner.on(EVENT_RUN_BEGIN, function() {
67
+ stream.write("\n\n\n ");
68
+ cursor.hide();
69
+ });
70
+ runner.on(EVENT_TEST_END, function(test) {
71
+ var col = crashed === -1 ? width * ++n / ++total | 0 : crashed;
72
+ if (test.state === STATE_FAILED) {
73
+ plane = color("plane crash", "✈");
74
+ crashed = col;
75
+ }
76
+ stream.write("\x1B[" + (width + 1) + "D\x1B[2A");
77
+ stream.write(runway());
78
+ stream.write("\n ");
79
+ stream.write(color("runway", Array(col).join("⋅")));
80
+ stream.write(plane);
81
+ stream.write(color("runway", Array(width - col).join("⋅") + "\n"));
82
+ stream.write(runway());
83
+ stream.write("\x1B[0m");
84
+ });
85
+ runner.once(EVENT_RUN_END, function() {
86
+ cursor.show();
87
+ process.stdout.write("\n");
88
+ self.epilogue();
89
+ });
90
+ process.once("SIGINT", function() {
91
+ cursor.show();
92
+ process.nextTick(function() {
93
+ process.kill(process.pid, "SIGINT");
94
+ });
95
+ });
96
+ }
97
+ /**
98
+ * Inherit from `Base.prototype`.
99
+ */
100
+ inherits(Landing, Base);
101
+ Landing.description = "Unicode landing strip";
102
+ }) });
103
+
104
+ //#endregion
105
+ export default require_landing();
106
+
107
+ export { require_landing };