@eggjs/mock 6.0.7 → 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 -172
  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 -172
  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 -512
  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,261 @@
1
+ import { __commonJS, __require } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_utils } from "../utils.js";
3
+ import { require_runner } from "../runner.js";
4
+ import { require_base } from "./base.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js
7
+ var require_tap = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ * @typedef {import('../test.js')} Test
11
+ */
12
+ /**
13
+ * @module TAP
14
+ */
15
+ /**
16
+ * Module dependencies.
17
+ */
18
+ var util = __require("node:util");
19
+ var Base = require_base();
20
+ var constants = require_runner().constants;
21
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
22
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
23
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
24
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
25
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
26
+ var EVENT_TEST_END = constants.EVENT_TEST_END;
27
+ var inherits = require_utils().inherits;
28
+ var sprintf = util.format;
29
+ /**
30
+ * Expose `TAP`.
31
+ */
32
+ exports = module.exports = TAP;
33
+ /**
34
+ * Constructs a new `TAP` reporter instance.
35
+ *
36
+ * @public
37
+ * @class
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 TAP(runner, options) {
44
+ Base.call(this, runner, options);
45
+ var self = this;
46
+ var n = 1;
47
+ var tapVersion = "12";
48
+ if (options && options.reporterOptions) {
49
+ if (options.reporterOptions.tapVersion) tapVersion = options.reporterOptions.tapVersion.toString();
50
+ }
51
+ this._producer = createProducer(tapVersion);
52
+ runner.once(EVENT_RUN_BEGIN, function() {
53
+ self._producer.writeVersion();
54
+ });
55
+ runner.on(EVENT_TEST_END, function() {
56
+ ++n;
57
+ });
58
+ runner.on(EVENT_TEST_PENDING, function(test) {
59
+ self._producer.writePending(n, test);
60
+ });
61
+ runner.on(EVENT_TEST_PASS, function(test) {
62
+ self._producer.writePass(n, test);
63
+ });
64
+ runner.on(EVENT_TEST_FAIL, function(test, err) {
65
+ self._producer.writeFail(n, test, err);
66
+ });
67
+ runner.once(EVENT_RUN_END, function() {
68
+ self._producer.writeEpilogue(runner.stats);
69
+ });
70
+ }
71
+ /**
72
+ * Inherit from `Base.prototype`.
73
+ */
74
+ inherits(TAP, Base);
75
+ /**
76
+ * Returns a TAP-safe title of `test`.
77
+ *
78
+ * @private
79
+ * @param {Test} test - Test instance.
80
+ * @return {String} title with any hash character removed
81
+ */
82
+ function title(test) {
83
+ return test.fullTitle().replace(/#/g, "");
84
+ }
85
+ /**
86
+ * Writes newline-terminated formatted string to reporter output stream.
87
+ *
88
+ * @private
89
+ * @param {string} format - `printf`-like format string
90
+ * @param {...*} [varArgs] - Format string arguments
91
+ */
92
+ function println() {
93
+ var vargs = Array.from(arguments);
94
+ vargs[0] += "\n";
95
+ process.stdout.write(sprintf.apply(null, vargs));
96
+ }
97
+ /**
98
+ * Returns a `tapVersion`-appropriate TAP producer instance, if possible.
99
+ *
100
+ * @private
101
+ * @param {string} tapVersion - Version of TAP specification to produce.
102
+ * @returns {TAPProducer} specification-appropriate instance
103
+ * @throws {Error} if specification version has no associated producer.
104
+ */
105
+ function createProducer(tapVersion) {
106
+ var producer = {
107
+ 12: new TAP12Producer(),
108
+ 13: new TAP13Producer()
109
+ }[tapVersion];
110
+ if (!producer) throw new Error("invalid or unsupported TAP version: " + JSON.stringify(tapVersion));
111
+ return producer;
112
+ }
113
+ /**
114
+ * @summary
115
+ * Constructs a new TAPProducer.
116
+ *
117
+ * @description
118
+ * <em>Only</em> to be used as an abstract base class.
119
+ *
120
+ * @private
121
+ * @constructor
122
+ */
123
+ function TAPProducer() {}
124
+ /**
125
+ * Writes the TAP version to reporter output stream.
126
+ *
127
+ * @abstract
128
+ */
129
+ TAPProducer.prototype.writeVersion = function() {};
130
+ /**
131
+ * Writes the plan to reporter output stream.
132
+ *
133
+ * @abstract
134
+ * @param {number} ntests - Number of tests that are planned to run.
135
+ */
136
+ TAPProducer.prototype.writePlan = function(ntests) {
137
+ println("%d..%d", 1, ntests);
138
+ };
139
+ /**
140
+ * Writes that test passed to reporter output stream.
141
+ *
142
+ * @abstract
143
+ * @param {number} n - Index of test that passed.
144
+ * @param {Test} test - Instance containing test information.
145
+ */
146
+ TAPProducer.prototype.writePass = function(n, test) {
147
+ println("ok %d %s", n, title(test));
148
+ };
149
+ /**
150
+ * Writes that test was skipped to reporter output stream.
151
+ *
152
+ * @abstract
153
+ * @param {number} n - Index of test that was skipped.
154
+ * @param {Test} test - Instance containing test information.
155
+ */
156
+ TAPProducer.prototype.writePending = function(n, test) {
157
+ println("ok %d %s # SKIP -", n, title(test));
158
+ };
159
+ /**
160
+ * Writes that test failed to reporter output stream.
161
+ *
162
+ * @abstract
163
+ * @param {number} n - Index of test that failed.
164
+ * @param {Test} test - Instance containing test information.
165
+ */
166
+ TAPProducer.prototype.writeFail = function(n, test) {
167
+ println("not ok %d %s", n, title(test));
168
+ };
169
+ /**
170
+ * Writes the summary epilogue to reporter output stream.
171
+ *
172
+ * @abstract
173
+ * @param {Object} stats - Object containing run statistics.
174
+ */
175
+ TAPProducer.prototype.writeEpilogue = function(stats) {
176
+ println("# tests " + (stats.passes + stats.failures));
177
+ println("# pass " + stats.passes);
178
+ println("# fail " + stats.failures);
179
+ this.writePlan(stats.passes + stats.failures + stats.pending);
180
+ };
181
+ /**
182
+ * @summary
183
+ * Constructs a new TAP12Producer.
184
+ *
185
+ * @description
186
+ * Produces output conforming to the TAP12 specification.
187
+ *
188
+ * @private
189
+ * @constructor
190
+ * @extends TAPProducer
191
+ * @see {@link https://testanything.org/tap-specification.html|Specification}
192
+ */
193
+ function TAP12Producer() {
194
+ /**
195
+ * Writes that test failed to reporter output stream, with error formatting.
196
+ * @override
197
+ */
198
+ this.writeFail = function(n, test, err) {
199
+ TAPProducer.prototype.writeFail.call(this, n, test, err);
200
+ if (err.message) println(err.message.replace(/^/gm, " "));
201
+ if (err.stack) println(err.stack.replace(/^/gm, " "));
202
+ };
203
+ }
204
+ /**
205
+ * Inherit from `TAPProducer.prototype`.
206
+ */
207
+ inherits(TAP12Producer, TAPProducer);
208
+ /**
209
+ * @summary
210
+ * Constructs a new TAP13Producer.
211
+ *
212
+ * @description
213
+ * Produces output conforming to the TAP13 specification.
214
+ *
215
+ * @private
216
+ * @constructor
217
+ * @extends TAPProducer
218
+ * @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
219
+ */
220
+ function TAP13Producer() {
221
+ /**
222
+ * Writes the TAP version to reporter output stream.
223
+ * @override
224
+ */
225
+ this.writeVersion = function() {
226
+ println("TAP version 13");
227
+ };
228
+ /**
229
+ * Writes that test failed to reporter output stream, with error formatting.
230
+ * @override
231
+ */
232
+ this.writeFail = function(n, test, err) {
233
+ TAPProducer.prototype.writeFail.call(this, n, test, err);
234
+ if (err.message != null || err.stack != null) {
235
+ println(indent(1) + "---");
236
+ if (err.message) {
237
+ println(indent(2) + "message: |-");
238
+ println(err.message.replace(/^/gm, indent(3)));
239
+ }
240
+ if (err.stack) {
241
+ println(indent(2) + "stack: |-");
242
+ println(err.stack.replace(/^/gm, indent(3)));
243
+ }
244
+ println(indent(1) + "...");
245
+ }
246
+ };
247
+ function indent(level) {
248
+ return Array(level + 1).join(" ");
249
+ }
250
+ }
251
+ /**
252
+ * Inherit from `TAPProducer.prototype`.
253
+ */
254
+ inherits(TAP13Producer, TAPProducer);
255
+ TAP.description = "TAP-compatible output";
256
+ }) });
257
+
258
+ //#endregion
259
+ export default require_tap();
260
+
261
+ export { require_tap };
@@ -0,0 +1,166 @@
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_runnable } from "../runnable.js";
5
+ import { require_runner } from "../runner.js";
6
+ import { require_base } from "./base.js";
7
+
8
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js
9
+ var require_xunit = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js": ((exports, module) => {
10
+ /**
11
+ * @typedef {import('../runner.js')} Runner
12
+ * @typedef {import('../test.js')} Test
13
+ */
14
+ /**
15
+ * @module XUnit
16
+ */
17
+ /**
18
+ * Module dependencies.
19
+ */
20
+ var Base = require_base();
21
+ var utils = require_utils();
22
+ var fs = __require("node:fs");
23
+ var path = __require("node:path");
24
+ var createUnsupportedError = require_errors().createUnsupportedError;
25
+ var constants = require_runner().constants;
26
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
27
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
28
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
29
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
30
+ var STATE_FAILED = require_runnable().constants.STATE_FAILED;
31
+ var inherits = utils.inherits;
32
+ var escape = utils.escape;
33
+ /**
34
+ * Save timer references to avoid Sinon interfering (see GH-237).
35
+ */
36
+ var Date = global.Date;
37
+ /**
38
+ * Expose `XUnit`.
39
+ */
40
+ exports = module.exports = XUnit;
41
+ /**
42
+ * Constructs a new `XUnit` 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 XUnit(runner, options) {
52
+ Base.call(this, runner, options);
53
+ var stats = this.stats;
54
+ var tests = [];
55
+ var self = this;
56
+ var suiteName;
57
+ var DEFAULT_SUITE_NAME = "Mocha Tests";
58
+ if (options && options.reporterOptions) {
59
+ if (options.reporterOptions.output) {
60
+ if (!fs.createWriteStream) throw createUnsupportedError("file output not supported in browser");
61
+ fs.mkdirSync(path.dirname(options.reporterOptions.output), { recursive: true });
62
+ self.fileStream = fs.createWriteStream(options.reporterOptions.output);
63
+ }
64
+ suiteName = options.reporterOptions.suiteName;
65
+ }
66
+ suiteName = suiteName || DEFAULT_SUITE_NAME;
67
+ runner.on(EVENT_TEST_PENDING, function(test) {
68
+ tests.push(test);
69
+ });
70
+ runner.on(EVENT_TEST_PASS, function(test) {
71
+ tests.push(test);
72
+ });
73
+ runner.on(EVENT_TEST_FAIL, function(test) {
74
+ tests.push(test);
75
+ });
76
+ runner.once(EVENT_RUN_END, function() {
77
+ self.write(tag("testsuite", {
78
+ name: suiteName,
79
+ tests: stats.tests,
80
+ failures: 0,
81
+ errors: stats.failures,
82
+ skipped: stats.tests - stats.failures - stats.passes,
83
+ timestamp: new Date().toUTCString(),
84
+ time: stats.duration / 1e3 || 0
85
+ }, false));
86
+ tests.forEach(function(t) {
87
+ self.test(t, options);
88
+ });
89
+ self.write("</testsuite>");
90
+ });
91
+ }
92
+ /**
93
+ * Inherit from `Base.prototype`.
94
+ */
95
+ inherits(XUnit, Base);
96
+ /**
97
+ * Override done to close the stream (if it's a file).
98
+ *
99
+ * @param failures
100
+ * @param {Function} fn
101
+ */
102
+ XUnit.prototype.done = function(failures, fn) {
103
+ if (this.fileStream) this.fileStream.end(function() {
104
+ fn(failures);
105
+ });
106
+ else fn(failures);
107
+ };
108
+ /**
109
+ * Write out the given line.
110
+ *
111
+ * @param {string} line
112
+ */
113
+ XUnit.prototype.write = function(line) {
114
+ if (this.fileStream) this.fileStream.write(line + "\n");
115
+ else if (typeof process === "object" && process.stdout) process.stdout.write(line + "\n");
116
+ else Base.consoleLog(line);
117
+ };
118
+ /**
119
+ * Output tag for the given `test.`
120
+ *
121
+ * @param {Test} test
122
+ */
123
+ XUnit.prototype.test = function(test, options) {
124
+ Base.useColors = false;
125
+ var attrs = {
126
+ classname: test.parent.fullTitle(),
127
+ name: test.title,
128
+ file: testFilePath(test.file, options),
129
+ time: test.duration / 1e3 || 0
130
+ };
131
+ if (test.state === STATE_FAILED) {
132
+ var err = test.err;
133
+ var diff = !Base.hideDiff && Base.showDiff(err) ? "\n" + Base.generateDiff(err.actual, err.expected) : "";
134
+ this.write(tag("testcase", attrs, false, tag("failure", {}, false, escape(err.message) + escape(diff) + "\n" + escape(err.stack))));
135
+ } else if (test.isPending()) this.write(tag("testcase", attrs, false, tag("skipped", {}, true)));
136
+ else this.write(tag("testcase", attrs, true));
137
+ };
138
+ /**
139
+ * HTML tag helper.
140
+ *
141
+ * @param name
142
+ * @param attrs
143
+ * @param close
144
+ * @param content
145
+ * @return {string}
146
+ */
147
+ function tag(name, attrs, close, content) {
148
+ var end = close ? "/>" : ">";
149
+ var pairs = [];
150
+ var tag$1;
151
+ for (var key in attrs) if (Object.prototype.hasOwnProperty.call(attrs, key)) pairs.push(key + "=\"" + escape(attrs[key]) + "\"");
152
+ tag$1 = "<" + name + (pairs.length ? " " + pairs.join(" ") : "") + end;
153
+ if (content) tag$1 += content + "</" + name + end;
154
+ return tag$1;
155
+ }
156
+ function testFilePath(filepath, options) {
157
+ if (options && options.reporterOptions && options.reporterOptions.showRelativePaths) return path.relative(process.cwd(), filepath);
158
+ return filepath;
159
+ }
160
+ XUnit.description = "XUnit-compatible XML output";
161
+ }) });
162
+
163
+ //#endregion
164
+ export default require_xunit();
165
+
166
+ export { require_xunit };