cdk-ecr-deployment 3.3.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/.jsii +26 -107
  2. package/.jsii.tabl.json +1 -1
  3. package/API.md +0 -59
  4. package/README.md +7 -17
  5. package/lib/index.d.ts +1 -29
  6. package/lib/index.js +8 -26
  7. package/package.json +1 -13
  8. package/build-lambda.sh +0 -12
  9. package/lambda-src/.dockerignore +0 -9
  10. package/lambda-src/Dockerfile +0 -26
  11. package/lambda-src/Makefile +0 -33
  12. package/lambda-src/go.mod +0 -136
  13. package/lambda-src/go.sum +0 -499
  14. package/lambda-src/internal/iolimits/iolimits.go +0 -68
  15. package/lambda-src/internal/iolimits/iolimits_test.go +0 -39
  16. package/lambda-src/internal/tarfile/reader.go +0 -179
  17. package/lambda-src/internal/tarfile/reader_test.go +0 -31
  18. package/lambda-src/internal/tarfile/s3file.go +0 -363
  19. package/lambda-src/internal/tarfile/s3file_test.go +0 -135
  20. package/lambda-src/internal/tarfile/src.go +0 -328
  21. package/lambda-src/internal/tarfile/types.go +0 -31
  22. package/lambda-src/main.go +0 -176
  23. package/lambda-src/main_test.go +0 -64
  24. package/lambda-src/s3/src.go +0 -40
  25. package/lambda-src/s3/transport.go +0 -149
  26. package/lambda-src/s3/transport_test.go +0 -96
  27. package/lambda-src/utils.go +0 -206
  28. package/lambda-src/utils_test.go +0 -63
  29. package/lib/config.d.ts +0 -1
  30. package/lib/config.js +0 -12
  31. package/node_modules/@sindresorhus/is/dist/index.d.ts +0 -232
  32. package/node_modules/@sindresorhus/is/dist/index.js +0 -434
  33. package/node_modules/@sindresorhus/is/dist/types.d.ts +0 -25
  34. package/node_modules/@sindresorhus/is/dist/types.js +0 -3
  35. package/node_modules/@sindresorhus/is/license +0 -9
  36. package/node_modules/@sindresorhus/is/package.json +0 -96
  37. package/node_modules/@sindresorhus/is/readme.md +0 -669
  38. package/node_modules/@szmarczak/http-timer/LICENSE +0 -21
  39. package/node_modules/@szmarczak/http-timer/README.md +0 -93
  40. package/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +0 -32
  41. package/node_modules/@szmarczak/http-timer/dist/source/index.js +0 -126
  42. package/node_modules/@szmarczak/http-timer/package.json +0 -72
  43. package/node_modules/@types/cacheable-request/LICENSE +0 -21
  44. package/node_modules/@types/cacheable-request/README.md +0 -16
  45. package/node_modules/@types/cacheable-request/index.d.ts +0 -137
  46. package/node_modules/@types/cacheable-request/node_modules/@types/node/LICENSE +0 -21
  47. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +0 -15
  48. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +0 -8
  49. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +0 -1095
  50. package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +0 -541
  51. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.buffer.d.ts +0 -460
  52. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +0 -1926
  53. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +0 -1549
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +0 -579
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/index.d.ts +0 -9
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +0 -452
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +0 -21
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +0 -4510
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +0 -599
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +0 -476
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +0 -865
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/dom-events.d.ts +0 -124
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +0 -170
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +0 -931
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +0 -1275
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +0 -4343
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +0 -511
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  73. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +0 -1959
  74. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +0 -2558
  75. package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +0 -543
  76. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +0 -92
  77. package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +0 -3966
  78. package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +0 -702
  79. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +0 -1029
  80. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +0 -495
  81. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +0 -220
  82. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +0 -200
  83. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +0 -970
  84. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +0 -2013
  85. package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +0 -117
  86. package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +0 -153
  87. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline/promises.d.ts +0 -162
  88. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +0 -589
  89. package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +0 -430
  90. package/node_modules/@types/cacheable-request/node_modules/@types/node/sea.d.ts +0 -153
  91. package/node_modules/@types/cacheable-request/node_modules/@types/node/sqlite.d.ts +0 -439
  92. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +0 -12
  93. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +0 -90
  94. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +0 -614
  95. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +0 -1662
  96. package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +0 -67
  97. package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +0 -2150
  98. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +0 -97
  99. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +0 -240
  100. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +0 -1226
  101. package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +0 -197
  102. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -457
  103. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  104. package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/index.d.ts +0 -92
  105. package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +0 -208
  106. package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +0 -972
  107. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +0 -2439
  108. package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +0 -808
  109. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +0 -976
  110. package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +0 -181
  111. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +0 -745
  112. package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +0 -539
  113. package/node_modules/@types/cacheable-request/node_modules/undici-types/LICENSE +0 -21
  114. package/node_modules/@types/cacheable-request/node_modules/undici-types/README.md +0 -6
  115. package/node_modules/@types/cacheable-request/node_modules/undici-types/agent.d.ts +0 -31
  116. package/node_modules/@types/cacheable-request/node_modules/undici-types/api.d.ts +0 -43
  117. package/node_modules/@types/cacheable-request/node_modules/undici-types/balanced-pool.d.ts +0 -29
  118. package/node_modules/@types/cacheable-request/node_modules/undici-types/cache.d.ts +0 -36
  119. package/node_modules/@types/cacheable-request/node_modules/undici-types/client.d.ts +0 -108
  120. package/node_modules/@types/cacheable-request/node_modules/undici-types/connector.d.ts +0 -34
  121. package/node_modules/@types/cacheable-request/node_modules/undici-types/content-type.d.ts +0 -21
  122. package/node_modules/@types/cacheable-request/node_modules/undici-types/cookies.d.ts +0 -28
  123. package/node_modules/@types/cacheable-request/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  124. package/node_modules/@types/cacheable-request/node_modules/undici-types/dispatcher.d.ts +0 -255
  125. package/node_modules/@types/cacheable-request/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  126. package/node_modules/@types/cacheable-request/node_modules/undici-types/errors.d.ts +0 -149
  127. package/node_modules/@types/cacheable-request/node_modules/undici-types/eventsource.d.ts +0 -61
  128. package/node_modules/@types/cacheable-request/node_modules/undici-types/fetch.d.ts +0 -209
  129. package/node_modules/@types/cacheable-request/node_modules/undici-types/file.d.ts +0 -39
  130. package/node_modules/@types/cacheable-request/node_modules/undici-types/filereader.d.ts +0 -54
  131. package/node_modules/@types/cacheable-request/node_modules/undici-types/formdata.d.ts +0 -108
  132. package/node_modules/@types/cacheable-request/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  133. package/node_modules/@types/cacheable-request/node_modules/undici-types/global-origin.d.ts +0 -7
  134. package/node_modules/@types/cacheable-request/node_modules/undici-types/handlers.d.ts +0 -15
  135. package/node_modules/@types/cacheable-request/node_modules/undici-types/header.d.ts +0 -4
  136. package/node_modules/@types/cacheable-request/node_modules/undici-types/index.d.ts +0 -71
  137. package/node_modules/@types/cacheable-request/node_modules/undici-types/interceptors.d.ts +0 -17
  138. package/node_modules/@types/cacheable-request/node_modules/undici-types/mock-agent.d.ts +0 -50
  139. package/node_modules/@types/cacheable-request/node_modules/undici-types/mock-client.d.ts +0 -25
  140. package/node_modules/@types/cacheable-request/node_modules/undici-types/mock-errors.d.ts +0 -12
  141. package/node_modules/@types/cacheable-request/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  142. package/node_modules/@types/cacheable-request/node_modules/undici-types/mock-pool.d.ts +0 -25
  143. package/node_modules/@types/cacheable-request/node_modules/undici-types/package.json +0 -55
  144. package/node_modules/@types/cacheable-request/node_modules/undici-types/patch.d.ts +0 -33
  145. package/node_modules/@types/cacheable-request/node_modules/undici-types/pool-stats.d.ts +0 -19
  146. package/node_modules/@types/cacheable-request/node_modules/undici-types/pool.d.ts +0 -39
  147. package/node_modules/@types/cacheable-request/node_modules/undici-types/proxy-agent.d.ts +0 -28
  148. package/node_modules/@types/cacheable-request/node_modules/undici-types/readable.d.ts +0 -60
  149. package/node_modules/@types/cacheable-request/node_modules/undici-types/retry-agent.d.ts +0 -8
  150. package/node_modules/@types/cacheable-request/node_modules/undici-types/retry-handler.d.ts +0 -116
  151. package/node_modules/@types/cacheable-request/node_modules/undici-types/util.d.ts +0 -18
  152. package/node_modules/@types/cacheable-request/node_modules/undici-types/webidl.d.ts +0 -222
  153. package/node_modules/@types/cacheable-request/node_modules/undici-types/websocket.d.ts +0 -150
  154. package/node_modules/@types/cacheable-request/package.json +0 -35
  155. package/node_modules/@types/http-cache-semantics/LICENSE +0 -21
  156. package/node_modules/@types/http-cache-semantics/README.md +0 -15
  157. package/node_modules/@types/http-cache-semantics/index.d.ts +0 -165
  158. package/node_modules/@types/http-cache-semantics/package.json +0 -25
  159. package/node_modules/@types/keyv/LICENSE +0 -21
  160. package/node_modules/@types/keyv/README.md +0 -16
  161. package/node_modules/@types/keyv/index.d.ts +0 -90
  162. package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +0 -21
  163. package/node_modules/@types/keyv/node_modules/@types/node/README.md +0 -15
  164. package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +0 -8
  165. package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +0 -1095
  166. package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +0 -541
  167. package/node_modules/@types/keyv/node_modules/@types/node/buffer.buffer.d.ts +0 -460
  168. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +0 -1926
  169. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +0 -1549
  170. package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +0 -579
  171. package/node_modules/@types/keyv/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  172. package/node_modules/@types/keyv/node_modules/@types/node/compatibility/index.d.ts +0 -9
  173. package/node_modules/@types/keyv/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  174. package/node_modules/@types/keyv/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  175. package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +0 -452
  176. package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +0 -21
  177. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +0 -4510
  178. package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +0 -599
  179. package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  180. package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +0 -476
  181. package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +0 -865
  182. package/node_modules/@types/keyv/node_modules/@types/node/dom-events.d.ts +0 -124
  183. package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +0 -170
  184. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +0 -931
  185. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +0 -1275
  186. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +0 -4343
  187. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +0 -511
  188. package/node_modules/@types/keyv/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  189. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +0 -1959
  190. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +0 -2558
  191. package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +0 -543
  192. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +0 -92
  193. package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +0 -3966
  194. package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +0 -702
  195. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +0 -1029
  196. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +0 -495
  197. package/node_modules/@types/keyv/node_modules/@types/node/package.json +0 -220
  198. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +0 -200
  199. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +0 -970
  200. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +0 -2013
  201. package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +0 -117
  202. package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +0 -153
  203. package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +0 -162
  204. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +0 -589
  205. package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +0 -430
  206. package/node_modules/@types/keyv/node_modules/@types/node/sea.d.ts +0 -153
  207. package/node_modules/@types/keyv/node_modules/@types/node/sqlite.d.ts +0 -439
  208. package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +0 -12
  209. package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +0 -90
  210. package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +0 -614
  211. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +0 -1662
  212. package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +0 -67
  213. package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +0 -2150
  214. package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +0 -97
  215. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +0 -240
  216. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +0 -1226
  217. package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +0 -197
  218. package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -457
  219. package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  220. package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/index.d.ts +0 -92
  221. package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +0 -208
  222. package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +0 -972
  223. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +0 -2439
  224. package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +0 -808
  225. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +0 -976
  226. package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +0 -181
  227. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +0 -745
  228. package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +0 -539
  229. package/node_modules/@types/keyv/node_modules/undici-types/LICENSE +0 -21
  230. package/node_modules/@types/keyv/node_modules/undici-types/README.md +0 -6
  231. package/node_modules/@types/keyv/node_modules/undici-types/agent.d.ts +0 -31
  232. package/node_modules/@types/keyv/node_modules/undici-types/api.d.ts +0 -43
  233. package/node_modules/@types/keyv/node_modules/undici-types/balanced-pool.d.ts +0 -29
  234. package/node_modules/@types/keyv/node_modules/undici-types/cache.d.ts +0 -36
  235. package/node_modules/@types/keyv/node_modules/undici-types/client.d.ts +0 -108
  236. package/node_modules/@types/keyv/node_modules/undici-types/connector.d.ts +0 -34
  237. package/node_modules/@types/keyv/node_modules/undici-types/content-type.d.ts +0 -21
  238. package/node_modules/@types/keyv/node_modules/undici-types/cookies.d.ts +0 -28
  239. package/node_modules/@types/keyv/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  240. package/node_modules/@types/keyv/node_modules/undici-types/dispatcher.d.ts +0 -255
  241. package/node_modules/@types/keyv/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  242. package/node_modules/@types/keyv/node_modules/undici-types/errors.d.ts +0 -149
  243. package/node_modules/@types/keyv/node_modules/undici-types/eventsource.d.ts +0 -61
  244. package/node_modules/@types/keyv/node_modules/undici-types/fetch.d.ts +0 -209
  245. package/node_modules/@types/keyv/node_modules/undici-types/file.d.ts +0 -39
  246. package/node_modules/@types/keyv/node_modules/undici-types/filereader.d.ts +0 -54
  247. package/node_modules/@types/keyv/node_modules/undici-types/formdata.d.ts +0 -108
  248. package/node_modules/@types/keyv/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  249. package/node_modules/@types/keyv/node_modules/undici-types/global-origin.d.ts +0 -7
  250. package/node_modules/@types/keyv/node_modules/undici-types/handlers.d.ts +0 -15
  251. package/node_modules/@types/keyv/node_modules/undici-types/header.d.ts +0 -4
  252. package/node_modules/@types/keyv/node_modules/undici-types/index.d.ts +0 -71
  253. package/node_modules/@types/keyv/node_modules/undici-types/interceptors.d.ts +0 -17
  254. package/node_modules/@types/keyv/node_modules/undici-types/mock-agent.d.ts +0 -50
  255. package/node_modules/@types/keyv/node_modules/undici-types/mock-client.d.ts +0 -25
  256. package/node_modules/@types/keyv/node_modules/undici-types/mock-errors.d.ts +0 -12
  257. package/node_modules/@types/keyv/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  258. package/node_modules/@types/keyv/node_modules/undici-types/mock-pool.d.ts +0 -25
  259. package/node_modules/@types/keyv/node_modules/undici-types/package.json +0 -55
  260. package/node_modules/@types/keyv/node_modules/undici-types/patch.d.ts +0 -33
  261. package/node_modules/@types/keyv/node_modules/undici-types/pool-stats.d.ts +0 -19
  262. package/node_modules/@types/keyv/node_modules/undici-types/pool.d.ts +0 -39
  263. package/node_modules/@types/keyv/node_modules/undici-types/proxy-agent.d.ts +0 -28
  264. package/node_modules/@types/keyv/node_modules/undici-types/readable.d.ts +0 -60
  265. package/node_modules/@types/keyv/node_modules/undici-types/retry-agent.d.ts +0 -8
  266. package/node_modules/@types/keyv/node_modules/undici-types/retry-handler.d.ts +0 -116
  267. package/node_modules/@types/keyv/node_modules/undici-types/util.d.ts +0 -18
  268. package/node_modules/@types/keyv/node_modules/undici-types/webidl.d.ts +0 -222
  269. package/node_modules/@types/keyv/node_modules/undici-types/websocket.d.ts +0 -150
  270. package/node_modules/@types/keyv/package.json +0 -32
  271. package/node_modules/@types/responselike/LICENSE +0 -21
  272. package/node_modules/@types/responselike/README.md +0 -48
  273. package/node_modules/@types/responselike/index.d.ts +0 -29
  274. package/node_modules/@types/responselike/node_modules/@types/node/LICENSE +0 -21
  275. package/node_modules/@types/responselike/node_modules/@types/node/README.md +0 -15
  276. package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +0 -8
  277. package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +0 -1095
  278. package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +0 -541
  279. package/node_modules/@types/responselike/node_modules/@types/node/buffer.buffer.d.ts +0 -460
  280. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +0 -1926
  281. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +0 -1549
  282. package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +0 -579
  283. package/node_modules/@types/responselike/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  284. package/node_modules/@types/responselike/node_modules/@types/node/compatibility/index.d.ts +0 -9
  285. package/node_modules/@types/responselike/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  286. package/node_modules/@types/responselike/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  287. package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +0 -452
  288. package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +0 -21
  289. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +0 -4510
  290. package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +0 -599
  291. package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  292. package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +0 -476
  293. package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +0 -865
  294. package/node_modules/@types/responselike/node_modules/@types/node/dom-events.d.ts +0 -124
  295. package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +0 -170
  296. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +0 -931
  297. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +0 -1275
  298. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +0 -4343
  299. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +0 -511
  300. package/node_modules/@types/responselike/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  301. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +0 -1959
  302. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +0 -2558
  303. package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +0 -543
  304. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +0 -92
  305. package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +0 -3966
  306. package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +0 -702
  307. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +0 -1029
  308. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +0 -495
  309. package/node_modules/@types/responselike/node_modules/@types/node/package.json +0 -220
  310. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +0 -200
  311. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +0 -970
  312. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +0 -2013
  313. package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +0 -117
  314. package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +0 -153
  315. package/node_modules/@types/responselike/node_modules/@types/node/readline/promises.d.ts +0 -162
  316. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +0 -589
  317. package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +0 -430
  318. package/node_modules/@types/responselike/node_modules/@types/node/sea.d.ts +0 -153
  319. package/node_modules/@types/responselike/node_modules/@types/node/sqlite.d.ts +0 -439
  320. package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +0 -12
  321. package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +0 -90
  322. package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +0 -614
  323. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +0 -1662
  324. package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +0 -67
  325. package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +0 -2150
  326. package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +0 -97
  327. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +0 -240
  328. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +0 -1226
  329. package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +0 -197
  330. package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -457
  331. package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  332. package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/index.d.ts +0 -92
  333. package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +0 -208
  334. package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +0 -972
  335. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +0 -2439
  336. package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +0 -808
  337. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +0 -976
  338. package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +0 -181
  339. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +0 -745
  340. package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +0 -539
  341. package/node_modules/@types/responselike/node_modules/undici-types/LICENSE +0 -21
  342. package/node_modules/@types/responselike/node_modules/undici-types/README.md +0 -6
  343. package/node_modules/@types/responselike/node_modules/undici-types/agent.d.ts +0 -31
  344. package/node_modules/@types/responselike/node_modules/undici-types/api.d.ts +0 -43
  345. package/node_modules/@types/responselike/node_modules/undici-types/balanced-pool.d.ts +0 -29
  346. package/node_modules/@types/responselike/node_modules/undici-types/cache.d.ts +0 -36
  347. package/node_modules/@types/responselike/node_modules/undici-types/client.d.ts +0 -108
  348. package/node_modules/@types/responselike/node_modules/undici-types/connector.d.ts +0 -34
  349. package/node_modules/@types/responselike/node_modules/undici-types/content-type.d.ts +0 -21
  350. package/node_modules/@types/responselike/node_modules/undici-types/cookies.d.ts +0 -28
  351. package/node_modules/@types/responselike/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  352. package/node_modules/@types/responselike/node_modules/undici-types/dispatcher.d.ts +0 -255
  353. package/node_modules/@types/responselike/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  354. package/node_modules/@types/responselike/node_modules/undici-types/errors.d.ts +0 -149
  355. package/node_modules/@types/responselike/node_modules/undici-types/eventsource.d.ts +0 -61
  356. package/node_modules/@types/responselike/node_modules/undici-types/fetch.d.ts +0 -209
  357. package/node_modules/@types/responselike/node_modules/undici-types/file.d.ts +0 -39
  358. package/node_modules/@types/responselike/node_modules/undici-types/filereader.d.ts +0 -54
  359. package/node_modules/@types/responselike/node_modules/undici-types/formdata.d.ts +0 -108
  360. package/node_modules/@types/responselike/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  361. package/node_modules/@types/responselike/node_modules/undici-types/global-origin.d.ts +0 -7
  362. package/node_modules/@types/responselike/node_modules/undici-types/handlers.d.ts +0 -15
  363. package/node_modules/@types/responselike/node_modules/undici-types/header.d.ts +0 -4
  364. package/node_modules/@types/responselike/node_modules/undici-types/index.d.ts +0 -71
  365. package/node_modules/@types/responselike/node_modules/undici-types/interceptors.d.ts +0 -17
  366. package/node_modules/@types/responselike/node_modules/undici-types/mock-agent.d.ts +0 -50
  367. package/node_modules/@types/responselike/node_modules/undici-types/mock-client.d.ts +0 -25
  368. package/node_modules/@types/responselike/node_modules/undici-types/mock-errors.d.ts +0 -12
  369. package/node_modules/@types/responselike/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  370. package/node_modules/@types/responselike/node_modules/undici-types/mock-pool.d.ts +0 -25
  371. package/node_modules/@types/responselike/node_modules/undici-types/package.json +0 -55
  372. package/node_modules/@types/responselike/node_modules/undici-types/patch.d.ts +0 -33
  373. package/node_modules/@types/responselike/node_modules/undici-types/pool-stats.d.ts +0 -19
  374. package/node_modules/@types/responselike/node_modules/undici-types/pool.d.ts +0 -39
  375. package/node_modules/@types/responselike/node_modules/undici-types/proxy-agent.d.ts +0 -28
  376. package/node_modules/@types/responselike/node_modules/undici-types/readable.d.ts +0 -60
  377. package/node_modules/@types/responselike/node_modules/undici-types/retry-agent.d.ts +0 -8
  378. package/node_modules/@types/responselike/node_modules/undici-types/retry-handler.d.ts +0 -116
  379. package/node_modules/@types/responselike/node_modules/undici-types/util.d.ts +0 -18
  380. package/node_modules/@types/responselike/node_modules/undici-types/webidl.d.ts +0 -222
  381. package/node_modules/@types/responselike/node_modules/undici-types/websocket.d.ts +0 -150
  382. package/node_modules/@types/responselike/package.json +0 -27
  383. package/node_modules/cacheable-lookup/LICENSE +0 -21
  384. package/node_modules/cacheable-lookup/README.md +0 -240
  385. package/node_modules/cacheable-lookup/index.d.ts +0 -139
  386. package/node_modules/cacheable-lookup/package.json +0 -45
  387. package/node_modules/cacheable-lookup/source/index.js +0 -436
  388. package/node_modules/cacheable-request/LICENSE +0 -21
  389. package/node_modules/cacheable-request/README.md +0 -206
  390. package/node_modules/cacheable-request/package.json +0 -56
  391. package/node_modules/cacheable-request/src/index.js +0 -251
  392. package/node_modules/clone-response/LICENSE +0 -21
  393. package/node_modules/clone-response/README.md +0 -62
  394. package/node_modules/clone-response/node_modules/mimic-response/index.js +0 -32
  395. package/node_modules/clone-response/node_modules/mimic-response/license +0 -9
  396. package/node_modules/clone-response/node_modules/mimic-response/package.json +0 -37
  397. package/node_modules/clone-response/node_modules/mimic-response/readme.md +0 -54
  398. package/node_modules/clone-response/package.json +0 -41
  399. package/node_modules/clone-response/src/index.js +0 -17
  400. package/node_modules/decompress-response/index.d.ts +0 -22
  401. package/node_modules/decompress-response/index.js +0 -58
  402. package/node_modules/decompress-response/license +0 -9
  403. package/node_modules/decompress-response/package.json +0 -56
  404. package/node_modules/decompress-response/readme.md +0 -48
  405. package/node_modules/defer-to-connect/LICENSE +0 -21
  406. package/node_modules/defer-to-connect/README.md +0 -38
  407. package/node_modules/defer-to-connect/dist/source/index.d.ts +0 -10
  408. package/node_modules/defer-to-connect/dist/source/index.js +0 -47
  409. package/node_modules/defer-to-connect/package.json +0 -71
  410. package/node_modules/end-of-stream/LICENSE +0 -21
  411. package/node_modules/end-of-stream/README.md +0 -54
  412. package/node_modules/end-of-stream/index.js +0 -94
  413. package/node_modules/end-of-stream/package.json +0 -37
  414. package/node_modules/get-stream/buffer-stream.js +0 -52
  415. package/node_modules/get-stream/index.d.ts +0 -108
  416. package/node_modules/get-stream/index.js +0 -60
  417. package/node_modules/get-stream/license +0 -9
  418. package/node_modules/get-stream/package.json +0 -50
  419. package/node_modules/get-stream/readme.md +0 -124
  420. package/node_modules/got/dist/source/as-promise/create-rejection.d.ts +0 -2
  421. package/node_modules/got/dist/source/as-promise/create-rejection.js +0 -30
  422. package/node_modules/got/dist/source/as-promise/index.d.ts +0 -3
  423. package/node_modules/got/dist/source/as-promise/index.js +0 -176
  424. package/node_modules/got/dist/source/as-promise/normalize-arguments.d.ts +0 -3
  425. package/node_modules/got/dist/source/as-promise/normalize-arguments.js +0 -78
  426. package/node_modules/got/dist/source/as-promise/parse-body.d.ts +0 -3
  427. package/node_modules/got/dist/source/as-promise/parse-body.js +0 -25
  428. package/node_modules/got/dist/source/as-promise/types.d.ts +0 -256
  429. package/node_modules/got/dist/source/as-promise/types.js +0 -42
  430. package/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +0 -5
  431. package/node_modules/got/dist/source/core/calculate-retry-delay.js +0 -29
  432. package/node_modules/got/dist/source/core/index.d.ts +0 -1124
  433. package/node_modules/got/dist/source/core/index.js +0 -1505
  434. package/node_modules/got/dist/source/core/utils/dns-ip-version.d.ts +0 -5
  435. package/node_modules/got/dist/source/core/utils/dns-ip-version.js +0 -17
  436. package/node_modules/got/dist/source/core/utils/get-body-size.d.ts +0 -3
  437. package/node_modules/got/dist/source/core/utils/get-body-size.js +0 -32
  438. package/node_modules/got/dist/source/core/utils/get-buffer.d.ts +0 -4
  439. package/node_modules/got/dist/source/core/utils/get-buffer.js +0 -16
  440. package/node_modules/got/dist/source/core/utils/is-form-data.d.ts +0 -8
  441. package/node_modules/got/dist/source/core/utils/is-form-data.js +0 -4
  442. package/node_modules/got/dist/source/core/utils/is-response-ok.d.ts +0 -2
  443. package/node_modules/got/dist/source/core/utils/is-response-ok.js +0 -8
  444. package/node_modules/got/dist/source/core/utils/options-to-url.d.ts +0 -14
  445. package/node_modules/got/dist/source/core/utils/options-to-url.js +0 -53
  446. package/node_modules/got/dist/source/core/utils/proxy-events.d.ts +0 -3
  447. package/node_modules/got/dist/source/core/utils/proxy-events.js +0 -17
  448. package/node_modules/got/dist/source/core/utils/timed-out.d.ts +0 -29
  449. package/node_modules/got/dist/source/core/utils/timed-out.js +0 -121
  450. package/node_modules/got/dist/source/core/utils/unhandle.d.ts +0 -11
  451. package/node_modules/got/dist/source/core/utils/unhandle.js +0 -22
  452. package/node_modules/got/dist/source/core/utils/url-to-options.d.ts +0 -15
  453. package/node_modules/got/dist/source/core/utils/url-to-options.js +0 -24
  454. package/node_modules/got/dist/source/core/utils/weakable-map.d.ts +0 -8
  455. package/node_modules/got/dist/source/core/utils/weakable-map.js +0 -29
  456. package/node_modules/got/dist/source/create.d.ts +0 -5
  457. package/node_modules/got/dist/source/create.js +0 -240
  458. package/node_modules/got/dist/source/index.d.ts +0 -4
  459. package/node_modules/got/dist/source/index.js +0 -132
  460. package/node_modules/got/dist/source/types.d.ts +0 -344
  461. package/node_modules/got/dist/source/types.js +0 -2
  462. package/node_modules/got/dist/source/utils/deep-freeze.d.ts +0 -1
  463. package/node_modules/got/dist/source/utils/deep-freeze.js +0 -12
  464. package/node_modules/got/dist/source/utils/deprecation-warning.d.ts +0 -2
  465. package/node_modules/got/dist/source/utils/deprecation-warning.js +0 -13
  466. package/node_modules/got/license +0 -9
  467. package/node_modules/got/package.json +0 -131
  468. package/node_modules/got/readme.md +0 -2477
  469. package/node_modules/hpagent/.github/dependabot.yml +0 -8
  470. package/node_modules/hpagent/.github/workflows/build.yml +0 -29
  471. package/node_modules/hpagent/LICENSE +0 -21
  472. package/node_modules/hpagent/README.md +0 -138
  473. package/node_modules/hpagent/index.d.ts +0 -26
  474. package/node_modules/hpagent/index.js +0 -101
  475. package/node_modules/hpagent/index.mjs +0 -5
  476. package/node_modules/hpagent/package.json +0 -49
  477. package/node_modules/hpagent/test/got.test.js +0 -111
  478. package/node_modules/hpagent/test/http-http.test.js +0 -351
  479. package/node_modules/hpagent/test/http-https.test.js +0 -313
  480. package/node_modules/hpagent/test/https-http.test.js +0 -313
  481. package/node_modules/hpagent/test/https-https.test.js +0 -313
  482. package/node_modules/hpagent/test/index.test-d.ts +0 -45
  483. package/node_modules/hpagent/test/needle.test.js +0 -103
  484. package/node_modules/hpagent/test/node-fetch.test.js +0 -103
  485. package/node_modules/hpagent/test/simple-get.test.js +0 -139
  486. package/node_modules/hpagent/test/ssl.cert +0 -19
  487. package/node_modules/hpagent/test/ssl.key +0 -27
  488. package/node_modules/hpagent/test/utils.js +0 -59
  489. package/node_modules/http-cache-semantics/LICENSE +0 -9
  490. package/node_modules/http-cache-semantics/README.md +0 -203
  491. package/node_modules/http-cache-semantics/index.js +0 -674
  492. package/node_modules/http-cache-semantics/package.json +0 -18
  493. package/node_modules/http2-wrapper/LICENSE +0 -21
  494. package/node_modules/http2-wrapper/README.md +0 -470
  495. package/node_modules/http2-wrapper/package.json +0 -54
  496. package/node_modules/http2-wrapper/source/agent.js +0 -670
  497. package/node_modules/http2-wrapper/source/auto.js +0 -149
  498. package/node_modules/http2-wrapper/source/client-request.js +0 -445
  499. package/node_modules/http2-wrapper/source/incoming-message.js +0 -58
  500. package/node_modules/http2-wrapper/source/index.js +0 -28
  501. package/node_modules/http2-wrapper/source/utils/calculate-server-name.js +0 -27
  502. package/node_modules/http2-wrapper/source/utils/errors.js +0 -45
  503. package/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +0 -13
  504. package/node_modules/http2-wrapper/source/utils/proxy-events.js +0 -7
  505. package/node_modules/http2-wrapper/source/utils/url-to-options.js +0 -25
  506. package/node_modules/json-buffer/.travis.yml +0 -3
  507. package/node_modules/json-buffer/LICENSE +0 -22
  508. package/node_modules/json-buffer/README.md +0 -24
  509. package/node_modules/json-buffer/index.js +0 -58
  510. package/node_modules/json-buffer/package.json +0 -34
  511. package/node_modules/json-buffer/test/index.js +0 -63
  512. package/node_modules/keyv/README.md +0 -429
  513. package/node_modules/keyv/package.json +0 -57
  514. package/node_modules/keyv/src/index.d.ts +0 -112
  515. package/node_modules/keyv/src/index.js +0 -259
  516. package/node_modules/lowercase-keys/index.d.ts +0 -16
  517. package/node_modules/lowercase-keys/index.js +0 -10
  518. package/node_modules/lowercase-keys/license +0 -9
  519. package/node_modules/lowercase-keys/package.json +0 -38
  520. package/node_modules/lowercase-keys/readme.md +0 -32
  521. package/node_modules/mimic-response/index.d.ts +0 -17
  522. package/node_modules/mimic-response/index.js +0 -77
  523. package/node_modules/mimic-response/license +0 -9
  524. package/node_modules/mimic-response/package.json +0 -42
  525. package/node_modules/mimic-response/readme.md +0 -78
  526. package/node_modules/normalize-url/index.d.ts +0 -267
  527. package/node_modules/normalize-url/index.js +0 -216
  528. package/node_modules/normalize-url/license +0 -9
  529. package/node_modules/normalize-url/package.json +0 -50
  530. package/node_modules/normalize-url/readme.md +0 -286
  531. package/node_modules/once/LICENSE +0 -15
  532. package/node_modules/once/README.md +0 -79
  533. package/node_modules/once/once.js +0 -42
  534. package/node_modules/once/package.json +0 -33
  535. package/node_modules/p-cancelable/index.d.ts +0 -176
  536. package/node_modules/p-cancelable/index.js +0 -111
  537. package/node_modules/p-cancelable/license +0 -9
  538. package/node_modules/p-cancelable/package.json +0 -49
  539. package/node_modules/p-cancelable/readme.md +0 -153
  540. package/node_modules/pump/.github/FUNDING.yml +0 -2
  541. package/node_modules/pump/.travis.yml +0 -5
  542. package/node_modules/pump/LICENSE +0 -21
  543. package/node_modules/pump/README.md +0 -74
  544. package/node_modules/pump/SECURITY.md +0 -5
  545. package/node_modules/pump/index.js +0 -86
  546. package/node_modules/pump/package.json +0 -24
  547. package/node_modules/pump/test-browser.js +0 -66
  548. package/node_modules/pump/test-node.js +0 -53
  549. package/node_modules/quick-lru/index.d.ts +0 -97
  550. package/node_modules/quick-lru/index.js +0 -123
  551. package/node_modules/quick-lru/license +0 -9
  552. package/node_modules/quick-lru/package.json +0 -43
  553. package/node_modules/quick-lru/readme.md +0 -111
  554. package/node_modules/resolve-alpn/LICENSE +0 -22
  555. package/node_modules/resolve-alpn/README.md +0 -60
  556. package/node_modules/resolve-alpn/index.js +0 -43
  557. package/node_modules/resolve-alpn/package.json +0 -34
  558. package/node_modules/responselike/LICENSE +0 -19
  559. package/node_modules/responselike/README.md +0 -77
  560. package/node_modules/responselike/package.json +0 -39
  561. package/node_modules/responselike/src/index.js +0 -34
  562. package/node_modules/wrappy/LICENSE +0 -15
  563. package/node_modules/wrappy/README.md +0 -36
  564. package/node_modules/wrappy/package.json +0 -29
  565. package/node_modules/wrappy/wrappy.js +0 -33
