@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,77 @@
1
+ import { __commonJS } 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/list.js
7
+ var require_list = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module List
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var inherits = require_utils().inherits;
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
21
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
22
+ var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
23
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
24
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
25
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
26
+ var color = Base.color;
27
+ var cursor = Base.cursor;
28
+ /**
29
+ * Expose `List`.
30
+ */
31
+ exports = module.exports = List;
32
+ /**
33
+ * Constructs a new `List` reporter instance.
34
+ *
35
+ * @public
36
+ * @class
37
+ * @memberof Mocha.reporters
38
+ * @extends Mocha.reporters.Base
39
+ * @param {Runner} runner - Instance triggers reporter actions.
40
+ * @param {Object} [options] - runner options
41
+ */
42
+ function List(runner, options) {
43
+ Base.call(this, runner, options);
44
+ var self = this;
45
+ var n = 0;
46
+ runner.on(EVENT_RUN_BEGIN, function() {
47
+ Base.consoleLog();
48
+ });
49
+ runner.on(EVENT_TEST_BEGIN, function(test) {
50
+ process.stdout.write(color("pass", " " + test.fullTitle() + ": "));
51
+ });
52
+ runner.on(EVENT_TEST_PENDING, function(test) {
53
+ var fmt = color("checkmark", " -") + color("pending", " %s");
54
+ Base.consoleLog(fmt, test.fullTitle());
55
+ });
56
+ runner.on(EVENT_TEST_PASS, function(test) {
57
+ var fmt = color("checkmark", " " + Base.symbols.ok) + color("pass", " %s: ") + color(test.speed, "%dms");
58
+ cursor.CR();
59
+ Base.consoleLog(fmt, test.fullTitle(), test.duration);
60
+ });
61
+ runner.on(EVENT_TEST_FAIL, function(test) {
62
+ cursor.CR();
63
+ Base.consoleLog(color("fail", " %d) %s"), ++n, test.fullTitle());
64
+ });
65
+ runner.once(EVENT_RUN_END, self.epilogue.bind(self));
66
+ }
67
+ /**
68
+ * Inherit from `Base.prototype`.
69
+ */
70
+ inherits(List, Base);
71
+ List.description = "like \"spec\" reporter but flat";
72
+ }) });
73
+
74
+ //#endregion
75
+ export default require_list();
76
+
77
+ export { require_list };
@@ -0,0 +1,106 @@
1
+ import { __commonJS } 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/markdown.js
7
+ var require_markdown = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Markdown
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var utils = require_utils();
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
21
+ var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
22
+ var EVENT_SUITE_END = constants.EVENT_SUITE_END;
23
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
24
+ /**
25
+ * Constants
26
+ */
27
+ var SUITE_PREFIX = "$";
28
+ /**
29
+ * Expose `Markdown`.
30
+ */
31
+ exports = module.exports = Markdown;
32
+ /**
33
+ * Constructs a new `Markdown` reporter instance.
34
+ *
35
+ * @public
36
+ * @class
37
+ * @memberof Mocha.reporters
38
+ * @extends Mocha.reporters.Base
39
+ * @param {Runner} runner - Instance triggers reporter actions.
40
+ * @param {Object} [options] - runner options
41
+ */
42
+ function Markdown(runner, options) {
43
+ Base.call(this, runner, options);
44
+ var level = 0;
45
+ var buf = "";
46
+ function title(str) {
47
+ return Array(level).join("#") + " " + str;
48
+ }
49
+ function mapTOC(suite, obj) {
50
+ var ret = obj;
51
+ var key = SUITE_PREFIX + suite.title;
52
+ obj = obj[key] = obj[key] || { suite };
53
+ suite.suites.forEach(function(suite$1) {
54
+ mapTOC(suite$1, obj);
55
+ });
56
+ return ret;
57
+ }
58
+ function stringifyTOC(obj, level$1) {
59
+ ++level$1;
60
+ var buf$1 = "";
61
+ var link;
62
+ for (var key in obj) {
63
+ if (key === "suite") continue;
64
+ if (key !== SUITE_PREFIX) {
65
+ link = " - [" + key.substring(1) + "]";
66
+ link += "(#" + utils.slug(obj[key].suite.fullTitle()) + ")\n";
67
+ buf$1 += Array(level$1).join(" ") + link;
68
+ }
69
+ buf$1 += stringifyTOC(obj[key], level$1);
70
+ }
71
+ return buf$1;
72
+ }
73
+ function generateTOC(suite) {
74
+ var obj = mapTOC(suite, {});
75
+ return stringifyTOC(obj, 0);
76
+ }
77
+ generateTOC(runner.suite);
78
+ runner.on(EVENT_SUITE_BEGIN, function(suite) {
79
+ ++level;
80
+ var slug = utils.slug(suite.fullTitle());
81
+ buf += "<a name=\"" + slug + "\"></a>\n";
82
+ buf += title(suite.title) + "\n";
83
+ });
84
+ runner.on(EVENT_SUITE_END, function() {
85
+ --level;
86
+ });
87
+ runner.on(EVENT_TEST_PASS, function(test) {
88
+ var code = utils.clean(test.body);
89
+ buf += test.title + ".\n";
90
+ buf += "\n```js\n";
91
+ buf += code + "\n";
92
+ buf += "```\n\n";
93
+ });
94
+ runner.once(EVENT_RUN_END, function() {
95
+ process.stdout.write("# TOC\n");
96
+ process.stdout.write(generateTOC(runner.suite));
97
+ process.stdout.write(buf);
98
+ });
99
+ }
100
+ Markdown.description = "GitHub Flavored Markdown";
101
+ }) });
102
+
103
+ //#endregion
104
+ export default require_markdown();
105
+
106
+ export { require_markdown };
@@ -0,0 +1,57 @@
1
+ import { __commonJS } 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/min.js
7
+ var require_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Min
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var inherits = require_utils().inherits;
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
21
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
22
+ /**
23
+ * Expose `Min`.
24
+ */
25
+ exports = module.exports = Min;
26
+ /**
27
+ * Constructs a new `Min` reporter instance.
28
+ *
29
+ * @description
30
+ * This minimal test reporter is best used with '--watch'.
31
+ *
32
+ * @public
33
+ * @class
34
+ * @memberof Mocha.reporters
35
+ * @extends Mocha.reporters.Base
36
+ * @param {Runner} runner - Instance triggers reporter actions.
37
+ * @param {Object} [options] - runner options
38
+ */
39
+ function Min(runner, options) {
40
+ Base.call(this, runner, options);
41
+ runner.on(EVENT_RUN_BEGIN, function() {
42
+ process.stdout.write("\x1B[2J");
43
+ process.stdout.write("\x1B[1;3H");
44
+ });
45
+ runner.once(EVENT_RUN_END, this.epilogue.bind(this));
46
+ }
47
+ /**
48
+ * Inherit from `Base.prototype`.
49
+ */
50
+ inherits(Min, Base);
51
+ Min.description = "essentially just a summary";
52
+ }) });
53
+
54
+ //#endregion
55
+ export default require_min();
56
+
57
+ export { require_min };
@@ -0,0 +1,233 @@
1
+ import { __commonJS } 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/nyan.js
7
+ var require_nyan = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Nyan
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var constants = require_runner().constants;
19
+ var inherits = require_utils().inherits;
20
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
21
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
22
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
23
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
24
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
25
+ /**
26
+ * Expose `Dot`.
27
+ */
28
+ exports = module.exports = NyanCat;
29
+ /**
30
+ * Constructs a new `Nyan` reporter instance.
31
+ *
32
+ * @public
33
+ * @class Nyan
34
+ * @memberof Mocha.reporters
35
+ * @extends Mocha.reporters.Base
36
+ * @param {Runner} runner - Instance triggers reporter actions.
37
+ * @param {Object} [options] - runner options
38
+ */
39
+ function NyanCat(runner, options) {
40
+ Base.call(this, runner, options);
41
+ var self = this;
42
+ var width = Base.window.width * .75 | 0;
43
+ var nyanCatWidth = this.nyanCatWidth = 11;
44
+ this.colorIndex = 0;
45
+ this.numberOfLines = 4;
46
+ this.rainbowColors = self.generateColors();
47
+ this.scoreboardWidth = 5;
48
+ this.tick = 0;
49
+ this.trajectories = [
50
+ [],
51
+ [],
52
+ [],
53
+ []
54
+ ];
55
+ this.trajectoryWidthMax = width - nyanCatWidth;
56
+ runner.on(EVENT_RUN_BEGIN, function() {
57
+ Base.cursor.hide();
58
+ self.draw();
59
+ });
60
+ runner.on(EVENT_TEST_PENDING, function() {
61
+ self.draw();
62
+ });
63
+ runner.on(EVENT_TEST_PASS, function() {
64
+ self.draw();
65
+ });
66
+ runner.on(EVENT_TEST_FAIL, function() {
67
+ self.draw();
68
+ });
69
+ runner.once(EVENT_RUN_END, function() {
70
+ Base.cursor.show();
71
+ for (var i = 0; i < self.numberOfLines; i++) process.stdout.write("\n");
72
+ self.epilogue();
73
+ });
74
+ }
75
+ /**
76
+ * Inherit from `Base.prototype`.
77
+ */
78
+ inherits(NyanCat, Base);
79
+ /**
80
+ * Draw the nyan cat
81
+ *
82
+ * @private
83
+ */
84
+ NyanCat.prototype.draw = function() {
85
+ this.appendRainbow();
86
+ this.drawScoreboard();
87
+ this.drawRainbow();
88
+ this.drawNyanCat();
89
+ this.tick = !this.tick;
90
+ };
91
+ /**
92
+ * Draw the "scoreboard" showing the number
93
+ * of passes, failures and pending tests.
94
+ *
95
+ * @private
96
+ */
97
+ NyanCat.prototype.drawScoreboard = function() {
98
+ var stats = this.stats;
99
+ function draw(type, n) {
100
+ process.stdout.write(" ");
101
+ process.stdout.write(Base.color(type, n));
102
+ process.stdout.write("\n");
103
+ }
104
+ draw("green", stats.passes);
105
+ draw("fail", stats.failures);
106
+ draw("pending", stats.pending);
107
+ process.stdout.write("\n");
108
+ this.cursorUp(this.numberOfLines);
109
+ };
110
+ /**
111
+ * Append the rainbow.
112
+ *
113
+ * @private
114
+ */
115
+ NyanCat.prototype.appendRainbow = function() {
116
+ var segment = this.tick ? "_" : "-";
117
+ var rainbowified = this.rainbowify(segment);
118
+ for (var index = 0; index < this.numberOfLines; index++) {
119
+ var trajectory = this.trajectories[index];
120
+ if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift();
121
+ trajectory.push(rainbowified);
122
+ }
123
+ };
124
+ /**
125
+ * Draw the rainbow.
126
+ *
127
+ * @private
128
+ */
129
+ NyanCat.prototype.drawRainbow = function() {
130
+ var self = this;
131
+ this.trajectories.forEach(function(line) {
132
+ process.stdout.write("\x1B[" + self.scoreboardWidth + "C");
133
+ process.stdout.write(line.join(""));
134
+ process.stdout.write("\n");
135
+ });
136
+ this.cursorUp(this.numberOfLines);
137
+ };
138
+ /**
139
+ * Draw the nyan cat
140
+ *
141
+ * @private
142
+ */
143
+ NyanCat.prototype.drawNyanCat = function() {
144
+ var self = this;
145
+ var dist = "\x1B[" + (this.scoreboardWidth + this.trajectories[0].length) + "C";
146
+ var padding = "";
147
+ process.stdout.write(dist);
148
+ process.stdout.write("_,------,");
149
+ process.stdout.write("\n");
150
+ process.stdout.write(dist);
151
+ padding = self.tick ? " " : " ";
152
+ process.stdout.write("_|" + padding + "/\\_/\\ ");
153
+ process.stdout.write("\n");
154
+ process.stdout.write(dist);
155
+ padding = self.tick ? "_" : "__";
156
+ var tail = self.tick ? "~" : "^";
157
+ process.stdout.write(tail + "|" + padding + this.face() + " ");
158
+ process.stdout.write("\n");
159
+ process.stdout.write(dist);
160
+ padding = self.tick ? " " : " ";
161
+ process.stdout.write(padding + "\"\" \"\" ");
162
+ process.stdout.write("\n");
163
+ this.cursorUp(this.numberOfLines);
164
+ };
165
+ /**
166
+ * Draw nyan cat face.
167
+ *
168
+ * @private
169
+ * @return {string}
170
+ */
171
+ NyanCat.prototype.face = function() {
172
+ var stats = this.stats;
173
+ if (stats.failures) return "( x .x)";
174
+ else if (stats.pending) return "( o .o)";
175
+ else if (stats.passes) return "( ^ .^)";
176
+ return "( - .-)";
177
+ };
178
+ /**
179
+ * Move cursor up `n`.
180
+ *
181
+ * @private
182
+ * @param {number} n
183
+ */
184
+ NyanCat.prototype.cursorUp = function(n) {
185
+ process.stdout.write("\x1B[" + n + "A");
186
+ };
187
+ /**
188
+ * Move cursor down `n`.
189
+ *
190
+ * @private
191
+ * @param {number} n
192
+ */
193
+ NyanCat.prototype.cursorDown = function(n) {
194
+ process.stdout.write("\x1B[" + n + "B");
195
+ };
196
+ /**
197
+ * Generate rainbow colors.
198
+ *
199
+ * @private
200
+ * @return {Array}
201
+ */
202
+ NyanCat.prototype.generateColors = function() {
203
+ var colors = [];
204
+ for (var i = 0; i < 42; i++) {
205
+ var pi3 = Math.floor(Math.PI / 3);
206
+ var n = i * (1 / 6);
207
+ var r = Math.floor(3 * Math.sin(n) + 3);
208
+ var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
209
+ var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
210
+ colors.push(36 * r + 6 * g + b + 16);
211
+ }
212
+ return colors;
213
+ };
214
+ /**
215
+ * Apply rainbow to the given `str`.
216
+ *
217
+ * @private
218
+ * @param {string} str
219
+ * @return {string}
220
+ */
221
+ NyanCat.prototype.rainbowify = function(str) {
222
+ if (!Base.useColors) return str;
223
+ var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
224
+ this.colorIndex += 1;
225
+ return "\x1B[38;5;" + color + "m" + str + "\x1B[0m";
226
+ };
227
+ NyanCat.description = "\"nyan cat\"";
228
+ }) });
229
+
230
+ //#endregion
231
+ export default require_nyan();
232
+
233
+ export { require_nyan };
@@ -0,0 +1,92 @@
1
+ import { __commonJS } 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/progress.js
7
+ var require_progress = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ */
11
+ /**
12
+ * @module Progress
13
+ */
14
+ /**
15
+ * Module dependencies.
16
+ */
17
+ var Base = require_base();
18
+ var constants = require_runner().constants;
19
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
20
+ var EVENT_TEST_END = constants.EVENT_TEST_END;
21
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
22
+ var inherits = require_utils().inherits;
23
+ var color = Base.color;
24
+ var cursor = Base.cursor;
25
+ /**
26
+ * Expose `Progress`.
27
+ */
28
+ exports = module.exports = Progress;
29
+ /**
30
+ * General progress bar color.
31
+ */
32
+ Base.colors.progress = 90;
33
+ /**
34
+ * Constructs a new `Progress` 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 Progress(runner, options) {
44
+ Base.call(this, runner, options);
45
+ var self = this;
46
+ var width = Base.window.width * .5 | 0;
47
+ var total = runner.total;
48
+ var complete = 0;
49
+ var lastN = -1;
50
+ options = options || {};
51
+ var reporterOptions = options.reporterOptions || {};
52
+ options.open = reporterOptions.open || "[";
53
+ options.complete = reporterOptions.complete || "▬";
54
+ options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
55
+ options.close = reporterOptions.close || "]";
56
+ options.verbose = reporterOptions.verbose || false;
57
+ runner.on(EVENT_RUN_BEGIN, function() {
58
+ process.stdout.write("\n");
59
+ cursor.hide();
60
+ });
61
+ runner.on(EVENT_TEST_END, function() {
62
+ complete++;
63
+ var percent = complete / total;
64
+ var n = width * percent | 0;
65
+ var i = width - n;
66
+ if (n === lastN && !options.verbose) return;
67
+ lastN = n;
68
+ cursor.CR();
69
+ process.stdout.write("\x1B[J");
70
+ process.stdout.write(color("progress", " " + options.open));
71
+ process.stdout.write(Array(n).join(options.complete));
72
+ process.stdout.write(Array(i).join(options.incomplete));
73
+ process.stdout.write(color("progress", options.close));
74
+ if (options.verbose) process.stdout.write(color("progress", " " + complete + " of " + total));
75
+ });
76
+ runner.once(EVENT_RUN_END, function() {
77
+ cursor.show();
78
+ process.stdout.write("\n");
79
+ self.epilogue();
80
+ });
81
+ }
82
+ /**
83
+ * Inherit from `Base.prototype`.
84
+ */
85
+ inherits(Progress, Base);
86
+ Progress.description = "a progress bar";
87
+ }) });
88
+
89
+ //#endregion
90
+ export default require_progress();
91
+
92
+ export { require_progress };
@@ -0,0 +1,91 @@
1
+ import { __commonJS } 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/spec.js
7
+ var require_spec = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js": ((exports, module) => {
8
+ /**
9
+ * @typedef {import('../runner.js')} Runner
10
+ * @typedef {import('../test.js')} Test
11
+ */
12
+ /**
13
+ * @module Spec
14
+ */
15
+ /**
16
+ * Module dependencies.
17
+ */
18
+ var Base = require_base();
19
+ var constants = require_runner().constants;
20
+ var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
21
+ var EVENT_RUN_END = constants.EVENT_RUN_END;
22
+ var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
23
+ var EVENT_SUITE_END = constants.EVENT_SUITE_END;
24
+ var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
25
+ var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
26
+ var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
27
+ var inherits = require_utils().inherits;
28
+ var color = Base.color;
29
+ /**
30
+ * Expose `Spec`.
31
+ */
32
+ exports = module.exports = Spec;
33
+ /**
34
+ * Constructs a new `Spec` 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 Spec(runner, options) {
44
+ Base.call(this, runner, options);
45
+ var self = this;
46
+ var indents = 0;
47
+ var n = 0;
48
+ function indent() {
49
+ return Array(indents).join(" ");
50
+ }
51
+ runner.on(EVENT_RUN_BEGIN, function() {
52
+ Base.consoleLog();
53
+ });
54
+ runner.on(EVENT_SUITE_BEGIN, function(suite) {
55
+ ++indents;
56
+ Base.consoleLog(color("suite", "%s%s"), indent(), suite.title);
57
+ });
58
+ runner.on(EVENT_SUITE_END, function() {
59
+ --indents;
60
+ if (indents === 1) Base.consoleLog();
61
+ });
62
+ runner.on(EVENT_TEST_PENDING, function(test) {
63
+ var fmt = indent() + color("pending", " - %s");
64
+ Base.consoleLog(fmt, test.title);
65
+ });
66
+ runner.on(EVENT_TEST_PASS, function(test) {
67
+ var fmt;
68
+ if (test.speed === "fast") {
69
+ fmt = indent() + color("checkmark", " " + Base.symbols.ok) + color("pass", " %s");
70
+ Base.consoleLog(fmt, test.title);
71
+ } else {
72
+ fmt = indent() + color("checkmark", " " + Base.symbols.ok) + color("pass", " %s") + color(test.speed, " (%dms)");
73
+ Base.consoleLog(fmt, test.title, test.duration);
74
+ }
75
+ });
76
+ runner.on(EVENT_TEST_FAIL, function(test) {
77
+ Base.consoleLog(indent() + color("fail", " %d) %s"), ++n, test.title);
78
+ });
79
+ runner.once(EVENT_RUN_END, self.epilogue.bind(self));
80
+ }
81
+ /**
82
+ * Inherit from `Base.prototype`.
83
+ */
84
+ inherits(Spec, Base);
85
+ Spec.description = "hierarchical & verbose [default]";
86
+ }) });
87
+
88
+ //#endregion
89
+ export default require_spec();
90
+
91
+ export { require_spec };