@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,104 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_suite } from "../suite.js";
3
+ import { require_test } from "../test.js";
4
+ import { require_common } from "./common.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js
7
+ var require_bdd = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../suite.js')} Suite
10
+ */
11
+ var Test = require_test();
12
+ var EVENT_FILE_PRE_REQUIRE = require_suite().constants.EVENT_FILE_PRE_REQUIRE;
13
+ /**
14
+ * BDD-style interface:
15
+ *
16
+ * describe('Array', function() {
17
+ * describe('#indexOf()', function() {
18
+ * it('should return -1 when not present', function() {
19
+ * // ...
20
+ * });
21
+ *
22
+ * it('should return the index when present', function() {
23
+ * // ...
24
+ * });
25
+ * });
26
+ * });
27
+ *
28
+ * @param {Suite} suite Root suite.
29
+ */
30
+ module.exports = function bddInterface(suite) {
31
+ var suites = [suite];
32
+ suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
33
+ var common = require_common()(suites, context, mocha);
34
+ context.before = common.before;
35
+ context.after = common.after;
36
+ context.beforeEach = common.beforeEach;
37
+ context.afterEach = common.afterEach;
38
+ context.run = mocha.options.delay && common.runWithSuite(suite);
39
+ /**
40
+ * Describe a "suite" with the given `title`
41
+ * and callback `fn` containing nested suites
42
+ * and/or tests.
43
+ */
44
+ context.describe = context.context = function(title, fn) {
45
+ return common.suite.create({
46
+ title,
47
+ file,
48
+ fn
49
+ });
50
+ };
51
+ /**
52
+ * Pending describe.
53
+ */
54
+ context.xdescribe = context.xcontext = context.describe.skip = function(title, fn) {
55
+ return common.suite.skip({
56
+ title,
57
+ file,
58
+ fn
59
+ });
60
+ };
61
+ /**
62
+ * Exclusive suite.
63
+ */
64
+ context.describe.only = function(title, fn) {
65
+ return common.suite.only({
66
+ title,
67
+ file,
68
+ fn
69
+ });
70
+ };
71
+ /**
72
+ * Describe a specification or test-case
73
+ * with the given `title` and callback `fn`
74
+ * acting as a thunk.
75
+ */
76
+ context.it = context.specify = function(title, fn) {
77
+ var suite$1 = suites[0];
78
+ if (suite$1.isPending()) fn = null;
79
+ var test = new Test(title, fn);
80
+ test.file = file;
81
+ suite$1.addTest(test);
82
+ return test;
83
+ };
84
+ /**
85
+ * Exclusive test-case.
86
+ */
87
+ context.it.only = function(title, fn) {
88
+ return common.test.only(mocha, context.it(title, fn));
89
+ };
90
+ /**
91
+ * Pending test case.
92
+ */
93
+ context.xit = context.xspecify = context.it.skip = function(title) {
94
+ return context.it(title);
95
+ };
96
+ });
97
+ };
98
+ module.exports.description = "BDD or RSpec style [default]";
99
+ }) });
100
+
101
+ //#endregion
102
+ export default require_bdd();
103
+
104
+ export { require_bdd };
@@ -0,0 +1,99 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_errors } from "../errors.js";
3
+ import { require_suite } from "../suite.js";
4
+
5
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js
6
+ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js": ((exports, module) => {
7
+ /**
8
+ * @typedef {import('../context.js')} Context
9
+ * @typedef {import('../mocha.js')} Mocha
10
+ */
11
+ /**
12
+ @module interfaces/common
13
+ */
14
+ var Suite = require_suite();
15
+ var errors = require_errors();
16
+ var createMissingArgumentError = errors.createMissingArgumentError;
17
+ var createUnsupportedError = errors.createUnsupportedError;
18
+ var createForbiddenExclusivityError = errors.createForbiddenExclusivityError;
19
+ /**
20
+ * Functions common to more than one interface.
21
+ *
22
+ * @private
23
+ * @param {Suite[]} suites
24
+ * @param {Context} context
25
+ * @param {Mocha} mocha
26
+ * @return {Object} An object containing common functions.
27
+ */
28
+ module.exports = function(suites, context, mocha) {
29
+ /**
30
+ * Check if the suite should be tested.
31
+ *
32
+ * @private
33
+ * @param {Suite} suite - suite to check
34
+ * @returns {boolean}
35
+ */
36
+ function shouldBeTested(suite) {
37
+ return !mocha.options.grep || mocha.options.grep && mocha.options.grep.test(suite.fullTitle()) && !mocha.options.invert;
38
+ }
39
+ return {
40
+ runWithSuite: function runWithSuite(suite) {
41
+ return function run() {
42
+ suite.run();
43
+ };
44
+ },
45
+ before: function(name, fn) {
46
+ return suites[0].beforeAll(name, fn);
47
+ },
48
+ after: function(name, fn) {
49
+ return suites[0].afterAll(name, fn);
50
+ },
51
+ beforeEach: function(name, fn) {
52
+ return suites[0].beforeEach(name, fn);
53
+ },
54
+ afterEach: function(name, fn) {
55
+ return suites[0].afterEach(name, fn);
56
+ },
57
+ suite: {
58
+ only: function only(opts) {
59
+ if (mocha.options.forbidOnly) throw createForbiddenExclusivityError(mocha);
60
+ opts.isOnly = true;
61
+ return this.create(opts);
62
+ },
63
+ skip: function skip(opts) {
64
+ opts.pending = true;
65
+ return this.create(opts);
66
+ },
67
+ create: function create(opts) {
68
+ var suite = Suite.create(suites[0], opts.title);
69
+ suite.pending = Boolean(opts.pending);
70
+ suite.file = opts.file;
71
+ suites.unshift(suite);
72
+ if (opts.isOnly) suite.markOnly();
73
+ if (suite.pending && mocha.options.forbidPending && shouldBeTested(suite)) throw createUnsupportedError("Pending test forbidden");
74
+ if (typeof opts.fn === "function") {
75
+ opts.fn.call(suite);
76
+ suites.shift();
77
+ } else if (typeof opts.fn === "undefined" && !suite.pending) throw createMissingArgumentError("Suite \"" + suite.fullTitle() + "\" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.", "callback", "function");
78
+ else if (!opts.fn && suite.pending) suites.shift();
79
+ return suite;
80
+ }
81
+ },
82
+ test: {
83
+ only: function(mocha$1, test) {
84
+ if (mocha$1.options.forbidOnly) throw createForbiddenExclusivityError(mocha$1);
85
+ test.markOnly();
86
+ return test;
87
+ },
88
+ skip: function(title) {
89
+ context.test(title);
90
+ }
91
+ }
92
+ };
93
+ };
94
+ }) });
95
+
96
+ //#endregion
97
+ export default require_common();
98
+
99
+ export { require_common };
@@ -0,0 +1,65 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_suite } from "../suite.js";
3
+ import { require_test } from "../test.js";
4
+
5
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js
6
+ var require_exports = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js": ((exports, module) => {
7
+ var Suite = require_suite();
8
+ var Test = require_test();
9
+ /**
10
+ * Exports-style (as Node.js module) interface:
11
+ *
12
+ * exports.Array = {
13
+ * '#indexOf()': {
14
+ * 'should return -1 when the value is not present': function() {
15
+ *
16
+ * },
17
+ *
18
+ * 'should return the correct index when the value is present': function() {
19
+ *
20
+ * }
21
+ * }
22
+ * };
23
+ *
24
+ * @param {Suite} suite Root suite.
25
+ */
26
+ module.exports = function(suite) {
27
+ var suites = [suite];
28
+ suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
29
+ function visit(obj, file) {
30
+ var suite$1;
31
+ for (var key in obj) if (typeof obj[key] === "function") {
32
+ var fn = obj[key];
33
+ switch (key) {
34
+ case "before":
35
+ suites[0].beforeAll(fn);
36
+ break;
37
+ case "after":
38
+ suites[0].afterAll(fn);
39
+ break;
40
+ case "beforeEach":
41
+ suites[0].beforeEach(fn);
42
+ break;
43
+ case "afterEach":
44
+ suites[0].afterEach(fn);
45
+ break;
46
+ default:
47
+ var test = new Test(key, fn);
48
+ test.file = file;
49
+ suites[0].addTest(test);
50
+ }
51
+ } else {
52
+ suite$1 = Suite.create(suites[0], key);
53
+ suites.unshift(suite$1);
54
+ visit(obj[key], file);
55
+ suites.shift();
56
+ }
57
+ }
58
+ };
59
+ module.exports.description = "Node.js module (\"exports\") style";
60
+ }) });
61
+
62
+ //#endregion
63
+ export default require_exports();
64
+
65
+ export { require_exports };
@@ -0,0 +1,18 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_bdd } from "./bdd.js";
3
+ import { require_tdd } from "./tdd.js";
4
+ import { require_qunit } from "./qunit.js";
5
+ import { require_exports } from "./exports.js";
6
+
7
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js
8
+ var require_interfaces = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js": ((exports) => {
9
+ exports.bdd = require_bdd();
10
+ exports.tdd = require_tdd();
11
+ exports.qunit = require_qunit();
12
+ exports.exports = require_exports();
13
+ }) });
14
+
15
+ //#endregion
16
+ export default require_interfaces();
17
+
18
+ export { require_interfaces };
@@ -0,0 +1,95 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_suite } from "../suite.js";
3
+ import { require_test } from "../test.js";
4
+ import { require_common } from "./common.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js
7
+ var require_qunit = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../suite.js')} Suite
10
+ */
11
+ var Test = require_test();
12
+ var EVENT_FILE_PRE_REQUIRE = require_suite().constants.EVENT_FILE_PRE_REQUIRE;
13
+ /**
14
+ * QUnit-style interface:
15
+ *
16
+ * suite('Array');
17
+ *
18
+ * test('#length', function() {
19
+ * var arr = [1,2,3];
20
+ * ok(arr.length == 3);
21
+ * });
22
+ *
23
+ * test('#indexOf()', function() {
24
+ * var arr = [1,2,3];
25
+ * ok(arr.indexOf(1) == 0);
26
+ * ok(arr.indexOf(2) == 1);
27
+ * ok(arr.indexOf(3) == 2);
28
+ * });
29
+ *
30
+ * suite('String');
31
+ *
32
+ * test('#length', function() {
33
+ * ok('foo'.length == 3);
34
+ * });
35
+ *
36
+ * @param {Suite} suite Root suite.
37
+ */
38
+ module.exports = function qUnitInterface(suite) {
39
+ var suites = [suite];
40
+ suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
41
+ var common = require_common()(suites, context, mocha);
42
+ context.before = common.before;
43
+ context.after = common.after;
44
+ context.beforeEach = common.beforeEach;
45
+ context.afterEach = common.afterEach;
46
+ context.run = mocha.options.delay && common.runWithSuite(suite);
47
+ /**
48
+ * Describe a "suite" with the given `title`.
49
+ */
50
+ context.suite = function(title) {
51
+ if (suites.length > 1) suites.shift();
52
+ return common.suite.create({
53
+ title,
54
+ file,
55
+ fn: false
56
+ });
57
+ };
58
+ /**
59
+ * Exclusive Suite.
60
+ */
61
+ context.suite.only = function(title) {
62
+ if (suites.length > 1) suites.shift();
63
+ return common.suite.only({
64
+ title,
65
+ file,
66
+ fn: false
67
+ });
68
+ };
69
+ /**
70
+ * Describe a specification or test-case
71
+ * with the given `title` and callback `fn`
72
+ * acting as a thunk.
73
+ */
74
+ context.test = function(title, fn) {
75
+ var test = new Test(title, fn);
76
+ test.file = file;
77
+ suites[0].addTest(test);
78
+ return test;
79
+ };
80
+ /**
81
+ * Exclusive test-case.
82
+ */
83
+ context.test.only = function(title, fn) {
84
+ return common.test.only(mocha, context.test(title, fn));
85
+ };
86
+ context.test.skip = common.test.skip;
87
+ });
88
+ };
89
+ module.exports.description = "QUnit style";
90
+ }) });
91
+
92
+ //#endregion
93
+ export default require_qunit();
94
+
95
+ export { require_qunit };
@@ -0,0 +1,105 @@
1
+ import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { require_suite } from "../suite.js";
3
+ import { require_test } from "../test.js";
4
+ import { require_common } from "./common.js";
5
+
6
+ //#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js
7
+ var require_tdd = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../suite.js')} Suite
10
+ */
11
+ var Test = require_test();
12
+ var EVENT_FILE_PRE_REQUIRE = require_suite().constants.EVENT_FILE_PRE_REQUIRE;
13
+ /**
14
+ * TDD-style interface:
15
+ *
16
+ * suite('Array', function() {
17
+ * suite('#indexOf()', function() {
18
+ * suiteSetup(function() {
19
+ *
20
+ * });
21
+ *
22
+ * test('should return -1 when not present', function() {
23
+ *
24
+ * });
25
+ *
26
+ * test('should return the index when present', function() {
27
+ *
28
+ * });
29
+ *
30
+ * suiteTeardown(function() {
31
+ *
32
+ * });
33
+ * });
34
+ * });
35
+ *
36
+ * @param {Suite} suite Root suite.
37
+ */
38
+ module.exports = function(suite) {
39
+ var suites = [suite];
40
+ suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
41
+ var common = require_common()(suites, context, mocha);
42
+ context.setup = common.beforeEach;
43
+ context.teardown = common.afterEach;
44
+ context.suiteSetup = common.before;
45
+ context.suiteTeardown = common.after;
46
+ context.run = mocha.options.delay && common.runWithSuite(suite);
47
+ /**
48
+ * Describe a "suite" with the given `title` and callback `fn` containing
49
+ * nested suites and/or tests.
50
+ */
51
+ context.suite = function(title, fn) {
52
+ return common.suite.create({
53
+ title,
54
+ file,
55
+ fn
56
+ });
57
+ };
58
+ /**
59
+ * Pending suite.
60
+ */
61
+ context.suite.skip = function(title, fn) {
62
+ return common.suite.skip({
63
+ title,
64
+ file,
65
+ fn
66
+ });
67
+ };
68
+ /**
69
+ * Exclusive test-case.
70
+ */
71
+ context.suite.only = function(title, fn) {
72
+ return common.suite.only({
73
+ title,
74
+ file,
75
+ fn
76
+ });
77
+ };
78
+ /**
79
+ * Describe a specification or test-case with the given `title` and
80
+ * callback `fn` acting as a thunk.
81
+ */
82
+ context.test = function(title, fn) {
83
+ var suite$1 = suites[0];
84
+ if (suite$1.isPending()) fn = null;
85
+ var test = new Test(title, fn);
86
+ test.file = file;
87
+ suite$1.addTest(test);
88
+ return test;
89
+ };
90
+ /**
91
+ * Exclusive test-case.
92
+ */
93
+ context.test.only = function(title, fn) {
94
+ return common.test.only(mocha, context.test(title, fn));
95
+ };
96
+ context.test.skip = common.test.skip;
97
+ });
98
+ };
99
+ module.exports.description = "traditional \"suite\"/\"test\" instead of BDD's \"describe\"/\"it\"";
100
+ }) });
101
+
102
+ //#endregion
103
+ export default require_tdd();
104
+
105
+ export { require_tdd };