@@ -1,2150 +0,0 @@
1
- /**
2
- * The `node:test` module facilitates the creation of JavaScript tests.
3
- * To access it:
4
- *
5
- * ```js
6
- * import test from 'node:test';
7
- * ```
8
- *
9
- * This module is only available under the `node:` scheme. The following will not
10
- * work:
11
- *
12
- * ```js
13
- * import test from 'node:test';
14
- * ```
15
- *
16
- * Tests created via the `test` module consist of a single function that is
17
- * processed in one of three ways:
18
- *
19
- * 1. A synchronous function that is considered failing if it throws an exception,
20
- * and is considered passing otherwise.
21
- * 2. A function that returns a `Promise` that is considered failing if the `Promise` rejects, and is considered passing if the `Promise` fulfills.
22
- * 3. A function that receives a callback function. If the callback receives any
23
- * truthy value as its first argument, the test is considered failing. If a
24
- * falsy value is passed as the first argument to the callback, the test is
25
- * considered passing. If the test function receives a callback function and
26
- * also returns a `Promise`, the test will fail.
27
- *
28
- * The following example illustrates how tests are written using the `test` module.
29
- *
30
- * ```js
31
- * test('synchronous passing test', (t) => {
32
- * // This test passes because it does not throw an exception.
33
- * assert.strictEqual(1, 1);
34
- * });
35
- *
36
- * test('synchronous failing test', (t) => {
37
- * // This test fails because it throws an exception.
38
- * assert.strictEqual(1, 2);
39
- * });
40
- *
41
- * test('asynchronous passing test', async (t) => {
42
- * // This test passes because the Promise returned by the async
43
- * // function is settled and not rejected.
44
- * assert.strictEqual(1, 1);
45
- * });
46
- *
47
- * test('asynchronous failing test', async (t) => {
48
- * // This test fails because the Promise returned by the async
49
- * // function is rejected.
50
- * assert.strictEqual(1, 2);
51
- * });
52
- *
53
- * test('failing test using Promises', (t) => {
54
- * // Promises can be used directly as well.
55
- * return new Promise((resolve, reject) => {
56
- * setImmediate(() => {
57
- * reject(new Error('this will cause the test to fail'));
58
- * });
59
- * });
60
- * });
61
- *
62
- * test('callback passing test', (t, done) => {
63
- * // done() is the callback function. When the setImmediate() runs, it invokes
64
- * // done() with no arguments.
65
- * setImmediate(done);
66
- * });
67
- *
68
- * test('callback failing test', (t, done) => {
69
- * // When the setImmediate() runs, done() is invoked with an Error object and
70
- * // the test fails.
71
- * setImmediate(() => {
72
- * done(new Error('callback failure'));
73
- * });
74
- * });
75
- * ```
76
- *
77
- * If any tests fail, the process exit code is set to `1`.
78
- * @since v18.0.0, v16.17.0
79
- * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test.js)
80
- */
81
- declare module "node:test" {
82
- import { Readable } from "node:stream";
83
- /**
84
- * **Note:** `shard` is used to horizontally parallelize test running across
85
- * machines or processes, ideal for large-scale executions across varied
86
- * environments. It's incompatible with `watch` mode, tailored for rapid
87
- * code iteration by automatically rerunning tests on file changes.
88
- *
89
- * ```js
90
- * import { tap } from 'node:test/reporters';
91
- * import { run } from 'node:test';
92
- * import process from 'node:process';
93
- * import path from 'node:path';
94
- *
95
- * run({ files: [path.resolve('./tests/test.js')] })
96
- * .compose(tap)
97
- * .pipe(process.stdout);
98
- * ```
99
- * @since v18.9.0, v16.19.0
100
- * @param options Configuration options for running tests.
101
- */
102
- function run(options?: RunOptions): TestsStream;
103
- /**
104
- * The `test()` function is the value imported from the `test` module. Each
105
- * invocation of this function results in reporting the test to the `TestsStream`.
106
- *
107
- * The `TestContext` object passed to the `fn` argument can be used to perform
108
- * actions related to the current test. Examples include skipping the test, adding
109
- * additional diagnostic information, or creating subtests.
110
- *
111
- * `test()` returns a `Promise` that fulfills once the test completes.
112
- * if `test()` is called within a suite, it fulfills immediately.
113
- * The return value can usually be discarded for top level tests.
114
- * However, the return value from subtests should be used to prevent the parent
115
- * test from finishing first and cancelling the subtest
116
- * as shown in the following example.
117
- *
118
- * ```js
119
- * test('top level test', async (t) => {
120
- * // The setTimeout() in the following subtest would cause it to outlive its
121
- * // parent test if 'await' is removed on the next line. Once the parent test
122
- * // completes, it will cancel any outstanding subtests.
123
- * await t.test('longer running subtest', async (t) => {
124
- * return new Promise((resolve, reject) => {
125
- * setTimeout(resolve, 1000);
126
- * });
127
- * });
128
- * });
129
- * ```
130
- *
131
- * The `timeout` option can be used to fail the test if it takes longer than `timeout` milliseconds to complete. However, it is not a reliable mechanism for
132
- * canceling tests because a running test might block the application thread and
133
- * thus prevent the scheduled cancellation.
134
- * @since v18.0.0, v16.17.0
135
- * @param name The name of the test, which is displayed when reporting test results.
136
- * Defaults to the `name` property of `fn`, or `'<anonymous>'` if `fn` does not have a name.
137
- * @param options Configuration options for the test.
138
- * @param fn The function under test. The first argument to this function is a {@link TestContext} object.
139
- * If the test uses callbacks, the callback function is passed as the second argument.
140
- * @return Fulfilled with `undefined` once the test completes, or immediately if the test runs within a suite.
141
- */
142
- function test(name?: string, fn?: TestFn): Promise<void>;
143
- function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
144
- function test(options?: TestOptions, fn?: TestFn): Promise<void>;
145
- function test(fn?: TestFn): Promise<void>;
146
- namespace test {
147
- export {
148
- after,
149
- afterEach,
150
- before,
151
- beforeEach,
152
- describe,
153
- it,
154
- mock,
155
- only,
156
- run,
157
- skip,
158
- snapshot,
159
- suite,
160
- test,
161
- todo,
162
- };
163
- }
164
- /**
165
- * The `suite()` function is imported from the `node:test` module.
166
- * @param name The name of the suite, which is displayed when reporting test results.
167
- * Defaults to the `name` property of `fn`, or `'<anonymous>'` if `fn` does not have a name.
168
- * @param options Configuration options for the suite. This supports the same options as {@link test}.
169
- * @param fn The suite function declaring nested tests and suites. The first argument to this function is a {@link SuiteContext} object.
170
- * @return Immediately fulfilled with `undefined`.
171
- * @since v20.13.0
172
- */
173
- function suite(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
174
- function suite(name?: string, fn?: SuiteFn): Promise<void>;
175
- function suite(options?: TestOptions, fn?: SuiteFn): Promise<void>;
176
- function suite(fn?: SuiteFn): Promise<void>;
177
- namespace suite {
178
- /**
179
- * Shorthand for skipping a suite. This is the same as calling {@link suite} with `options.skip` set to `true`.
180
- * @since v20.13.0
181
- */
182
- function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
183
- function skip(name?: string, fn?: SuiteFn): Promise<void>;
184
- function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
185
- function skip(fn?: SuiteFn): Promise<void>;
186
- /**
187
- * Shorthand for marking a suite as `TODO`. This is the same as calling {@link suite} with `options.todo` set to `true`.
188
- * @since v20.13.0
189
- */
190
- function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
191
- function todo(name?: string, fn?: SuiteFn): Promise<void>;
192
- function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
193
- function todo(fn?: SuiteFn): Promise<void>;
194
- /**
195
- * Shorthand for marking a suite as `only`. This is the same as calling {@link suite} with `options.only` set to `true`.
196
- * @since v20.13.0
197
- */
198
- function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
199
- function only(name?: string, fn?: SuiteFn): Promise<void>;
200
- function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
201
- function only(fn?: SuiteFn): Promise<void>;
202
- }
203
- /**
204
- * Alias for {@link suite}.
205
- *
206
- * The `describe()` function is imported from the `node:test` module.
207
- */
208
- function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
209
- function describe(name?: string, fn?: SuiteFn): Promise<void>;
210
- function describe(options?: TestOptions, fn?: SuiteFn): Promise<void>;
211
- function describe(fn?: SuiteFn): Promise<void>;
212
- namespace describe {
213
- /**
214
- * Shorthand for skipping a suite. This is the same as calling {@link describe} with `options.skip` set to `true`.
215
- * @since v18.15.0
216
- */
217
- function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
218
- function skip(name?: string, fn?: SuiteFn): Promise<void>;
219
- function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
220
- function skip(fn?: SuiteFn): Promise<void>;
221
- /**
222
- * Shorthand for marking a suite as `TODO`. This is the same as calling {@link describe} with `options.todo` set to `true`.
223
- * @since v18.15.0
224
- */
225
- function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
226
- function todo(name?: string, fn?: SuiteFn): Promise<void>;
227
- function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
228
- function todo(fn?: SuiteFn): Promise<void>;
229
- /**
230
- * Shorthand for marking a suite as `only`. This is the same as calling {@link describe} with `options.only` set to `true`.
231
- * @since v18.15.0
232
- */
233
- function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
234
- function only(name?: string, fn?: SuiteFn): Promise<void>;
235
- function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
236
- function only(fn?: SuiteFn): Promise<void>;
237
- }
238
- /**
239
- * Alias for {@link test}.
240
- *
241
- * The `it()` function is imported from the `node:test` module.
242
- * @since v18.6.0, v16.17.0
243
- */
244
- function it(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
245
- function it(name?: string, fn?: TestFn): Promise<void>;
246
- function it(options?: TestOptions, fn?: TestFn): Promise<void>;
247
- function it(fn?: TestFn): Promise<void>;
248
- namespace it {
249
- /**
250
- * Shorthand for skipping a test. This is the same as calling {@link it} with `options.skip` set to `true`.
251
- */
252
- function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
253
- function skip(name?: string, fn?: TestFn): Promise<void>;
254
- function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
255
- function skip(fn?: TestFn): Promise<void>;
256
- /**
257
- * Shorthand for marking a test as `TODO`. This is the same as calling {@link it} with `options.todo` set to `true`.
258
- */
259
- function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
260
- function todo(name?: string, fn?: TestFn): Promise<void>;
261
- function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
262
- function todo(fn?: TestFn): Promise<void>;
263
- /**
264
- * Shorthand for marking a test as `only`. This is the same as calling {@link it} with `options.only` set to `true`.
265
- * @since v18.15.0
266
- */
267
- function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
268
- function only(name?: string, fn?: TestFn): Promise<void>;
269
- function only(options?: TestOptions, fn?: TestFn): Promise<void>;
270
- function only(fn?: TestFn): Promise<void>;
271
- }
272
- /**
273
- * Shorthand for skipping a test. This is the same as calling {@link test} with `options.skip` set to `true`.
274
- * @since v20.2.0
275
- */
276
- function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
277
- function skip(name?: string, fn?: TestFn): Promise<void>;
278
- function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
279
- function skip(fn?: TestFn): Promise<void>;
280
- /**
281
- * Shorthand for marking a test as `TODO`. This is the same as calling {@link test} with `options.todo` set to `true`.
282
- * @since v20.2.0
283
- */
284
- function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
285
- function todo(name?: string, fn?: TestFn): Promise<void>;
286
- function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
287
- function todo(fn?: TestFn): Promise<void>;
288
- /**
289
- * Shorthand for marking a test as `only`. This is the same as calling {@link test} with `options.only` set to `true`.
290
- * @since v20.2.0
291
- */
292
- function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
293
- function only(name?: string, fn?: TestFn): Promise<void>;
294
- function only(options?: TestOptions, fn?: TestFn): Promise<void>;
295
- function only(fn?: TestFn): Promise<void>;
296
- /**
297
- * The type of a function passed to {@link test}. The first argument to this function is a {@link TestContext} object.
298
- * If the test uses callbacks, the callback function is passed as the second argument.
299
- */
300
- type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise<void>;
301
- /**
302
- * The type of a suite test function. The argument to this function is a {@link SuiteContext} object.
303
- */
304
- type SuiteFn = (s: SuiteContext) => void | Promise<void>;
305
- interface TestShard {
306
- /**
307
- * A positive integer between 1 and `total` that specifies the index of the shard to run.
308
- */
309
- index: number;
310
- /**
311
- * A positive integer that specifies the total number of shards to split the test files to.
312
- */
313
- total: number;
314
- }
315
- interface RunOptions {
316
- /**
317
- * If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file.
318
- * If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time.
319
- * @default false
320
- */
321
- concurrency?: number | boolean | undefined;
322
- /**
323
- * An array containing the list of files to run. If omitted, files are run according to the
324
- * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model).
325
- */
326
- files?: readonly string[] | undefined;
327
- /**
328
- * Configures the test runner to exit the process once all known
329
- * tests have finished executing even if the event loop would
330
- * otherwise remain active.
331
- * @default false
332
- */
333
- forceExit?: boolean | undefined;
334
- /**
335
- * An array containing the list of glob patterns to match test files.
336
- * This option cannot be used together with `files`. If omitted, files are run according to the
337
- * [test runner execution model](https://nodejs.org/docs/latest-v22.x/api/test.html#test-runner-execution-model).
338
- * @since v22.6.0
339
- */
340
- globPatterns?: readonly string[] | undefined;
341
- /**
342
- * Sets inspector port of test child process.
343
- * This can be a number, or a function that takes no arguments and returns a
344
- * number. If a nullish value is provided, each process gets its own port,
345
- * incremented from the primary's `process.debugPort`. This option is ignored
346
- * if the `isolation` option is set to `'none'` as no child processes are
347
- * spawned.
348
- * @default undefined
349
- */
350
- inspectPort?: number | (() => number) | undefined;
351
- /**
352
- * Configures the type of test isolation. If set to
353
- * `'process'`, each test file is run in a separate child process. If set to
354
- * `'none'`, all test files run in the current process.
355
- * @default 'process'
356
- * @since v22.8.0
357
- */
358
- isolation?: "process" | "none" | undefined;
359
- /**
360
- * If truthy, the test context will only run tests that have the `only` option set
361
- */
362
- only?: boolean | undefined;
363
- /**
364
- * A function that accepts the `TestsStream` instance and can be used to setup listeners before any tests are run.
365
- * @default undefined
366
- */
367
- setup?: ((reporter: TestsStream) => void | Promise<void>) | undefined;
368
- /**
369
- * An array of CLI flags to pass to the `node` executable when
370
- * spawning the subprocesses. This option has no effect when `isolation` is `'none`'.
371
- * @since v22.10.0
372
- * @default []
373
- */
374
- execArgv?: readonly string[] | undefined;
375
- /**
376
- * An array of CLI flags to pass to each test file when spawning the
377
- * subprocesses. This option has no effect when `isolation` is `'none'`.
378
- * @since v22.10.0
379
- * @default []
380
- */
381
- argv?: readonly string[] | undefined;
382
- /**
383
- * Allows aborting an in-progress test execution.
384
- */
385
- signal?: AbortSignal | undefined;
386
- /**
387
- * If provided, only run tests whose name matches the provided pattern.
388
- * Strings are interpreted as JavaScript regular expressions.
389
- * @default undefined
390
- */
391
- testNamePatterns?: string | RegExp | ReadonlyArray<string | RegExp> | undefined;
392
- /**
393
- * A String, RegExp or a RegExp Array, that can be used to exclude running tests whose
394
- * name matches the provided pattern. Test name patterns are interpreted as JavaScript
395
- * regular expressions. For each test that is executed, any corresponding test hooks,
396
- * such as `beforeEach()`, are also run.
397
- * @default undefined
398
- * @since v22.1.0
399
- */
400
- testSkipPatterns?: string | RegExp | ReadonlyArray<string | RegExp> | undefined;
401
- /**
402
- * The number of milliseconds after which the test execution will fail.
403
- * If unspecified, subtests inherit this value from their parent.
404
- * @default Infinity
405
- */
406
- timeout?: number | undefined;
407
- /**
408
- * Whether to run in watch mode or not.
409
- * @default false
410
- */
411
- watch?: boolean | undefined;
412
- /**
413
- * Running tests in a specific shard.
414
- * @default undefined
415
- */
416
- shard?: TestShard | undefined;
417
- /**
418
- * enable [code coverage](https://nodejs.org/docs/latest-v22.x/api/test.html#collecting-code-coverage) collection.
419
- * @since v22.10.0
420
- * @default false
421
- */
422
- coverage?: boolean | undefined;
423
- /**
424
- * Excludes specific files from code coverage
425
- * using a glob pattern, which can match both absolute and relative file paths.
426
- * This property is only applicable when `coverage` was set to `true`.
427
- * If both `coverageExcludeGlobs` and `coverageIncludeGlobs` are provided,
428
- * files must meet **both** criteria to be included in the coverage report.
429
- * @since v22.10.0
430
- * @default undefined
431
- */
432
- coverageExcludeGlobs?: string | readonly string[] | undefined;
433
- /**
434
- * Includes specific files in code coverage
435
- * using a glob pattern, which can match both absolute and relative file paths.
436
- * This property is only applicable when `coverage` was set to `true`.
437
- * If both `coverageExcludeGlobs` and `coverageIncludeGlobs` are provided,
438
- * files must meet **both** criteria to be included in the coverage report.
439
- * @since v22.10.0
440
- * @default undefined
441
- */
442
- coverageIncludeGlobs?: string | readonly string[] | undefined;
443
- /**
444
- * Require a minimum percent of covered lines. If code
445
- * coverage does not reach the threshold specified, the process will exit with code `1`.
446
- * @since v22.10.0
447
- * @default 0
448
- */
449
- lineCoverage?: number | undefined;
450
- /**
451
- * Require a minimum percent of covered branches. If code
452
- * coverage does not reach the threshold specified, the process will exit with code `1`.
453
- * @since v22.10.0
454
- * @default 0
455
- */
456
- branchCoverage?: number | undefined;
457
- /**
458
- * Require a minimum percent of covered functions. If code
459
- * coverage does not reach the threshold specified, the process will exit with code `1`.
460
- * @since v22.10.0
461
- * @default 0
462
- */
463
- functionCoverage?: number | undefined;
464
- }
465
- /**
466
- * A successful call to `run()` will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.
467
- *
468
- * Some of the events are guaranteed to be emitted in the same order as the tests are defined, while others are emitted in the order that the tests execute.
469
- * @since v18.9.0, v16.19.0
470
- */
471
- class TestsStream extends Readable implements NodeJS.ReadableStream {
472
- addListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
473
- addListener(event: "test:complete", listener: (data: TestComplete) => void): this;
474
- addListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
475
- addListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
476
- addListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
477
- addListener(event: "test:fail", listener: (data: TestFail) => void): this;
478
- addListener(event: "test:pass", listener: (data: TestPass) => void): this;
479
- addListener(event: "test:plan", listener: (data: TestPlan) => void): this;
480
- addListener(event: "test:start", listener: (data: TestStart) => void): this;
481
- addListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
482
- addListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
483
- addListener(event: "test:summary", listener: (data: TestSummary) => void): this;
484
- addListener(event: "test:watch:drained", listener: () => void): this;
485
- addListener(event: string, listener: (...args: any[]) => void): this;
486
- emit(event: "test:coverage", data: TestCoverage): boolean;
487
- emit(event: "test:complete", data: TestComplete): boolean;
488
- emit(event: "test:dequeue", data: TestDequeue): boolean;
489
- emit(event: "test:diagnostic", data: DiagnosticData): boolean;
490
- emit(event: "test:enqueue", data: TestEnqueue): boolean;
491
- emit(event: "test:fail", data: TestFail): boolean;
492
- emit(event: "test:pass", data: TestPass): boolean;
493
- emit(event: "test:plan", data: TestPlan): boolean;
494
- emit(event: "test:start", data: TestStart): boolean;
495
- emit(event: "test:stderr", data: TestStderr): boolean;
496
- emit(event: "test:stdout", data: TestStdout): boolean;
497
- emit(event: "test:summary", data: TestSummary): boolean;
498
- emit(event: "test:watch:drained"): boolean;
499
- emit(event: string | symbol, ...args: any[]): boolean;
500
- on(event: "test:coverage", listener: (data: TestCoverage) => void): this;
501
- on(event: "test:complete", listener: (data: TestComplete) => void): this;
502
- on(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
503
- on(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
504
- on(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
505
- on(event: "test:fail", listener: (data: TestFail) => void): this;
506
- on(event: "test:pass", listener: (data: TestPass) => void): this;
507
- on(event: "test:plan", listener: (data: TestPlan) => void): this;
508
- on(event: "test:start", listener: (data: TestStart) => void): this;
509
- on(event: "test:stderr", listener: (data: TestStderr) => void): this;
510
- on(event: "test:stdout", listener: (data: TestStdout) => void): this;
511
- on(event: "test:summary", listener: (data: TestSummary) => void): this;
512
- on(event: "test:watch:drained", listener: () => void): this;
513
- on(event: string, listener: (...args: any[]) => void): this;
514
- once(event: "test:coverage", listener: (data: TestCoverage) => void): this;
515
- once(event: "test:complete", listener: (data: TestComplete) => void): this;
516
- once(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
517
- once(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
518
- once(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
519
- once(event: "test:fail", listener: (data: TestFail) => void): this;
520
- once(event: "test:pass", listener: (data: TestPass) => void): this;
521
- once(event: "test:plan", listener: (data: TestPlan) => void): this;
522
- once(event: "test:start", listener: (data: TestStart) => void): this;
523
- once(event: "test:stderr", listener: (data: TestStderr) => void): this;
524
- once(event: "test:stdout", listener: (data: TestStdout) => void): this;
525
- once(event: "test:summary", listener: (data: TestSummary) => void): this;
526
- once(event: "test:watch:drained", listener: () => void): this;
527
- once(event: string, listener: (...args: any[]) => void): this;
528
- prependListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
529
- prependListener(event: "test:complete", listener: (data: TestComplete) => void): this;
530
- prependListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
531
- prependListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
532
- prependListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
533
- prependListener(event: "test:fail", listener: (data: TestFail) => void): this;
534
- prependListener(event: "test:pass", listener: (data: TestPass) => void): this;
535
- prependListener(event: "test:plan", listener: (data: TestPlan) => void): this;
536
- prependListener(event: "test:start", listener: (data: TestStart) => void): this;
537
- prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
538
- prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
539
- prependListener(event: "test:summary", listener: (data: TestSummary) => void): this;
540
- prependListener(event: "test:watch:drained", listener: () => void): this;
541
- prependListener(event: string, listener: (...args: any[]) => void): this;
542
- prependOnceListener(event: "test:coverage", listener: (data: TestCoverage) => void): this;
543
- prependOnceListener(event: "test:complete", listener: (data: TestComplete) => void): this;
544
- prependOnceListener(event: "test:dequeue", listener: (data: TestDequeue) => void): this;
545
- prependOnceListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this;
546
- prependOnceListener(event: "test:enqueue", listener: (data: TestEnqueue) => void): this;
547
- prependOnceListener(event: "test:fail", listener: (data: TestFail) => void): this;
548
- prependOnceListener(event: "test:pass", listener: (data: TestPass) => void): this;
549
- prependOnceListener(event: "test:plan", listener: (data: TestPlan) => void): this;
550
- prependOnceListener(event: "test:start", listener: (data: TestStart) => void): this;
551
- prependOnceListener(event: "test:stderr", listener: (data: TestStderr) => void): this;
552
- prependOnceListener(event: "test:stdout", listener: (data: TestStdout) => void): this;
553
- prependOnceListener(event: "test:summary", listener: (data: TestSummary) => void): this;
554
- prependOnceListener(event: "test:watch:drained", listener: () => void): this;
555
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
556
- }
557
- /**
558
- * An instance of `TestContext` is passed to each test function in order to
559
- * interact with the test runner. However, the `TestContext` constructor is not
560
- * exposed as part of the API.
561
- * @since v18.0.0, v16.17.0
562
- */
563
- class TestContext {
564
- /**
565
- * An object containing assertion methods bound to the test context.
566
- * The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans.
567
- *
568
- * **Note:** Some of the functions from `node:assert` contain type assertions. If these are called via the
569
- * TestContext `assert` object, then the context parameter in the test's function signature **must be explicitly typed**
570
- * (ie. the parameter must have a type annotation), otherwise an error will be raised by the TypeScript compiler:
571
- * ```ts
572
- * import { test, type TestContext } from 'node:test';
573
- *
574
- * // The test function's context parameter must have a type annotation.
575
- * test('example', (t: TestContext) => {
576
- * t.assert.deepStrictEqual(actual, expected);
577
- * });
578
- *
579
- * // Omitting the type annotation will result in a compilation error.
580
- * test('example', t => {
581
- * t.assert.deepStrictEqual(actual, expected); // Error: 't' needs an explicit type annotation.
582
- * });
583
- * ```
584
- * @since v22.2.0, v20.15.0
585
- */
586
- readonly assert: TestContextAssert;
587
- /**
588
- * This function is used to create a hook running before subtest of the current test.
589
- * @param fn The hook function. The first argument to this function is a `TestContext` object.
590
- * If the hook uses callbacks, the callback function is passed as the second argument.
591
- * @param options Configuration options for the hook.
592
- * @since v20.1.0, v18.17.0
593
- */
594
- before(fn?: TestContextHookFn, options?: HookOptions): void;
595
- /**
596
- * This function is used to create a hook running before each subtest of the current test.
597
- * @param fn The hook function. The first argument to this function is a `TestContext` object.
598
- * If the hook uses callbacks, the callback function is passed as the second argument.
599
- * @param options Configuration options for the hook.
600
- * @since v18.8.0
601
- */
602
- beforeEach(fn?: TestContextHookFn, options?: HookOptions): void;
603
- /**
604
- * This function is used to create a hook that runs after the current test finishes.
605
- * @param fn The hook function. The first argument to this function is a `TestContext` object.
606
- * If the hook uses callbacks, the callback function is passed as the second argument.
607
- * @param options Configuration options for the hook.
608
- * @since v18.13.0
609
- */
610
- after(fn?: TestContextHookFn, options?: HookOptions): void;
611
- /**
612
- * This function is used to create a hook running after each subtest of the current test.
613
- * @param fn The hook function. The first argument to this function is a `TestContext` object.
614
- * If the hook uses callbacks, the callback function is passed as the second argument.
615
- * @param options Configuration options for the hook.
616
- * @since v18.8.0
617
- */
618
- afterEach(fn?: TestContextHookFn, options?: HookOptions): void;
619
- /**
620
- * This function is used to write diagnostics to the output. Any diagnostic
621
- * information is included at the end of the test's results. This function does
622
- * not return a value.
623
- *
624
- * ```js
625
- * test('top level test', (t) => {
626
- * t.diagnostic('A diagnostic message');
627
- * });
628
- * ```
629
- * @since v18.0.0, v16.17.0
630
- * @param message Message to be reported.
631
- */
632
- diagnostic(message: string): void;
633
- /**
634
- * The absolute path of the test file that created the current test. If a test file imports
635
- * additional modules that generate tests, the imported tests will return the path of the root test file.
636
- * @since v22.6.0
637
- */
638
- readonly filePath: string | undefined;
639
- /**
640
- * The name of the test and each of its ancestors, separated by `>`.
641
- * @since v22.3.0
642
- */
643
- readonly fullName: string;
644
- /**
645
- * The name of the test.
646
- * @since v18.8.0, v16.18.0
647
- */
648
- readonly name: string;
649
- /**
650
- * Used to set the number of assertions and subtests that are expected to run within the test.
651
- * If the number of assertions and subtests that run does not match the expected count, the test will fail.
652
- *
653
- * To make sure assertions are tracked, the assert functions on `context.assert` must be used,
654
- * instead of importing from the `node:assert` module.
655
- * ```js
656
- * test('top level test', (t) => {
657
- * t.plan(2);
658
- * t.assert.ok('some relevant assertion here');
659
- * t.test('subtest', () => {});
660
- * });
661
- * ```
662
- *
663
- * When working with asynchronous code, the `plan` function can be used to ensure that the correct number of assertions are run:
664
- * ```js
665
- * test('planning with streams', (t, done) => {
666
- * function* generate() {
667
- * yield 'a';
668
- * yield 'b';
669
- * yield 'c';
670
- * }
671
- * const expected = ['a', 'b', 'c'];
672
- * t.plan(expected.length);
673
- * const stream = Readable.from(generate());
674
- * stream.on('data', (chunk) => {
675
- * t.assert.strictEqual(chunk, expected.shift());
676
- * });
677
- * stream.on('end', () => {
678
- * done();
679
- * });
680
- * });
681
- * ```
682
- * @since v22.2.0
683
- */
684
- plan(count: number): void;
685
- /**
686
- * If `shouldRunOnlyTests` is truthy, the test context will only run tests that
687
- * have the `only` option set. Otherwise, all tests are run. If Node.js was not
688
- * started with the `--test-only` command-line option, this function is a
689
- * no-op.
690
- *
691
- * ```js
692
- * test('top level test', (t) => {
693
- * // The test context can be set to run subtests with the 'only' option.
694
- * t.runOnly(true);
695
- * return Promise.all([
696
- * t.test('this subtest is now skipped'),
697
- * t.test('this subtest is run', { only: true }),
698
- * ]);
699
- * });
700
- * ```
701
- * @since v18.0.0, v16.17.0
702
- * @param shouldRunOnlyTests Whether or not to run `only` tests.
703
- */
704
- runOnly(shouldRunOnlyTests: boolean): void;
705
- /**
706
- * ```js
707
- * test('top level test', async (t) => {
708
- * await fetch('some/uri', { signal: t.signal });
709
- * });
710
- * ```
711
- * @since v18.7.0, v16.17.0
712
- */
713
- readonly signal: AbortSignal;
714
- /**
715
- * This function causes the test's output to indicate the test as skipped. If `message` is provided, it is included in the output. Calling `skip()` does
716
- * not terminate execution of the test function. This function does not return a
717
- * value.
718
- *
719
- * ```js
720
- * test('top level test', (t) => {
721
- * // Make sure to return here as well if the test contains additional logic.
722
- * t.skip('this is skipped');
723
- * });
724
- * ```
725
- * @since v18.0.0, v16.17.0
726
- * @param message Optional skip message.
727
- */
728
- skip(message?: string): void;
729
- /**
730
- * This function adds a `TODO` directive to the test's output. If `message` is
731
- * provided, it is included in the output. Calling `todo()` does not terminate
732
- * execution of the test function. This function does not return a value.
733
- *
734
- * ```js
735
- * test('top level test', (t) => {
736
- * // This test is marked as `TODO`
737
- * t.todo('this is a todo');
738
- * });
739
- * ```
740
- * @since v18.0.0, v16.17.0
741
- * @param message Optional `TODO` message.
742
- */
743
- todo(message?: string): void;
744
- /**
745
- * This function is used to create subtests under the current test. This function behaves in
746
- * the same fashion as the top level {@link test} function.
747
- * @since v18.0.0
748
- * @param name The name of the test, which is displayed when reporting test results.
749
- * Defaults to the `name` property of `fn`, or `'<anonymous>'` if `fn` does not have a name.
750
- * @param options Configuration options for the test.
751
- * @param fn The function under test. This first argument to this function is a {@link TestContext} object.
752
- * If the test uses callbacks, the callback function is passed as the second argument.
753
- * @returns A {@link Promise} resolved with `undefined` once the test completes.
754
- */
755
- test: typeof test;
756
- /**
757
- * Each test provides its own MockTracker instance.
758
- */
759
- readonly mock: MockTracker;
760
- }
761
- interface TestContextAssert extends
762
- Pick<
763
- typeof import("assert"),
764
- | "deepEqual"
765
- | "deepStrictEqual"
766
- | "doesNotMatch"
767
- | "doesNotReject"
768
- | "doesNotThrow"
769
- | "equal"
770
- | "fail"
771
- | "ifError"
772
- | "match"
773
- | "notDeepEqual"
774
- | "notDeepStrictEqual"
775
- | "notEqual"
776
- | "notStrictEqual"
777
- | "ok"
778
- | "partialDeepStrictEqual"
779
- | "rejects"
780
- | "strictEqual"
781
- | "throws"
782
- >
783
- {
784
- /**
785
- * This function implements assertions for snapshot testing.
786
- * ```js
787
- * test('snapshot test with default serialization', (t) => {
788
- * t.assert.snapshot({ value1: 1, value2: 2 });
789
- * });
790
- *
791
- * test('snapshot test with custom serialization', (t) => {
792
- * t.assert.snapshot({ value3: 3, value4: 4 }, {
793
- * serializers: [(value) => JSON.stringify(value)]
794
- * });
795
- * });
796
- * ```
797
- * @since v22.3.0
798
- */
799
- snapshot(value: any, options?: AssertSnapshotOptions): void;
800
- }
801
- interface AssertSnapshotOptions {
802
- /**
803
- * An array of synchronous functions used to serialize `value` into a string.
804
- * `value` is passed as the only argument to the first serializer function.
805
- * The return value of each serializer is passed as input to the next serializer.
806
- * Once all serializers have run, the resulting value is coerced to a string.
807
- *
808
- * If no serializers are provided, the test runner's default serializers are used.
809
- */
810
- serializers?: ReadonlyArray<(value: any) => any> | undefined;
811
- }
812
-
813
- /**
814
- * An instance of `SuiteContext` is passed to each suite function in order to
815
- * interact with the test runner. However, the `SuiteContext` constructor is not
816
- * exposed as part of the API.
817
- * @since v18.7.0, v16.17.0
818
- */
819
- class SuiteContext {
820
- /**
821
- * The absolute path of the test file that created the current suite. If a test file imports
822
- * additional modules that generate suites, the imported suites will return the path of the root test file.
823
- * @since v22.6.0
824
- */
825
- readonly filePath: string | undefined;
826
- /**
827
- * The name of the suite.
828
- * @since v18.8.0, v16.18.0
829
- */
830
- readonly name: string;
831
- /**
832
- * Can be used to abort test subtasks when the test has been aborted.
833
- * @since v18.7.0, v16.17.0
834
- */
835
- readonly signal: AbortSignal;
836
- }
837
- interface TestOptions {
838
- /**
839
- * If a number is provided, then that many tests would run in parallel.
840
- * If truthy, it would run (number of cpu cores - 1) tests in parallel.
841
- * For subtests, it will be `Infinity` tests in parallel.
842
- * If falsy, it would only run one test at a time.
843
- * If unspecified, subtests inherit this value from their parent.
844
- * @default false
845
- */
846
- concurrency?: number | boolean | undefined;
847
- /**
848
- * If truthy, and the test context is configured to run `only` tests, then this test will be
849
- * run. Otherwise, the test is skipped.
850
- * @default false
851
- */
852
- only?: boolean | undefined;
853
- /**
854
- * Allows aborting an in-progress test.
855
- * @since v18.8.0
856
- */
857
- signal?: AbortSignal | undefined;
858
- /**
859
- * If truthy, the test is skipped. If a string is provided, that string is displayed in the
860
- * test results as the reason for skipping the test.
861
- * @default false
862
- */
863
- skip?: boolean | string | undefined;
864
- /**
865
- * A number of milliseconds the test will fail after. If unspecified, subtests inherit this
866
- * value from their parent.
867
- * @default Infinity
868
- * @since v18.7.0
869
- */
870
- timeout?: number | undefined;
871
- /**
872
- * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
873
- * the test results as the reason why the test is `TODO`.
874
- * @default false
875
- */
876
- todo?: boolean | string | undefined;
877
- /**
878
- * The number of assertions and subtests expected to be run in the test.
879
- * If the number of assertions run in the test does not match the number
880
- * specified in the plan, the test will fail.
881
- * @default undefined
882
- * @since v22.2.0
883
- */
884
- plan?: number | undefined;
885
- }
886
- /**
887
- * This function creates a hook that runs before executing a suite.
888
- *
889
- * ```js
890
- * describe('tests', async () => {
891
- * before(() => console.log('about to run some test'));
892
- * it('is a subtest', () => {
893
- * assert.ok('some relevant assertion here');
894
- * });
895
- * });
896
- * ```
897
- * @since v18.8.0, v16.18.0
898
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
899
- * @param options Configuration options for the hook.
900
- */
901
- function before(fn?: HookFn, options?: HookOptions): void;
902
- /**
903
- * This function creates a hook that runs after executing a suite.
904
- *
905
- * ```js
906
- * describe('tests', async () => {
907
- * after(() => console.log('finished running tests'));
908
- * it('is a subtest', () => {
909
- * assert.ok('some relevant assertion here');
910
- * });
911
- * });
912
- * ```
913
- * @since v18.8.0, v16.18.0
914
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
915
- * @param options Configuration options for the hook.
916
- */
917
- function after(fn?: HookFn, options?: HookOptions): void;
918
- /**
919
- * This function creates a hook that runs before each test in the current suite.
920
- *
921
- * ```js
922
- * describe('tests', async () => {
923
- * beforeEach(() => console.log('about to run a test'));
924
- * it('is a subtest', () => {
925
- * assert.ok('some relevant assertion here');
926
- * });
927
- * });
928
- * ```
929
- * @since v18.8.0, v16.18.0
930
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
931
- * @param options Configuration options for the hook.
932
- */
933
- function beforeEach(fn?: HookFn, options?: HookOptions): void;
934
- /**
935
- * This function creates a hook that runs after each test in the current suite.
936
- * The `afterEach()` hook is run even if the test fails.
937
- *
938
- * ```js
939
- * describe('tests', async () => {
940
- * afterEach(() => console.log('finished running a test'));
941
- * it('is a subtest', () => {
942
- * assert.ok('some relevant assertion here');
943
- * });
944
- * });
945
- * ```
946
- * @since v18.8.0, v16.18.0
947
- * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
948
- * @param options Configuration options for the hook.
949
- */
950
- function afterEach(fn?: HookFn, options?: HookOptions): void;
951
- /**
952
- * The hook function. The first argument is the context in which the hook is called.
953
- * If the hook uses callbacks, the callback function is passed as the second argument.
954
- */
955
- type HookFn = (c: TestContext | SuiteContext, done: (result?: any) => void) => any;
956
- /**
957
- * The hook function. The first argument is a `TestContext` object.
958
- * If the hook uses callbacks, the callback function is passed as the second argument.
959
- */
960
- type TestContextHookFn = (t: TestContext, done: (result?: any) => void) => any;
961
- /**
962
- * Configuration options for hooks.
963
- * @since v18.8.0
964
- */
965
- interface HookOptions {
966
- /**
967
- * Allows aborting an in-progress hook.
968
- */
969
- signal?: AbortSignal | undefined;
970
- /**
971
- * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this
972
- * value from their parent.
973
- * @default Infinity
974
- */
975
- timeout?: number | undefined;
976
- }
977
- interface MockFunctionOptions {
978
- /**
979
- * The number of times that the mock will use the behavior of `implementation`.
980
- * Once the mock function has been called `times` times,
981
- * it will automatically restore the behavior of `original`.
982
- * This value must be an integer greater than zero.
983
- * @default Infinity
984
- */
985
- times?: number | undefined;
986
- }
987
- interface MockMethodOptions extends MockFunctionOptions {
988
- /**
989
- * If `true`, `object[methodName]` is treated as a getter.
990
- * This option cannot be used with the `setter` option.
991
- */
992
- getter?: boolean | undefined;
993
- /**
994
- * If `true`, `object[methodName]` is treated as a setter.
995
- * This option cannot be used with the `getter` option.
996
- */
997
- setter?: boolean | undefined;
998
- }
999
- type Mock<F extends Function> = F & {
1000
- mock: MockFunctionContext<F>;
1001
- };
1002
- type NoOpFunction = (...args: any[]) => undefined;
1003
- type FunctionPropertyNames<T> = {
1004
- [K in keyof T]: T[K] extends Function ? K : never;
1005
- }[keyof T];
1006
- interface MockModuleOptions {
1007
- /**
1008
- * If false, each call to `require()` or `import()` generates a new mock module.
1009
- * If true, subsequent calls will return the same module mock, and the mock module is inserted into the CommonJS cache.
1010
- * @default false
1011
- */
1012
- cache?: boolean | undefined;
1013
- /**
1014
- * The value to use as the mocked module's default export.
1015
- *
1016
- * If this value is not provided, ESM mocks do not include a default export.
1017
- * If the mock is a CommonJS or builtin module, this setting is used as the value of `module.exports`.
1018
- * If this value is not provided, CJS and builtin mocks use an empty object as the value of `module.exports`.
1019
- */
1020
- defaultExport?: any;
1021
- /**
1022
- * An object whose keys and values are used to create the named exports of the mock module.
1023
- *
1024
- * If the mock is a CommonJS or builtin module, these values are copied onto `module.exports`.
1025
- * Therefore, if a mock is created with both named exports and a non-object default export,
1026
- * the mock will throw an exception when used as a CJS or builtin module.
1027
- */
1028
- namedExports?: object | undefined;
1029
- }
1030
- /**
1031
- * The `MockTracker` class is used to manage mocking functionality. The test runner
1032
- * module provides a top level `mock` export which is a `MockTracker` instance.
1033
- * Each test also provides its own `MockTracker` instance via the test context's `mock` property.
1034
- * @since v19.1.0, v18.13.0
1035
- */
1036
- class MockTracker {
1037
- /**
1038
- * This function is used to create a mock function.
1039
- *
1040
- * The following example creates a mock function that increments a counter by one
1041
- * on each invocation. The `times` option is used to modify the mock behavior such
1042
- * that the first two invocations add two to the counter instead of one.
1043
- *
1044
- * ```js
1045
- * test('mocks a counting function', (t) => {
1046
- * let cnt = 0;
1047
- *
1048
- * function addOne() {
1049
- * cnt++;
1050
- * return cnt;
1051
- * }
1052
- *
1053
- * function addTwo() {
1054
- * cnt += 2;
1055
- * return cnt;
1056
- * }
1057
- *
1058
- * const fn = t.mock.fn(addOne, addTwo, { times: 2 });
1059
- *
1060
- * assert.strictEqual(fn(), 2);
1061
- * assert.strictEqual(fn(), 4);
1062
- * assert.strictEqual(fn(), 5);
1063
- * assert.strictEqual(fn(), 6);
1064
- * });
1065
- * ```
1066
- * @since v19.1.0, v18.13.0
1067
- * @param original An optional function to create a mock on.
1068
- * @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and
1069
- * then restore the behavior of `original`.
1070
- * @param options Optional configuration options for the mock function.
1071
- * @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the
1072
- * behavior of the mocked function.
1073
- */
1074
- fn<F extends Function = NoOpFunction>(original?: F, options?: MockFunctionOptions): Mock<F>;
1075
- fn<F extends Function = NoOpFunction, Implementation extends Function = F>(
1076
- original?: F,
1077
- implementation?: Implementation,
1078
- options?: MockFunctionOptions,
1079
- ): Mock<F | Implementation>;
1080
- /**
1081
- * This function is used to create a mock on an existing object method. The
1082
- * following example demonstrates how a mock is created on an existing object
1083
- * method.
1084
- *
1085
- * ```js
1086
- * test('spies on an object method', (t) => {
1087
- * const number = {
1088
- * value: 5,
1089
- * subtract(a) {
1090
- * return this.value - a;
1091
- * },
1092
- * };
1093
- *
1094
- * t.mock.method(number, 'subtract');
1095
- * assert.strictEqual(number.subtract.mock.calls.length, 0);
1096
- * assert.strictEqual(number.subtract(3), 2);
1097
- * assert.strictEqual(number.subtract.mock.calls.length, 1);
1098
- *
1099
- * const call = number.subtract.mock.calls[0];
1100
- *
1101
- * assert.deepStrictEqual(call.arguments, [3]);
1102
- * assert.strictEqual(call.result, 2);
1103
- * assert.strictEqual(call.error, undefined);
1104
- * assert.strictEqual(call.target, undefined);
1105
- * assert.strictEqual(call.this, number);
1106
- * });
1107
- * ```
1108
- * @since v19.1.0, v18.13.0
1109
- * @param object The object whose method is being mocked.
1110
- * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown.
1111
- * @param implementation An optional function used as the mock implementation for `object[methodName]`.
1112
- * @param options Optional configuration options for the mock method.
1113
- * @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the
1114
- * behavior of the mocked method.
1115
- */
1116
- method<
1117
- MockedObject extends object,
1118
- MethodName extends FunctionPropertyNames<MockedObject>,
1119
- >(
1120
- object: MockedObject,
1121
- methodName: MethodName,
1122
- options?: MockFunctionOptions,
1123
- ): MockedObject[MethodName] extends Function ? Mock<MockedObject[MethodName]>
1124
- : never;
1125
- method<
1126
- MockedObject extends object,
1127
- MethodName extends FunctionPropertyNames<MockedObject>,
1128
- Implementation extends Function,
1129
- >(
1130
- object: MockedObject,
1131
- methodName: MethodName,
1132
- implementation: Implementation,
1133
- options?: MockFunctionOptions,
1134
- ): MockedObject[MethodName] extends Function ? Mock<MockedObject[MethodName] | Implementation>
1135
- : never;
1136
- method<MockedObject extends object>(
1137
- object: MockedObject,
1138
- methodName: keyof MockedObject,
1139
- options: MockMethodOptions,
1140
- ): Mock<Function>;
1141
- method<MockedObject extends object>(
1142
- object: MockedObject,
1143
- methodName: keyof MockedObject,
1144
- implementation: Function,
1145
- options: MockMethodOptions,
1146
- ): Mock<Function>;
1147
-
1148
- /**
1149
- * This function is syntax sugar for `MockTracker.method` with `options.getter` set to `true`.
1150
- * @since v19.3.0, v18.13.0
1151
- */
1152
- getter<
1153
- MockedObject extends object,
1154
- MethodName extends keyof MockedObject,
1155
- >(
1156
- object: MockedObject,
1157
- methodName: MethodName,
1158
- options?: MockFunctionOptions,
1159
- ): Mock<() => MockedObject[MethodName]>;
1160
- getter<
1161
- MockedObject extends object,
1162
- MethodName extends keyof MockedObject,
1163
- Implementation extends Function,
1164
- >(
1165
- object: MockedObject,
1166
- methodName: MethodName,
1167
- implementation?: Implementation,
1168
- options?: MockFunctionOptions,
1169
- ): Mock<(() => MockedObject[MethodName]) | Implementation>;
1170
- /**
1171
- * This function is syntax sugar for `MockTracker.method` with `options.setter` set to `true`.
1172
- * @since v19.3.0, v18.13.0
1173
- */
1174
- setter<
1175
- MockedObject extends object,
1176
- MethodName extends keyof MockedObject,
1177
- >(
1178
- object: MockedObject,
1179
- methodName: MethodName,
1180
- options?: MockFunctionOptions,
1181
- ): Mock<(value: MockedObject[MethodName]) => void>;
1182
- setter<
1183
- MockedObject extends object,
1184
- MethodName extends keyof MockedObject,
1185
- Implementation extends Function,
1186
- >(
1187
- object: MockedObject,
1188
- methodName: MethodName,
1189
- implementation?: Implementation,
1190
- options?: MockFunctionOptions,
1191
- ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>;
1192
-
1193
- /**
1194
- * This function is used to mock the exports of ECMAScript modules, CommonJS modules, and Node.js builtin modules.
1195
- * Any references to the original module prior to mocking are not impacted.
1196
- *
1197
- * Only available through the [--experimental-test-module-mocks](https://nodejs.org/api/cli.html#--experimental-test-module-mocks) flag.
1198
- * @since v22.3.0
1199
- * @experimental
1200
- * @param specifier A string identifying the module to mock.
1201
- * @param options Optional configuration options for the mock module.
1202
- */
1203
- module(specifier: string, options?: MockModuleOptions): MockModuleContext;
1204
-
1205
- /**
1206
- * This function restores the default behavior of all mocks that were previously
1207
- * created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be
1208
- * used to reset their behavior or
1209
- * otherwise interact with them.
1210
- *
1211
- * After each test completes, this function is called on the test context's `MockTracker`. If the global `MockTracker` is used extensively, calling this
1212
- * function manually is recommended.
1213
- * @since v19.1.0, v18.13.0
1214
- */
1215
- reset(): void;
1216
- /**
1217
- * This function restores the default behavior of all mocks that were previously
1218
- * created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does
1219
- * not disassociate the mocks from the `MockTracker` instance.
1220
- * @since v19.1.0, v18.13.0
1221
- */
1222
- restoreAll(): void;
1223
-
1224
- timers: MockTimers;
1225
- }
1226
- const mock: MockTracker;
1227
- interface MockFunctionCall<
1228
- F extends Function,
1229
- ReturnType = F extends (...args: any) => infer T ? T
1230
- : F extends abstract new(...args: any) => infer T ? T
1231
- : unknown,
1232
- Args = F extends (...args: infer Y) => any ? Y
1233
- : F extends abstract new(...args: infer Y) => any ? Y
1234
- : unknown[],
1235
- > {
1236
- /**
1237
- * An array of the arguments passed to the mock function.
1238
- */
1239
- arguments: Args;
1240
- /**
1241
- * If the mocked function threw then this property contains the thrown value.
1242
- */
1243
- error: unknown | undefined;
1244
- /**
1245
- * The value returned by the mocked function.
1246
- *
1247
- * If the mocked function threw, it will be `undefined`.
1248
- */
1249
- result: ReturnType | undefined;
1250
- /**
1251
- * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation.
1252
- */
1253
- stack: Error;
1254
- /**
1255
- * If the mocked function is a constructor, this field contains the class being constructed.
1256
- * Otherwise this will be `undefined`.
1257
- */
1258
- target: F extends abstract new(...args: any) => any ? F : undefined;
1259
- /**
1260
- * The mocked function's `this` value.
1261
- */
1262
- this: unknown;
1263
- }
1264
- /**
1265
- * The `MockFunctionContext` class is used to inspect or manipulate the behavior of
1266
- * mocks created via the `MockTracker` APIs.
1267
- * @since v19.1.0, v18.13.0
1268
- */
1269
- class MockFunctionContext<F extends Function> {
1270
- /**
1271
- * A getter that returns a copy of the internal array used to track calls to the
1272
- * mock. Each entry in the array is an object with the following properties.
1273
- * @since v19.1.0, v18.13.0
1274
- */
1275
- readonly calls: Array<MockFunctionCall<F>>;
1276
- /**
1277
- * This function returns the number of times that this mock has been invoked. This
1278
- * function is more efficient than checking `ctx.calls.length` because `ctx.calls` is a getter that creates a copy of the internal call tracking array.
1279
- * @since v19.1.0, v18.13.0
1280
- * @return The number of times that this mock has been invoked.
1281
- */
1282
- callCount(): number;
1283
- /**
1284
- * This function is used to change the behavior of an existing mock.
1285
- *
1286
- * The following example creates a mock function using `t.mock.fn()`, calls the
1287
- * mock function, and then changes the mock implementation to a different function.
1288
- *
1289
- * ```js
1290
- * test('changes a mock behavior', (t) => {
1291
- * let cnt = 0;
1292
- *
1293
- * function addOne() {
1294
- * cnt++;
1295
- * return cnt;
1296
- * }
1297
- *
1298
- * function addTwo() {
1299
- * cnt += 2;
1300
- * return cnt;
1301
- * }
1302
- *
1303
- * const fn = t.mock.fn(addOne);
1304
- *
1305
- * assert.strictEqual(fn(), 1);
1306
- * fn.mock.mockImplementation(addTwo);
1307
- * assert.strictEqual(fn(), 3);
1308
- * assert.strictEqual(fn(), 5);
1309
- * });
1310
- * ```
1311
- * @since v19.1.0, v18.13.0
1312
- * @param implementation The function to be used as the mock's new implementation.
1313
- */
1314
- mockImplementation(implementation: F): void;
1315
- /**
1316
- * This function is used to change the behavior of an existing mock for a single
1317
- * invocation. Once invocation `onCall` has occurred, the mock will revert to
1318
- * whatever behavior it would have used had `mockImplementationOnce()` not been
1319
- * called.
1320
- *
1321
- * The following example creates a mock function using `t.mock.fn()`, calls the
1322
- * mock function, changes the mock implementation to a different function for the
1323
- * next invocation, and then resumes its previous behavior.
1324
- *
1325
- * ```js
1326
- * test('changes a mock behavior once', (t) => {
1327
- * let cnt = 0;
1328
- *
1329
- * function addOne() {
1330
- * cnt++;
1331
- * return cnt;
1332
- * }
1333
- *
1334
- * function addTwo() {
1335
- * cnt += 2;
1336
- * return cnt;
1337
- * }
1338
- *
1339
- * const fn = t.mock.fn(addOne);
1340
- *
1341
- * assert.strictEqual(fn(), 1);
1342
- * fn.mock.mockImplementationOnce(addTwo);
1343
- * assert.strictEqual(fn(), 3);
1344
- * assert.strictEqual(fn(), 4);
1345
- * });
1346
- * ```
1347
- * @since v19.1.0, v18.13.0
1348
- * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`.
1349
- * @param onCall The invocation number that will use `implementation`. If the specified invocation has already occurred then an exception is thrown.
1350
- */
1351
- mockImplementationOnce(implementation: F, onCall?: number): void;
1352
- /**
1353
- * Resets the call history of the mock function.
1354
- * @since v19.3.0, v18.13.0
1355
- */
1356
- resetCalls(): void;
1357
- /**
1358
- * Resets the implementation of the mock function to its original behavior. The
1359
- * mock can still be used after calling this function.
1360
- * @since v19.1.0, v18.13.0
1361
- */
1362
- restore(): void;
1363
- }
1364
- /**
1365
- * @since v22.3.0
1366
- * @experimental
1367
- */
1368
- class MockModuleContext {
1369
- /**
1370
- * Resets the implementation of the mock module.
1371
- * @since v22.3.0
1372
- */
1373
- restore(): void;
1374
- }
1375
-
1376
- type Timer = "setInterval" | "setTimeout" | "setImmediate" | "Date";
1377
- interface MockTimersOptions {
1378
- apis: Timer[];
1379
- now?: number | Date | undefined;
1380
- }
1381
- /**
1382
- * Mocking timers is a technique commonly used in software testing to simulate and
1383
- * control the behavior of timers, such as `setInterval` and `setTimeout`,
1384
- * without actually waiting for the specified time intervals.
1385
- *
1386
- * The MockTimers API also allows for mocking of the `Date` constructor and
1387
- * `setImmediate`/`clearImmediate` functions.
1388
- *
1389
- * The `MockTracker` provides a top-level `timers` export
1390
- * which is a `MockTimers` instance.
1391
- * @since v20.4.0
1392
- * @experimental
1393
- */
1394
- class MockTimers {
1395
- /**
1396
- * Enables timer mocking for the specified timers.
1397
- *
1398
- * **Note:** When you enable mocking for a specific timer, its associated
1399
- * clear function will also be implicitly mocked.
1400
- *
1401
- * **Note:** Mocking `Date` will affect the behavior of the mocked timers
1402
- * as they use the same internal clock.
1403
- *
1404
- * Example usage without setting initial time:
1405
- *
1406
- * ```js
1407
- * import { mock } from 'node:test';
1408
- * mock.timers.enable({ apis: ['setInterval', 'Date'], now: 1234 });
1409
- * ```
1410
- *
1411
- * The above example enables mocking for the `Date` constructor, `setInterval` timer and
1412
- * implicitly mocks the `clearInterval` function. Only the `Date` constructor from `globalThis`,
1413
- * `setInterval` and `clearInterval` functions from `node:timers`, `node:timers/promises`, and `globalThis` will be mocked.
1414
- *
1415
- * Example usage with initial time set
1416
- *
1417
- * ```js
1418
- * import { mock } from 'node:test';
1419
- * mock.timers.enable({ apis: ['Date'], now: 1000 });
1420
- * ```
1421
- *
1422
- * Example usage with initial Date object as time set
1423
- *
1424
- * ```js
1425
- * import { mock } from 'node:test';
1426
- * mock.timers.enable({ apis: ['Date'], now: new Date() });
1427
- * ```
1428
- *
1429
- * Alternatively, if you call `mock.timers.enable()` without any parameters:
1430
- *
1431
- * All timers (`'setInterval'`, `'clearInterval'`, `'Date'`, `'setImmediate'`, `'clearImmediate'`, `'setTimeout'`, and `'clearTimeout'`)
1432
- * will be mocked.
1433
- *
1434
- * The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout` functions from `node:timers`, `node:timers/promises`,
1435
- * and `globalThis` will be mocked.
1436
- * The `Date` constructor from `globalThis` will be mocked.
1437
- *
1438
- * If there is no initial epoch set, the initial date will be based on 0 in the Unix epoch. This is `January 1st, 1970, 00:00:00 UTC`. You can
1439
- * set an initial date by passing a now property to the `.enable()` method. This value will be used as the initial date for the mocked Date
1440
- * object. It can either be a positive integer, or another Date object.
1441
- * @since v20.4.0
1442
- */
1443
- enable(options?: MockTimersOptions): void;
1444
- /**
1445
- * You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer.
1446
- * Note: This method will execute any mocked timers that are in the past from the new time.
1447
- * In the below example we are setting a new time for the mocked date.
1448
- * ```js
1449
- * import assert from 'node:assert';
1450
- * import { test } from 'node:test';
1451
- * test('sets the time of a date object', (context) => {
1452
- * // Optionally choose what to mock
1453
- * context.mock.timers.enable({ apis: ['Date'], now: 100 });
1454
- * assert.strictEqual(Date.now(), 100);
1455
- * // Advance in time will also advance the date
1456
- * context.mock.timers.setTime(1000);
1457
- * context.mock.timers.tick(200);
1458
- * assert.strictEqual(Date.now(), 1200);
1459
- * });
1460
- * ```
1461
- */
1462
- setTime(time: number): void;
1463
- /**
1464
- * This function restores the default behavior of all mocks that were previously
1465
- * created by this `MockTimers` instance and disassociates the mocks
1466
- * from the `MockTracker` instance.
1467
- *
1468
- * **Note:** After each test completes, this function is called on
1469
- * the test context's `MockTracker`.
1470
- *
1471
- * ```js
1472
- * import { mock } from 'node:test';
1473
- * mock.timers.reset();
1474
- * ```
1475
- * @since v20.4.0
1476
- */
1477
- reset(): void;
1478
- /**
1479
- * Advances time for all mocked timers.
1480
- *
1481
- * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts
1482
- * only positive numbers. In Node.js, `setTimeout` with negative numbers is
1483
- * only supported for web compatibility reasons.
1484
- *
1485
- * The following example mocks a `setTimeout` function and
1486
- * by using `.tick` advances in
1487
- * time triggering all pending timers.
1488
- *
1489
- * ```js
1490
- * import assert from 'node:assert';
1491
- * import { test } from 'node:test';
1492
- *
1493
- * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => {
1494
- * const fn = context.mock.fn();
1495
- *
1496
- * context.mock.timers.enable({ apis: ['setTimeout'] });
1497
- *
1498
- * setTimeout(fn, 9999);
1499
- *
1500
- * assert.strictEqual(fn.mock.callCount(), 0);
1501
- *
1502
- * // Advance in time
1503
- * context.mock.timers.tick(9999);
1504
- *
1505
- * assert.strictEqual(fn.mock.callCount(), 1);
1506
- * });
1507
- * ```
1508
- *
1509
- * Alternativelly, the `.tick` function can be called many times
1510
- *
1511
- * ```js
1512
- * import assert from 'node:assert';
1513
- * import { test } from 'node:test';
1514
- *
1515
- * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => {
1516
- * const fn = context.mock.fn();
1517
- * context.mock.timers.enable({ apis: ['setTimeout'] });
1518
- * const nineSecs = 9000;
1519
- * setTimeout(fn, nineSecs);
1520
- *
1521
- * const twoSeconds = 3000;
1522
- * context.mock.timers.tick(twoSeconds);
1523
- * context.mock.timers.tick(twoSeconds);
1524
- * context.mock.timers.tick(twoSeconds);
1525
- *
1526
- * assert.strictEqual(fn.mock.callCount(), 1);
1527
- * });
1528
- * ```
1529
- *
1530
- * Advancing time using `.tick` will also advance the time for any `Date` object
1531
- * created after the mock was enabled (if `Date` was also set to be mocked).
1532
- *
1533
- * ```js
1534
- * import assert from 'node:assert';
1535
- * import { test } from 'node:test';
1536
- *
1537
- * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => {
1538
- * const fn = context.mock.fn();
1539
- *
1540
- * context.mock.timers.enable({ apis: ['setTimeout', 'Date'] });
1541
- * setTimeout(fn, 9999);
1542
- *
1543
- * assert.strictEqual(fn.mock.callCount(), 0);
1544
- * assert.strictEqual(Date.now(), 0);
1545
- *
1546
- * // Advance in time
1547
- * context.mock.timers.tick(9999);
1548
- * assert.strictEqual(fn.mock.callCount(), 1);
1549
- * assert.strictEqual(Date.now(), 9999);
1550
- * });
1551
- * ```
1552
- * @since v20.4.0
1553
- */
1554
- tick(milliseconds: number): void;
1555
- /**
1556
- * Triggers all pending mocked timers immediately. If the `Date` object is also
1557
- * mocked, it will also advance the `Date` object to the furthest timer's time.
1558
- *
1559
- * The example below triggers all pending timers immediately,
1560
- * causing them to execute without any delay.
1561
- *
1562
- * ```js
1563
- * import assert from 'node:assert';
1564
- * import { test } from 'node:test';
1565
- *
1566
- * test('runAll functions following the given order', (context) => {
1567
- * context.mock.timers.enable({ apis: ['setTimeout', 'Date'] });
1568
- * const results = [];
1569
- * setTimeout(() => results.push(1), 9999);
1570
- *
1571
- * // Notice that if both timers have the same timeout,
1572
- * // the order of execution is guaranteed
1573
- * setTimeout(() => results.push(3), 8888);
1574
- * setTimeout(() => results.push(2), 8888);
1575
- *
1576
- * assert.deepStrictEqual(results, []);
1577
- *
1578
- * context.mock.timers.runAll();
1579
- * assert.deepStrictEqual(results, [3, 2, 1]);
1580
- * // The Date object is also advanced to the furthest timer's time
1581
- * assert.strictEqual(Date.now(), 9999);
1582
- * });
1583
- * ```
1584
- *
1585
- * **Note:** The `runAll()` function is specifically designed for
1586
- * triggering timers in the context of timer mocking.
1587
- * It does not have any effect on real-time system
1588
- * clocks or actual timers outside of the mocking environment.
1589
- * @since v20.4.0
1590
- */
1591
- runAll(): void;
1592
- /**
1593
- * Calls {@link MockTimers.reset()}.
1594
- */
1595
- [Symbol.dispose](): void;
1596
- }
1597
- /**
1598
- * @since v22.3.0
1599
- */
1600
- namespace snapshot {
1601
- /**
1602
- * This function is used to customize the default serialization mechanism used by the test runner.
1603
- *
1604
- * By default, the test runner performs serialization by calling `JSON.stringify(value, null, 2)` on the provided value.
1605
- * `JSON.stringify()` does have limitations regarding circular structures and supported data types.
1606
- * If a more robust serialization mechanism is required, this function should be used to specify a list of custom serializers.
1607
- *
1608
- * Serializers are called in order, with the output of the previous serializer passed as input to the next.
1609
- * The final result must be a string value.
1610
- * @since v22.3.0
1611
- * @param serializers An array of synchronous functions used as the default serializers for snapshot tests.
1612
- */
1613
- function setDefaultSnapshotSerializers(serializers: ReadonlyArray<(value: any) => any>): void;
1614
- /**
1615
- * This function is used to set a custom resolver for the location of the snapshot file used for snapshot testing.
1616
- * By default, the snapshot filename is the same as the entry point filename with `.snapshot` appended.
1617
- * @since v22.3.0
1618
- * @param fn A function used to compute the location of the snapshot file.
1619
- * The function receives the path of the test file as its only argument. If the
1620
- * test is not associated with a file (for example in the REPL), the input is
1621
- * undefined. `fn()` must return a string specifying the location of the snapshot file.
1622
- */
1623
- function setResolveSnapshotPath(fn: (path: string | undefined) => string): void;
1624
- }
1625
- export {
1626
- after,
1627
- afterEach,
1628
- before,
1629
- beforeEach,
1630
- describe,
1631
- it,
1632
- Mock,
1633
- mock,
1634
- only,
1635
- run,
1636
- skip,
1637
- snapshot,
1638
- suite,
1639
- SuiteContext,
1640
- test,
1641
- test as default,
1642
- TestContext,
1643
- todo,
1644
- };
1645
- }
1646
-
1647
- interface TestError extends Error {
1648
- cause: Error;
1649
- }
1650
- interface TestLocationInfo {
1651
- /**
1652
- * The column number where the test is defined, or
1653
- * `undefined` if the test was run through the REPL.
1654
- */
1655
- column?: number;
1656
- /**
1657
- * The path of the test file, `undefined` if test was run through the REPL.
1658
- */
1659
- file?: string;
1660
- /**
1661
- * The line number where the test is defined, or `undefined` if the test was run through the REPL.
1662
- */
1663
- line?: number;
1664
- }
1665
- interface DiagnosticData extends TestLocationInfo {
1666
- /**
1667
- * The diagnostic message.
1668
- */
1669
- message: string;
1670
- /**
1671
- * The nesting level of the test.
1672
- */
1673
- nesting: number;
1674
- }
1675
- interface TestCoverage {
1676
- /**
1677
- * An object containing the coverage report.
1678
- */
1679
- summary: {
1680
- /**
1681
- * An array of coverage reports for individual files.
1682
- */
1683
- files: Array<{
1684
- /**
1685
- * The absolute path of the file.
1686
- */
1687
- path: string;
1688
- /**
1689
- * The total number of lines.
1690
- */
1691
- totalLineCount: number;
1692
- /**
1693
- * The total number of branches.
1694
- */
1695
- totalBranchCount: number;
1696
- /**
1697
- * The total number of functions.
1698
- */
1699
- totalFunctionCount: number;
1700
- /**
1701
- * The number of covered lines.
1702
- */
1703
- coveredLineCount: number;
1704
- /**
1705
- * The number of covered branches.
1706
- */
1707
- coveredBranchCount: number;
1708
- /**
1709
- * The number of covered functions.
1710
- */
1711
- coveredFunctionCount: number;
1712
- /**
1713
- * The percentage of lines covered.
1714
- */
1715
- coveredLinePercent: number;
1716
- /**
1717
- * The percentage of branches covered.
1718
- */
1719
- coveredBranchPercent: number;
1720
- /**
1721
- * The percentage of functions covered.
1722
- */
1723
- coveredFunctionPercent: number;
1724
- /**
1725
- * An array of functions representing function coverage.
1726
- */
1727
- functions: Array<{
1728
- /**
1729
- * The name of the function.
1730
- */
1731
- name: string;
1732
- /**
1733
- * The line number where the function is defined.
1734
- */
1735
- line: number;
1736
- /**
1737
- * The number of times the function was called.
1738
- */
1739
- count: number;
1740
- }>;
1741
- /**
1742
- * An array of branches representing branch coverage.
1743
- */
1744
- branches: Array<{
1745
- /**
1746
- * The line number where the branch is defined.
1747
- */
1748
- line: number;
1749
- /**
1750
- * The number of times the branch was taken.
1751
- */
1752
- count: number;
1753
- }>;
1754
- /**
1755
- * An array of lines representing line numbers and the number of times they were covered.
1756
- */
1757
- lines: Array<{
1758
- /**
1759
- * The line number.
1760
- */
1761
- line: number;
1762
- /**
1763
- * The number of times the line was covered.
1764
- */
1765
- count: number;
1766
- }>;
1767
- }>;
1768
- /**
1769
- * An object containing whether or not the coverage for
1770
- * each coverage type.
1771
- * @since v22.9.0
1772
- */
1773
- thresholds: {
1774
- /**
1775
- * The function coverage threshold.
1776
- */
1777
- function: number;
1778
- /**
1779
- * The branch coverage threshold.
1780
- */
1781
- branch: number;
1782
- /**
1783
- * The line coverage threshold.
1784
- */
1785
- line: number;
1786
- };
1787
- /**
1788
- * An object containing a summary of coverage for all files.
1789
- */
1790
- totals: {
1791
- /**
1792
- * The total number of lines.
1793
- */
1794
- totalLineCount: number;
1795
- /**
1796
- * The total number of branches.
1797
- */
1798
- totalBranchCount: number;
1799
- /**
1800
- * The total number of functions.
1801
- */
1802
- totalFunctionCount: number;
1803
- /**
1804
- * The number of covered lines.
1805
- */
1806
- coveredLineCount: number;
1807
- /**
1808
- * The number of covered branches.
1809
- */
1810
- coveredBranchCount: number;
1811
- /**
1812
- * The number of covered functions.
1813
- */
1814
- coveredFunctionCount: number;
1815
- /**
1816
- * The percentage of lines covered.
1817
- */
1818
- coveredLinePercent: number;
1819
- /**
1820
- * The percentage of branches covered.
1821
- */
1822
- coveredBranchPercent: number;
1823
- /**
1824
- * The percentage of functions covered.
1825
- */
1826
- coveredFunctionPercent: number;
1827
- };
1828
- /**
1829
- * The working directory when code coverage began. This
1830
- * is useful for displaying relative path names in case
1831
- * the tests changed the working directory of the Node.js process.
1832
- */
1833
- workingDirectory: string;
1834
- };
1835
- /**
1836
- * The nesting level of the test.
1837
- */
1838
- nesting: number;
1839
- }
1840
- interface TestComplete extends TestLocationInfo {
1841
- /**
1842
- * Additional execution metadata.
1843
- */
1844
- details: {
1845
- /**
1846
- * Whether the test passed or not.
1847
- */
1848
- passed: boolean;
1849
- /**
1850
- * The duration of the test in milliseconds.
1851
- */
1852
- duration_ms: number;
1853
- /**
1854
- * An error wrapping the error thrown by the test if it did not pass.
1855
- */
1856
- error?: TestError;
1857
- /**
1858
- * The type of the test, used to denote whether this is a suite.
1859
- */
1860
- type?: "suite";
1861
- };
1862
- /**
1863
- * The test name.
1864
- */
1865
- name: string;
1866
- /**
1867
- * The nesting level of the test.
1868
- */
1869
- nesting: number;
1870
- /**
1871
- * The ordinal number of the test.
1872
- */
1873
- testNumber: number;
1874
- /**
1875
- * Present if `context.todo` is called.
1876
- */
1877
- todo?: string | boolean;
1878
- /**
1879
- * Present if `context.skip` is called.
1880
- */
1881
- skip?: string | boolean;
1882
- }
1883
- interface TestDequeue extends TestLocationInfo {
1884
- /**
1885
- * The test name.
1886
- */
1887
- name: string;
1888
- /**
1889
- * The nesting level of the test.
1890
- */
1891
- nesting: number;
1892
- }
1893
- interface TestEnqueue extends TestLocationInfo {
1894
- /**
1895
- * The test name.
1896
- */
1897
- name: string;
1898
- /**
1899
- * The nesting level of the test.
1900
- */
1901
- nesting: number;
1902
- }
1903
- interface TestFail extends TestLocationInfo {
1904
- /**
1905
- * Additional execution metadata.
1906
- */
1907
- details: {
1908
- /**
1909
- * The duration of the test in milliseconds.
1910
- */
1911
- duration_ms: number;
1912
- /**
1913
- * An error wrapping the error thrown by the test.
1914
- */
1915
- error: TestError;
1916
- /**
1917
- * The type of the test, used to denote whether this is a suite.
1918
- * @since v20.0.0, v19.9.0, v18.17.0
1919
- */
1920
- type?: "suite";
1921
- };
1922
- /**
1923
- * The test name.
1924
- */
1925
- name: string;
1926
- /**
1927
- * The nesting level of the test.
1928
- */
1929
- nesting: number;
1930
- /**
1931
- * The ordinal number of the test.
1932
- */
1933
- testNumber: number;
1934
- /**
1935
- * Present if `context.todo` is called.
1936
- */
1937
- todo?: string | boolean;
1938
- /**
1939
- * Present if `context.skip` is called.
1940
- */
1941
- skip?: string | boolean;
1942
- }
1943
- interface TestPass extends TestLocationInfo {
1944
- /**
1945
- * Additional execution metadata.
1946
- */
1947
- details: {
1948
- /**
1949
- * The duration of the test in milliseconds.
1950
- */
1951
- duration_ms: number;
1952
- /**
1953
- * The type of the test, used to denote whether this is a suite.
1954
- * @since 20.0.0, 19.9.0, 18.17.0
1955
- */
1956
- type?: "suite";
1957
- };
1958
- /**
1959
- * The test name.
1960
- */
1961
- name: string;
1962
- /**
1963
- * The nesting level of the test.
1964
- */
1965
- nesting: number;
1966
- /**
1967
- * The ordinal number of the test.
1968
- */
1969
- testNumber: number;
1970
- /**
1971
- * Present if `context.todo` is called.
1972
- */
1973
- todo?: string | boolean;
1974
- /**
1975
- * Present if `context.skip` is called.
1976
- */
1977
- skip?: string | boolean;
1978
- }
1979
- interface TestPlan extends TestLocationInfo {
1980
- /**
1981
- * The nesting level of the test.
1982
- */
1983
- nesting: number;
1984
- /**
1985
- * The number of subtests that have ran.
1986
- */
1987
- count: number;
1988
- }
1989
- interface TestStart extends TestLocationInfo {
1990
- /**
1991
- * The test name.
1992
- */
1993
- name: string;
1994
- /**
1995
- * The nesting level of the test.
1996
- */
1997
- nesting: number;
1998
- }
1999
- interface TestStderr {
2000
- /**
2001
- * The path of the test file.
2002
- */
2003
- file: string;
2004
- /**
2005
- * The message written to `stderr`.
2006
- */
2007
- message: string;
2008
- }
2009
- interface TestStdout {
2010
- /**
2011
- * The path of the test file.
2012
- */
2013
- file: string;
2014
- /**
2015
- * The message written to `stdout`.
2016
- */
2017
- message: string;
2018
- }
2019
- interface TestSummary {
2020
- /**
2021
- * An object containing the counts of various test results.
2022
- */
2023
- counts: {
2024
- /**
2025
- * The total number of cancelled tests.
2026
- */
2027
- cancelled: number;
2028
- /**
2029
- * The total number of passed tests.
2030
- */
2031
- passed: number;
2032
- /**
2033
- * The total number of skipped tests.
2034
- */
2035
- skipped: number;
2036
- /**
2037
- * The total number of suites run.
2038
- */
2039
- suites: number;
2040
- /**
2041
- * The total number of tests run, excluding suites.
2042
- */
2043
- tests: number;
2044
- /**
2045
- * The total number of TODO tests.
2046
- */
2047
- todo: number;
2048
- /**
2049
- * The total number of top level tests and suites.
2050
- */
2051
- topLevel: number;
2052
- };
2053
- /**
2054
- * The duration of the test run in milliseconds.
2055
- */
2056
- duration_ms: number;
2057
- /**
2058
- * The path of the test file that generated the
2059
- * summary. If the summary corresponds to multiple files, this value is
2060
- * `undefined`.
2061
- */
2062
- file: string | undefined;
2063
- /**
2064
- * Indicates whether or not the test run is considered
2065
- * successful or not. If any error condition occurs, such as a failing test or
2066
- * unmet coverage threshold, this value will be set to `false`.
2067
- */
2068
- success: boolean;
2069
- }
2070
-
2071
- /**
2072
- * The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
2073
- * To access it:
2074
- *
2075
- * ```js
2076
- * import test from 'node:test/reporters';
2077
- * ```
2078
- *
2079
- * This module is only available under the `node:` scheme. The following will not
2080
- * work:
2081
- *
2082
- * ```js
2083
- * import test from 'node:test/reporters';
2084
- * ```
2085
- * @since v19.9.0
2086
- * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/test/reporters.js)
2087
- */
2088
- declare module "node:test/reporters" {
2089
- import { Transform, TransformOptions } from "node:stream";
2090
-
2091
- type TestEvent =
2092
- | { type: "test:coverage"; data: TestCoverage }
2093
- | { type: "test:complete"; data: TestComplete }
2094
- | { type: "test:dequeue"; data: TestDequeue }
2095
- | { type: "test:diagnostic"; data: DiagnosticData }
2096
- | { type: "test:enqueue"; data: TestEnqueue }
2097
- | { type: "test:fail"; data: TestFail }
2098
- | { type: "test:pass"; data: TestPass }
2099
- | { type: "test:plan"; data: TestPlan }
2100
- | { type: "test:start"; data: TestStart }
2101
- | { type: "test:stderr"; data: TestStderr }
2102
- | { type: "test:stdout"; data: TestStdout }
2103
- | { type: "test:summary"; data: TestSummary }
2104
- | { type: "test:watch:drained"; data: undefined };
2105
- type TestEventGenerator = AsyncGenerator<TestEvent, void>;
2106
-
2107
- interface ReporterConstructorWrapper<T extends new(...args: any[]) => Transform> {
2108
- new(...args: ConstructorParameters<T>): InstanceType<T>;
2109
- (...args: ConstructorParameters<T>): InstanceType<T>;
2110
- }
2111
-
2112
- /**
2113
- * The `dot` reporter outputs the test results in a compact format,
2114
- * where each passing test is represented by a `.`,
2115
- * and each failing test is represented by a `X`.
2116
- * @since v20.0.0
2117
- */
2118
- function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
2119
- /**
2120
- * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
2121
- * @since v20.0.0
2122
- */
2123
- function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
2124
- class SpecReporter extends Transform {
2125
- constructor();
2126
- }
2127
- /**
2128
- * The `spec` reporter outputs the test results in a human-readable format.
2129
- * @since v20.0.0
2130
- */
2131
- const spec: ReporterConstructorWrapper<typeof SpecReporter>;
2132
- /**
2133
- * The `junit` reporter outputs test results in a jUnit XML format.
2134
- * @since v21.0.0
2135
- */
2136
- function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
2137
- class LcovReporter extends Transform {
2138
- constructor(opts?: Omit<TransformOptions, "writableObjectMode">);
2139
- }
2140
- /**
2141
- * The `lcov` reporter outputs test coverage when used with the
2142
- * [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag.
2143
- * @since v22.0.0
2144
- */
2145
- // TODO: change the export to a wrapper function once node@0db38f0 is merged (breaking change)
2146
- // const lcov: ReporterConstructorWrapper<typeof LcovReporter>;
2147
- const lcov: LcovReporter;
2148
-
2149
- export { dot, junit, lcov, spec, tap, TestEvent };
2150
- }