ibm-cloud-sdk-core 4.3.3 → 4.3.4

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 (457) hide show
  1. package/iamtest.env +3 -0
  2. package/package.json +2 -2
  3. package/sdk-test-utilities/node_modules/.package-lock.json +508 -0
  4. package/sdk-test-utilities/node_modules/@babel/code-frame/LICENSE +22 -0
  5. package/sdk-test-utilities/node_modules/@babel/code-frame/README.md +19 -0
  6. package/sdk-test-utilities/node_modules/@babel/code-frame/lib/index.js +156 -0
  7. package/sdk-test-utilities/node_modules/@babel/code-frame/lib/index.js.map +1 -0
  8. package/sdk-test-utilities/node_modules/@babel/code-frame/package.json +30 -0
  9. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/LICENSE +22 -0
  10. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/README.md +19 -0
  11. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/identifier.js +70 -0
  12. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -0
  13. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/index.js +57 -0
  14. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -0
  15. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/keyword.js +35 -0
  16. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +1 -0
  17. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/package.json +31 -0
  18. package/sdk-test-utilities/node_modules/@babel/highlight/LICENSE +22 -0
  19. package/sdk-test-utilities/node_modules/@babel/highlight/README.md +19 -0
  20. package/sdk-test-utilities/node_modules/@babel/highlight/lib/index.js +119 -0
  21. package/sdk-test-utilities/node_modules/@babel/highlight/lib/index.js.map +1 -0
  22. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/index.js +165 -0
  23. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/license +9 -0
  24. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/package.json +56 -0
  25. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/readme.md +147 -0
  26. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/index.js +228 -0
  27. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/index.js.flow +93 -0
  28. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/license +9 -0
  29. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/package.json +71 -0
  30. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/readme.md +314 -0
  31. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/templates.js +128 -0
  32. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/types/index.d.ts +97 -0
  33. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/CHANGELOG.md +54 -0
  34. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/LICENSE +21 -0
  35. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/README.md +68 -0
  36. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/conversions.js +868 -0
  37. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/index.js +78 -0
  38. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/package.json +46 -0
  39. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/route.js +97 -0
  40. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/.eslintrc.json +43 -0
  41. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/LICENSE +8 -0
  42. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/README.md +11 -0
  43. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/index.js +152 -0
  44. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/package.json +25 -0
  45. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/test.js +7 -0
  46. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js +11 -0
  47. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/license +21 -0
  48. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/package.json +41 -0
  49. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/readme.md +27 -0
  50. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/index.js +8 -0
  51. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/license +9 -0
  52. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/package.json +44 -0
  53. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/readme.md +70 -0
  54. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/browser.js +5 -0
  55. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/index.js +131 -0
  56. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/license +9 -0
  57. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/package.json +53 -0
  58. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/readme.md +66 -0
  59. package/sdk-test-utilities/node_modules/@babel/highlight/package.json +30 -0
  60. package/sdk-test-utilities/node_modules/@jest/expect-utils/LICENSE +21 -0
  61. package/sdk-test-utilities/node_modules/@jest/expect-utils/README.md +5 -0
  62. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/immutableUtils.js +66 -0
  63. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/index.d.ts +94 -0
  64. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/index.js +34 -0
  65. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/jasmineUtils.js +218 -0
  66. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/types.js +1 -0
  67. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/utils.js +462 -0
  68. package/sdk-test-utilities/node_modules/@jest/expect-utils/package.json +35 -0
  69. package/sdk-test-utilities/node_modules/@jest/schemas/LICENSE +21 -0
  70. package/sdk-test-utilities/node_modules/@jest/schemas/README.md +3 -0
  71. package/sdk-test-utilities/node_modules/@jest/schemas/build/index.d.ts +63 -0
  72. package/sdk-test-utilities/node_modules/@jest/schemas/build/index.js +60 -0
  73. package/sdk-test-utilities/node_modules/@jest/schemas/package.json +29 -0
  74. package/sdk-test-utilities/node_modules/@jest/types/LICENSE +21 -0
  75. package/sdk-test-utilities/node_modules/@jest/types/README.md +30 -0
  76. package/sdk-test-utilities/node_modules/@jest/types/build/Circus.js +1 -0
  77. package/sdk-test-utilities/node_modules/@jest/types/build/Config.js +1 -0
  78. package/sdk-test-utilities/node_modules/@jest/types/build/Global.js +1 -0
  79. package/sdk-test-utilities/node_modules/@jest/types/build/TestResult.js +1 -0
  80. package/sdk-test-utilities/node_modules/@jest/types/build/index.d.ts +1204 -0
  81. package/sdk-test-utilities/node_modules/@jest/types/build/index.js +1 -0
  82. package/sdk-test-utilities/node_modules/@jest/types/package.json +38 -0
  83. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/compiler.d.ts +35 -0
  84. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/compiler.js +577 -0
  85. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/index.d.ts +2 -0
  86. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/index.js +47 -0
  87. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/errors.d.ts +88 -0
  88. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/errors.js +609 -0
  89. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/index.d.ts +1 -0
  90. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/index.js +44 -0
  91. package/sdk-test-utilities/node_modules/@sinclair/typebox/license +23 -0
  92. package/sdk-test-utilities/node_modules/@sinclair/typebox/package.json +47 -0
  93. package/sdk-test-utilities/node_modules/@sinclair/typebox/readme.md +1424 -0
  94. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/index.d.ts +1 -0
  95. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/index.js +44 -0
  96. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/system.d.ts +26 -0
  97. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/system.js +90 -0
  98. package/sdk-test-utilities/node_modules/@sinclair/typebox/typebox.d.ts +723 -0
  99. package/sdk-test-utilities/node_modules/@sinclair/typebox/typebox.js +2220 -0
  100. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/cast.d.ts +30 -0
  101. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/cast.js +372 -0
  102. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/check.d.ts +12 -0
  103. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/check.js +484 -0
  104. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/clone.d.ts +3 -0
  105. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/clone.js +71 -0
  106. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/convert.d.ts +13 -0
  107. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/convert.js +372 -0
  108. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/create.d.ts +26 -0
  109. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/create.js +480 -0
  110. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/delta.d.ts +43 -0
  111. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/delta.js +204 -0
  112. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/equal.d.ts +3 -0
  113. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/equal.js +80 -0
  114. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/hash.d.ts +8 -0
  115. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/hash.js +208 -0
  116. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/index.d.ts +6 -0
  117. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/index.js +56 -0
  118. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/is.d.ts +11 -0
  119. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/is.js +53 -0
  120. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/mutate.d.ts +13 -0
  121. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/mutate.js +121 -0
  122. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/pointer.d.ts +24 -0
  123. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/pointer.js +142 -0
  124. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/value.d.ts +39 -0
  125. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/value.js +99 -0
  126. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/LICENSE +21 -0
  127. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/README.md +15 -0
  128. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/index.d.ts +111 -0
  129. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/package.json +25 -0
  130. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/LICENSE +21 -0
  131. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/README.md +15 -0
  132. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/index.d.ts +184 -0
  133. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/package.json +32 -0
  134. package/sdk-test-utilities/node_modules/@types/istanbul-reports/LICENSE +21 -0
  135. package/sdk-test-utilities/node_modules/@types/istanbul-reports/README.md +86 -0
  136. package/sdk-test-utilities/node_modules/@types/istanbul-reports/index.d.ts +67 -0
  137. package/sdk-test-utilities/node_modules/@types/istanbul-reports/package.json +32 -0
  138. package/sdk-test-utilities/node_modules/@types/node/LICENSE +21 -0
  139. package/sdk-test-utilities/node_modules/@types/node/README.md +15 -0
  140. package/sdk-test-utilities/node_modules/@types/node/assert/strict.d.ts +8 -0
  141. package/sdk-test-utilities/node_modules/@types/node/assert.d.ts +1040 -0
  142. package/sdk-test-utilities/node_modules/@types/node/async_hooks.d.ts +541 -0
  143. package/sdk-test-utilities/node_modules/@types/node/buffer.d.ts +2363 -0
  144. package/sdk-test-utilities/node_modules/@types/node/child_process.d.ts +1544 -0
  145. package/sdk-test-utilities/node_modules/@types/node/cluster.d.ts +578 -0
  146. package/sdk-test-utilities/node_modules/@types/node/console.d.ts +452 -0
  147. package/sdk-test-utilities/node_modules/@types/node/constants.d.ts +19 -0
  148. package/sdk-test-utilities/node_modules/@types/node/crypto.d.ts +4523 -0
  149. package/sdk-test-utilities/node_modules/@types/node/dgram.d.ts +596 -0
  150. package/sdk-test-utilities/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  151. package/sdk-test-utilities/node_modules/@types/node/dns/promises.d.ts +474 -0
  152. package/sdk-test-utilities/node_modules/@types/node/dns.d.ts +864 -0
  153. package/sdk-test-utilities/node_modules/@types/node/dom-events.d.ts +124 -0
  154. package/sdk-test-utilities/node_modules/@types/node/domain.d.ts +170 -0
  155. package/sdk-test-utilities/node_modules/@types/node/events.d.ts +909 -0
  156. package/sdk-test-utilities/node_modules/@types/node/fs/promises.d.ts +1245 -0
  157. package/sdk-test-utilities/node_modules/@types/node/fs.d.ts +4317 -0
  158. package/sdk-test-utilities/node_modules/@types/node/globals.d.ts +411 -0
  159. package/sdk-test-utilities/node_modules/@types/node/globals.global.d.ts +1 -0
  160. package/sdk-test-utilities/node_modules/@types/node/http.d.ts +1908 -0
  161. package/sdk-test-utilities/node_modules/@types/node/http2.d.ts +2418 -0
  162. package/sdk-test-utilities/node_modules/@types/node/https.d.ts +550 -0
  163. package/sdk-test-utilities/node_modules/@types/node/index.d.ts +89 -0
  164. package/sdk-test-utilities/node_modules/@types/node/inspector.d.ts +2746 -0
  165. package/sdk-test-utilities/node_modules/@types/node/module.d.ts +315 -0
  166. package/sdk-test-utilities/node_modules/@types/node/net.d.ts +999 -0
  167. package/sdk-test-utilities/node_modules/@types/node/os.d.ts +495 -0
  168. package/sdk-test-utilities/node_modules/@types/node/package.json +217 -0
  169. package/sdk-test-utilities/node_modules/@types/node/path.d.ts +191 -0
  170. package/sdk-test-utilities/node_modules/@types/node/perf_hooks.d.ts +905 -0
  171. package/sdk-test-utilities/node_modules/@types/node/process.d.ts +1754 -0
  172. package/sdk-test-utilities/node_modules/@types/node/punycode.d.ts +117 -0
  173. package/sdk-test-utilities/node_modules/@types/node/querystring.d.ts +153 -0
  174. package/sdk-test-utilities/node_modules/@types/node/readline/promises.d.ts +150 -0
  175. package/sdk-test-utilities/node_modules/@types/node/readline.d.ts +540 -0
  176. package/sdk-test-utilities/node_modules/@types/node/repl.d.ts +430 -0
  177. package/sdk-test-utilities/node_modules/@types/node/sea.d.ts +153 -0
  178. package/sdk-test-utilities/node_modules/@types/node/stream/consumers.d.ts +12 -0
  179. package/sdk-test-utilities/node_modules/@types/node/stream/promises.d.ts +83 -0
  180. package/sdk-test-utilities/node_modules/@types/node/stream/web.d.ts +367 -0
  181. package/sdk-test-utilities/node_modules/@types/node/stream.d.ts +1707 -0
  182. package/sdk-test-utilities/node_modules/@types/node/string_decoder.d.ts +67 -0
  183. package/sdk-test-utilities/node_modules/@types/node/test.d.ts +1718 -0
  184. package/sdk-test-utilities/node_modules/@types/node/timers/promises.d.ts +97 -0
  185. package/sdk-test-utilities/node_modules/@types/node/timers.d.ts +240 -0
  186. package/sdk-test-utilities/node_modules/@types/node/tls.d.ts +1217 -0
  187. package/sdk-test-utilities/node_modules/@types/node/trace_events.d.ts +197 -0
  188. package/sdk-test-utilities/node_modules/@types/node/tty.d.ts +208 -0
  189. package/sdk-test-utilities/node_modules/@types/node/url.d.ts +952 -0
  190. package/sdk-test-utilities/node_modules/@types/node/util.d.ts +2292 -0
  191. package/sdk-test-utilities/node_modules/@types/node/v8.d.ts +808 -0
  192. package/sdk-test-utilities/node_modules/@types/node/vm.d.ts +924 -0
  193. package/sdk-test-utilities/node_modules/@types/node/wasi.d.ts +181 -0
  194. package/sdk-test-utilities/node_modules/@types/node/worker_threads.d.ts +691 -0
  195. package/sdk-test-utilities/node_modules/@types/node/zlib.d.ts +530 -0
  196. package/sdk-test-utilities/node_modules/@types/stack-utils/LICENSE +21 -0
  197. package/sdk-test-utilities/node_modules/@types/stack-utils/README.md +78 -0
  198. package/sdk-test-utilities/node_modules/@types/stack-utils/index.d.ts +59 -0
  199. package/sdk-test-utilities/node_modules/@types/stack-utils/package.json +25 -0
  200. package/sdk-test-utilities/node_modules/@types/yargs/LICENSE +21 -0
  201. package/sdk-test-utilities/node_modules/@types/yargs/README.md +15 -0
  202. package/sdk-test-utilities/node_modules/@types/yargs/helpers.d.mts +1 -0
  203. package/sdk-test-utilities/node_modules/@types/yargs/helpers.d.ts +5 -0
  204. package/sdk-test-utilities/node_modules/@types/yargs/index.d.mts +46 -0
  205. package/sdk-test-utilities/node_modules/@types/yargs/index.d.ts +1031 -0
  206. package/sdk-test-utilities/node_modules/@types/yargs/package.json +87 -0
  207. package/sdk-test-utilities/node_modules/@types/yargs/yargs.d.ts +9 -0
  208. package/sdk-test-utilities/node_modules/@types/yargs-parser/LICENSE +21 -0
  209. package/sdk-test-utilities/node_modules/@types/yargs-parser/README.md +15 -0
  210. package/sdk-test-utilities/node_modules/@types/yargs-parser/index.d.ts +112 -0
  211. package/sdk-test-utilities/node_modules/@types/yargs-parser/package.json +25 -0
  212. package/sdk-test-utilities/node_modules/ansi-styles/index.d.ts +345 -0
  213. package/sdk-test-utilities/node_modules/ansi-styles/index.js +163 -0
  214. package/sdk-test-utilities/node_modules/ansi-styles/license +9 -0
  215. package/sdk-test-utilities/node_modules/ansi-styles/package.json +56 -0
  216. package/sdk-test-utilities/node_modules/ansi-styles/readme.md +152 -0
  217. package/sdk-test-utilities/node_modules/braces/LICENSE +21 -0
  218. package/sdk-test-utilities/node_modules/braces/README.md +586 -0
  219. package/sdk-test-utilities/node_modules/braces/index.js +170 -0
  220. package/sdk-test-utilities/node_modules/braces/lib/compile.js +60 -0
  221. package/sdk-test-utilities/node_modules/braces/lib/constants.js +57 -0
  222. package/sdk-test-utilities/node_modules/braces/lib/expand.js +113 -0
  223. package/sdk-test-utilities/node_modules/braces/lib/parse.js +331 -0
  224. package/sdk-test-utilities/node_modules/braces/lib/stringify.js +32 -0
  225. package/sdk-test-utilities/node_modules/braces/lib/utils.js +122 -0
  226. package/sdk-test-utilities/node_modules/braces/package.json +77 -0
  227. package/sdk-test-utilities/node_modules/chalk/index.d.ts +415 -0
  228. package/sdk-test-utilities/node_modules/chalk/license +9 -0
  229. package/sdk-test-utilities/node_modules/chalk/package.json +68 -0
  230. package/sdk-test-utilities/node_modules/chalk/readme.md +341 -0
  231. package/sdk-test-utilities/node_modules/chalk/source/index.js +229 -0
  232. package/sdk-test-utilities/node_modules/chalk/source/templates.js +134 -0
  233. package/sdk-test-utilities/node_modules/chalk/source/util.js +39 -0
  234. package/sdk-test-utilities/node_modules/ci-info/CHANGELOG.md +178 -0
  235. package/sdk-test-utilities/node_modules/ci-info/LICENSE +21 -0
  236. package/sdk-test-utilities/node_modules/ci-info/README.md +135 -0
  237. package/sdk-test-utilities/node_modules/ci-info/index.d.ts +75 -0
  238. package/sdk-test-utilities/node_modules/ci-info/index.js +90 -0
  239. package/sdk-test-utilities/node_modules/ci-info/package.json +45 -0
  240. package/sdk-test-utilities/node_modules/ci-info/vendors.json +321 -0
  241. package/sdk-test-utilities/node_modules/color-convert/CHANGELOG.md +54 -0
  242. package/sdk-test-utilities/node_modules/color-convert/LICENSE +21 -0
  243. package/sdk-test-utilities/node_modules/color-convert/README.md +68 -0
  244. package/sdk-test-utilities/node_modules/color-convert/conversions.js +839 -0
  245. package/sdk-test-utilities/node_modules/color-convert/index.js +81 -0
  246. package/sdk-test-utilities/node_modules/color-convert/package.json +48 -0
  247. package/sdk-test-utilities/node_modules/color-convert/route.js +97 -0
  248. package/sdk-test-utilities/node_modules/color-name/LICENSE +8 -0
  249. package/sdk-test-utilities/node_modules/color-name/README.md +11 -0
  250. package/sdk-test-utilities/node_modules/color-name/index.js +152 -0
  251. package/sdk-test-utilities/node_modules/color-name/package.json +28 -0
  252. package/sdk-test-utilities/node_modules/diff-sequences/LICENSE +21 -0
  253. package/sdk-test-utilities/node_modules/diff-sequences/README.md +404 -0
  254. package/sdk-test-utilities/node_modules/diff-sequences/build/index.d.ts +38 -0
  255. package/sdk-test-utilities/node_modules/diff-sequences/build/index.js +798 -0
  256. package/sdk-test-utilities/node_modules/diff-sequences/package.json +39 -0
  257. package/sdk-test-utilities/node_modules/escape-string-regexp/index.d.ts +18 -0
  258. package/sdk-test-utilities/node_modules/escape-string-regexp/index.js +11 -0
  259. package/sdk-test-utilities/node_modules/escape-string-regexp/license +9 -0
  260. package/sdk-test-utilities/node_modules/escape-string-regexp/package.json +43 -0
  261. package/sdk-test-utilities/node_modules/escape-string-regexp/readme.md +29 -0
  262. package/sdk-test-utilities/node_modules/expect/LICENSE +21 -0
  263. package/sdk-test-utilities/node_modules/expect/README.md +3 -0
  264. package/sdk-test-utilities/node_modules/expect/build/asymmetricMatchers.js +375 -0
  265. package/sdk-test-utilities/node_modules/expect/build/extractExpectedAssertionsErrors.js +86 -0
  266. package/sdk-test-utilities/node_modules/expect/build/index.d.ts +370 -0
  267. package/sdk-test-utilities/node_modules/expect/build/index.js +410 -0
  268. package/sdk-test-utilities/node_modules/expect/build/jestMatchersObject.js +123 -0
  269. package/sdk-test-utilities/node_modules/expect/build/matchers.js +1292 -0
  270. package/sdk-test-utilities/node_modules/expect/build/print.js +122 -0
  271. package/sdk-test-utilities/node_modules/expect/build/spyMatchers.js +1254 -0
  272. package/sdk-test-utilities/node_modules/expect/build/toThrowMatchers.js +481 -0
  273. package/sdk-test-utilities/node_modules/expect/build/types.js +3 -0
  274. package/sdk-test-utilities/node_modules/expect/package.json +43 -0
  275. package/sdk-test-utilities/node_modules/fill-range/LICENSE +21 -0
  276. package/sdk-test-utilities/node_modules/fill-range/README.md +237 -0
  277. package/sdk-test-utilities/node_modules/fill-range/index.js +248 -0
  278. package/sdk-test-utilities/node_modules/fill-range/package.json +74 -0
  279. package/sdk-test-utilities/node_modules/graceful-fs/LICENSE +15 -0
  280. package/sdk-test-utilities/node_modules/graceful-fs/README.md +143 -0
  281. package/sdk-test-utilities/node_modules/graceful-fs/clone.js +23 -0
  282. package/sdk-test-utilities/node_modules/graceful-fs/graceful-fs.js +448 -0
  283. package/sdk-test-utilities/node_modules/graceful-fs/legacy-streams.js +118 -0
  284. package/sdk-test-utilities/node_modules/graceful-fs/package.json +53 -0
  285. package/sdk-test-utilities/node_modules/graceful-fs/polyfills.js +355 -0
  286. package/sdk-test-utilities/node_modules/has-flag/index.d.ts +39 -0
  287. package/sdk-test-utilities/node_modules/has-flag/index.js +8 -0
  288. package/sdk-test-utilities/node_modules/has-flag/license +9 -0
  289. package/sdk-test-utilities/node_modules/has-flag/package.json +46 -0
  290. package/sdk-test-utilities/node_modules/has-flag/readme.md +89 -0
  291. package/sdk-test-utilities/node_modules/is-number/LICENSE +21 -0
  292. package/sdk-test-utilities/node_modules/is-number/README.md +187 -0
  293. package/sdk-test-utilities/node_modules/is-number/index.js +18 -0
  294. package/sdk-test-utilities/node_modules/is-number/package.json +82 -0
  295. package/sdk-test-utilities/node_modules/jest-diff/LICENSE +21 -0
  296. package/sdk-test-utilities/node_modules/jest-diff/README.md +671 -0
  297. package/sdk-test-utilities/node_modules/jest-diff/build/cleanupSemantic.js +599 -0
  298. package/sdk-test-utilities/node_modules/jest-diff/build/constants.js +19 -0
  299. package/sdk-test-utilities/node_modules/jest-diff/build/diffLines.js +193 -0
  300. package/sdk-test-utilities/node_modules/jest-diff/build/diffStrings.js +66 -0
  301. package/sdk-test-utilities/node_modules/jest-diff/build/getAlignedDiffs.js +223 -0
  302. package/sdk-test-utilities/node_modules/jest-diff/build/index.d.ts +93 -0
  303. package/sdk-test-utilities/node_modules/jest-diff/build/index.js +232 -0
  304. package/sdk-test-utilities/node_modules/jest-diff/build/joinAlignedDiffs.js +271 -0
  305. package/sdk-test-utilities/node_modules/jest-diff/build/normalizeDiffOptions.js +59 -0
  306. package/sdk-test-utilities/node_modules/jest-diff/build/printDiffs.js +79 -0
  307. package/sdk-test-utilities/node_modules/jest-diff/build/types.js +1 -0
  308. package/sdk-test-utilities/node_modules/jest-diff/package.json +36 -0
  309. package/sdk-test-utilities/node_modules/jest-get-type/LICENSE +21 -0
  310. package/sdk-test-utilities/node_modules/jest-get-type/build/index.d.ts +27 -0
  311. package/sdk-test-utilities/node_modules/jest-get-type/build/index.js +53 -0
  312. package/sdk-test-utilities/node_modules/jest-get-type/package.json +27 -0
  313. package/sdk-test-utilities/node_modules/jest-matcher-utils/LICENSE +21 -0
  314. package/sdk-test-utilities/node_modules/jest-matcher-utils/README.md +24 -0
  315. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/Replaceable.js +64 -0
  316. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js +111 -0
  317. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/index.d.ts +138 -0
  318. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/index.js +542 -0
  319. package/sdk-test-utilities/node_modules/jest-matcher-utils/package.json +37 -0
  320. package/sdk-test-utilities/node_modules/jest-message-util/LICENSE +21 -0
  321. package/sdk-test-utilities/node_modules/jest-message-util/build/index.d.ts +68 -0
  322. package/sdk-test-utilities/node_modules/jest-message-util/build/index.js +518 -0
  323. package/sdk-test-utilities/node_modules/jest-message-util/build/types.js +1 -0
  324. package/sdk-test-utilities/node_modules/jest-message-util/package.json +43 -0
  325. package/sdk-test-utilities/node_modules/jest-util/LICENSE +21 -0
  326. package/sdk-test-utilities/node_modules/jest-util/Readme.md +87 -0
  327. package/sdk-test-utilities/node_modules/jest-util/build/ErrorWithStack.js +28 -0
  328. package/sdk-test-utilities/node_modules/jest-util/build/clearLine.js +18 -0
  329. package/sdk-test-utilities/node_modules/jest-util/build/convertDescriptorToString.js +30 -0
  330. package/sdk-test-utilities/node_modules/jest-util/build/createDirectory.js +71 -0
  331. package/sdk-test-utilities/node_modules/jest-util/build/createProcessObject.js +109 -0
  332. package/sdk-test-utilities/node_modules/jest-util/build/deepCyclicCopy.js +76 -0
  333. package/sdk-test-utilities/node_modules/jest-util/build/formatTime.js +24 -0
  334. package/sdk-test-utilities/node_modules/jest-util/build/globsToMatcher.js +98 -0
  335. package/sdk-test-utilities/node_modules/jest-util/build/index.d.ts +136 -0
  336. package/sdk-test-utilities/node_modules/jest-util/build/index.js +199 -0
  337. package/sdk-test-utilities/node_modules/jest-util/build/installCommonGlobals.js +115 -0
  338. package/sdk-test-utilities/node_modules/jest-util/build/interopRequireDefault.js +22 -0
  339. package/sdk-test-utilities/node_modules/jest-util/build/invariant.js +18 -0
  340. package/sdk-test-utilities/node_modules/jest-util/build/isInteractive.js +22 -0
  341. package/sdk-test-utilities/node_modules/jest-util/build/isNonNullable.js +16 -0
  342. package/sdk-test-utilities/node_modules/jest-util/build/isPromise.js +20 -0
  343. package/sdk-test-utilities/node_modules/jest-util/build/pluralize.js +16 -0
  344. package/sdk-test-utilities/node_modules/jest-util/build/preRunMessage.js +38 -0
  345. package/sdk-test-utilities/node_modules/jest-util/build/replacePathSepForGlob.js +16 -0
  346. package/sdk-test-utilities/node_modules/jest-util/build/requireOrImportModule.js +77 -0
  347. package/sdk-test-utilities/node_modules/jest-util/build/setGlobal.js +17 -0
  348. package/sdk-test-utilities/node_modules/jest-util/build/specialChars.js +25 -0
  349. package/sdk-test-utilities/node_modules/jest-util/build/testPathPatternToRegExp.js +19 -0
  350. package/sdk-test-utilities/node_modules/jest-util/build/tryRealpath.js +30 -0
  351. package/sdk-test-utilities/node_modules/jest-util/package.json +38 -0
  352. package/sdk-test-utilities/node_modules/js-tokens/CHANGELOG.md +151 -0
  353. package/sdk-test-utilities/node_modules/js-tokens/LICENSE +21 -0
  354. package/sdk-test-utilities/node_modules/js-tokens/README.md +240 -0
  355. package/sdk-test-utilities/node_modules/js-tokens/index.js +23 -0
  356. package/sdk-test-utilities/node_modules/js-tokens/package.json +30 -0
  357. package/sdk-test-utilities/node_modules/micromatch/LICENSE +21 -0
  358. package/sdk-test-utilities/node_modules/micromatch/README.md +1017 -0
  359. package/sdk-test-utilities/node_modules/micromatch/index.js +467 -0
  360. package/sdk-test-utilities/node_modules/micromatch/package.json +101 -0
  361. package/sdk-test-utilities/node_modules/picocolors/LICENSE +15 -0
  362. package/sdk-test-utilities/node_modules/picocolors/README.md +21 -0
  363. package/sdk-test-utilities/node_modules/picocolors/package.json +25 -0
  364. package/sdk-test-utilities/node_modules/picocolors/picocolors.browser.js +4 -0
  365. package/sdk-test-utilities/node_modules/picocolors/picocolors.d.ts +5 -0
  366. package/sdk-test-utilities/node_modules/picocolors/picocolors.js +65 -0
  367. package/sdk-test-utilities/node_modules/picomatch/CHANGELOG.md +136 -0
  368. package/sdk-test-utilities/node_modules/picomatch/LICENSE +21 -0
  369. package/sdk-test-utilities/node_modules/picomatch/README.md +708 -0
  370. package/sdk-test-utilities/node_modules/picomatch/index.js +3 -0
  371. package/sdk-test-utilities/node_modules/picomatch/lib/constants.js +179 -0
  372. package/sdk-test-utilities/node_modules/picomatch/lib/parse.js +1091 -0
  373. package/sdk-test-utilities/node_modules/picomatch/lib/picomatch.js +342 -0
  374. package/sdk-test-utilities/node_modules/picomatch/lib/scan.js +391 -0
  375. package/sdk-test-utilities/node_modules/picomatch/lib/utils.js +64 -0
  376. package/sdk-test-utilities/node_modules/picomatch/package.json +81 -0
  377. package/sdk-test-utilities/node_modules/pretty-format/LICENSE +21 -0
  378. package/sdk-test-utilities/node_modules/pretty-format/README.md +463 -0
  379. package/sdk-test-utilities/node_modules/pretty-format/build/collections.js +180 -0
  380. package/sdk-test-utilities/node_modules/pretty-format/build/index.d.ts +163 -0
  381. package/sdk-test-utilities/node_modules/pretty-format/build/index.js +478 -0
  382. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js +89 -0
  383. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/DOMCollection.js +67 -0
  384. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/DOMElement.js +101 -0
  385. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/Immutable.js +217 -0
  386. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/ReactElement.js +143 -0
  387. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/ReactTestComponent.js +66 -0
  388. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/lib/escapeHTML.js +16 -0
  389. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/lib/markup.js +113 -0
  390. package/sdk-test-utilities/node_modules/pretty-format/build/types.js +1 -0
  391. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/index.d.ts +167 -0
  392. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/index.js +164 -0
  393. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/license +9 -0
  394. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/package.json +52 -0
  395. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/readme.md +144 -0
  396. package/sdk-test-utilities/node_modules/pretty-format/package.json +43 -0
  397. package/sdk-test-utilities/node_modules/react-is/LICENSE +21 -0
  398. package/sdk-test-utilities/node_modules/react-is/README.md +104 -0
  399. package/sdk-test-utilities/node_modules/react-is/cjs/react-is.development.js +221 -0
  400. package/sdk-test-utilities/node_modules/react-is/cjs/react-is.production.min.js +14 -0
  401. package/sdk-test-utilities/node_modules/react-is/index.js +7 -0
  402. package/sdk-test-utilities/node_modules/react-is/package.json +26 -0
  403. package/sdk-test-utilities/node_modules/react-is/umd/react-is.development.js +220 -0
  404. package/sdk-test-utilities/node_modules/react-is/umd/react-is.production.min.js +15 -0
  405. package/sdk-test-utilities/node_modules/slash/index.d.ts +25 -0
  406. package/sdk-test-utilities/node_modules/slash/index.js +11 -0
  407. package/sdk-test-utilities/node_modules/slash/license +9 -0
  408. package/sdk-test-utilities/node_modules/slash/package.json +35 -0
  409. package/sdk-test-utilities/node_modules/slash/readme.md +44 -0
  410. package/sdk-test-utilities/node_modules/stack-utils/LICENSE.md +21 -0
  411. package/sdk-test-utilities/node_modules/stack-utils/index.js +344 -0
  412. package/sdk-test-utilities/node_modules/stack-utils/package.json +39 -0
  413. package/sdk-test-utilities/node_modules/stack-utils/readme.md +143 -0
  414. package/sdk-test-utilities/node_modules/supports-color/browser.js +5 -0
  415. package/sdk-test-utilities/node_modules/supports-color/index.js +135 -0
  416. package/sdk-test-utilities/node_modules/supports-color/license +9 -0
  417. package/sdk-test-utilities/node_modules/supports-color/package.json +53 -0
  418. package/sdk-test-utilities/node_modules/supports-color/readme.md +76 -0
  419. package/sdk-test-utilities/node_modules/to-regex-range/LICENSE +21 -0
  420. package/sdk-test-utilities/node_modules/to-regex-range/README.md +305 -0
  421. package/sdk-test-utilities/node_modules/to-regex-range/index.js +288 -0
  422. package/sdk-test-utilities/node_modules/to-regex-range/package.json +88 -0
  423. package/sdk-test-utilities/node_modules/undici-types/README.md +6 -0
  424. package/sdk-test-utilities/node_modules/undici-types/agent.d.ts +31 -0
  425. package/sdk-test-utilities/node_modules/undici-types/api.d.ts +43 -0
  426. package/sdk-test-utilities/node_modules/undici-types/balanced-pool.d.ts +18 -0
  427. package/sdk-test-utilities/node_modules/undici-types/cache.d.ts +36 -0
  428. package/sdk-test-utilities/node_modules/undici-types/client.d.ts +97 -0
  429. package/sdk-test-utilities/node_modules/undici-types/connector.d.ts +34 -0
  430. package/sdk-test-utilities/node_modules/undici-types/content-type.d.ts +21 -0
  431. package/sdk-test-utilities/node_modules/undici-types/cookies.d.ts +28 -0
  432. package/sdk-test-utilities/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  433. package/sdk-test-utilities/node_modules/undici-types/dispatcher.d.ts +241 -0
  434. package/sdk-test-utilities/node_modules/undici-types/errors.d.ts +128 -0
  435. package/sdk-test-utilities/node_modules/undici-types/fetch.d.ts +209 -0
  436. package/sdk-test-utilities/node_modules/undici-types/file.d.ts +39 -0
  437. package/sdk-test-utilities/node_modules/undici-types/filereader.d.ts +54 -0
  438. package/sdk-test-utilities/node_modules/undici-types/formdata.d.ts +108 -0
  439. package/sdk-test-utilities/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  440. package/sdk-test-utilities/node_modules/undici-types/global-origin.d.ts +7 -0
  441. package/sdk-test-utilities/node_modules/undici-types/handlers.d.ts +9 -0
  442. package/sdk-test-utilities/node_modules/undici-types/header.d.ts +4 -0
  443. package/sdk-test-utilities/node_modules/undici-types/index.d.ts +63 -0
  444. package/sdk-test-utilities/node_modules/undici-types/interceptors.d.ts +5 -0
  445. package/sdk-test-utilities/node_modules/undici-types/mock-agent.d.ts +50 -0
  446. package/sdk-test-utilities/node_modules/undici-types/mock-client.d.ts +25 -0
  447. package/sdk-test-utilities/node_modules/undici-types/mock-errors.d.ts +12 -0
  448. package/sdk-test-utilities/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  449. package/sdk-test-utilities/node_modules/undici-types/mock-pool.d.ts +25 -0
  450. package/sdk-test-utilities/node_modules/undici-types/package.json +55 -0
  451. package/sdk-test-utilities/node_modules/undici-types/patch.d.ts +71 -0
  452. package/sdk-test-utilities/node_modules/undici-types/pool-stats.d.ts +19 -0
  453. package/sdk-test-utilities/node_modules/undici-types/pool.d.ts +28 -0
  454. package/sdk-test-utilities/node_modules/undici-types/proxy-agent.d.ts +30 -0
  455. package/sdk-test-utilities/node_modules/undici-types/readable.d.ts +61 -0
  456. package/sdk-test-utilities/node_modules/undici-types/webidl.d.ts +220 -0
  457. package/sdk-test-utilities/node_modules/undici-types/websocket.d.ts +131 -0
@@ -0,0 +1,1254 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _expectUtils = require('@jest/expect-utils');
8
+ var _jestGetType = require('jest-get-type');
9
+ var _jestMatcherUtils = require('jest-matcher-utils');
10
+ var _jestMatchersObject = require('./jestMatchersObject');
11
+ /**
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+
18
+ // The optional property of matcher context is true if undefined.
19
+ const isExpand = expand => expand !== false;
20
+ const PRINT_LIMIT = 3;
21
+ const NO_ARGUMENTS = 'called with 0 arguments';
22
+ const printExpectedArgs = expected =>
23
+ expected.length === 0
24
+ ? NO_ARGUMENTS
25
+ : expected.map(arg => (0, _jestMatcherUtils.printExpected)(arg)).join(', ');
26
+ const printReceivedArgs = (received, expected) =>
27
+ received.length === 0
28
+ ? NO_ARGUMENTS
29
+ : received
30
+ .map((arg, i) =>
31
+ Array.isArray(expected) &&
32
+ i < expected.length &&
33
+ isEqualValue(expected[i], arg)
34
+ ? printCommon(arg)
35
+ : (0, _jestMatcherUtils.printReceived)(arg)
36
+ )
37
+ .join(', ');
38
+ const printCommon = val =>
39
+ (0, _jestMatcherUtils.DIM_COLOR)((0, _jestMatcherUtils.stringify)(val));
40
+ const isEqualValue = (expected, received) =>
41
+ (0, _expectUtils.equals)(expected, received, [
42
+ ...(0, _jestMatchersObject.getCustomEqualityTesters)(),
43
+ _expectUtils.iterableEquality
44
+ ]);
45
+ const isEqualCall = (expected, received) =>
46
+ received.length === expected.length && isEqualValue(expected, received);
47
+ const isEqualReturn = (expected, result) =>
48
+ result.type === 'return' && isEqualValue(expected, result.value);
49
+ const countReturns = results =>
50
+ results.reduce((n, result) => (result.type === 'return' ? n + 1 : n), 0);
51
+ const printNumberOfReturns = (countReturns, countCalls) =>
52
+ `\nNumber of returns: ${(0, _jestMatcherUtils.printReceived)(countReturns)}${
53
+ countCalls !== countReturns
54
+ ? `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(
55
+ countCalls
56
+ )}`
57
+ : ''
58
+ }`;
59
+ // Given a label, return a function which given a string,
60
+ // right-aligns it preceding the colon in the label.
61
+ const getRightAlignedPrinter = label => {
62
+ // Assume that the label contains a colon.
63
+ const index = label.indexOf(':');
64
+ const suffix = label.slice(index);
65
+ return (string, isExpectedCall) =>
66
+ (isExpectedCall
67
+ ? `->${' '.repeat(Math.max(0, index - 2 - string.length))}`
68
+ : ' '.repeat(Math.max(index - string.length))) +
69
+ string +
70
+ suffix;
71
+ };
72
+ const printReceivedCallsNegative = (
73
+ expected,
74
+ indexedCalls,
75
+ isOnlyCall,
76
+ iExpectedCall
77
+ ) => {
78
+ if (indexedCalls.length === 0) {
79
+ return '';
80
+ }
81
+ const label = 'Received: ';
82
+ if (isOnlyCall) {
83
+ return `${label + printReceivedArgs(indexedCalls[0], expected)}\n`;
84
+ }
85
+ const printAligned = getRightAlignedPrinter(label);
86
+ return `Received\n${indexedCalls.reduce(
87
+ (printed, [i, args]) =>
88
+ `${
89
+ printed +
90
+ printAligned(String(i + 1), i === iExpectedCall) +
91
+ printReceivedArgs(args, expected)
92
+ }\n`,
93
+ ''
94
+ )}`;
95
+ };
96
+ const printExpectedReceivedCallsPositive = (
97
+ expected,
98
+ indexedCalls,
99
+ expand,
100
+ isOnlyCall,
101
+ iExpectedCall
102
+ ) => {
103
+ const expectedLine = `Expected: ${printExpectedArgs(expected)}\n`;
104
+ if (indexedCalls.length === 0) {
105
+ return expectedLine;
106
+ }
107
+ const label = 'Received: ';
108
+ if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) {
109
+ const received = indexedCalls[0][1];
110
+ if (isLineDiffableCall(expected, received)) {
111
+ // Display diff without indentation.
112
+ const lines = [
113
+ (0, _jestMatcherUtils.EXPECTED_COLOR)('- Expected'),
114
+ (0, _jestMatcherUtils.RECEIVED_COLOR)('+ Received'),
115
+ ''
116
+ ];
117
+ const length = Math.max(expected.length, received.length);
118
+ for (let i = 0; i < length; i += 1) {
119
+ if (i < expected.length && i < received.length) {
120
+ if (isEqualValue(expected[i], received[i])) {
121
+ lines.push(` ${printCommon(received[i])},`);
122
+ continue;
123
+ }
124
+ if (isLineDiffableArg(expected[i], received[i])) {
125
+ const difference = (0, _jestMatcherUtils.diff)(
126
+ expected[i],
127
+ received[i],
128
+ {
129
+ expand
130
+ }
131
+ );
132
+ if (
133
+ typeof difference === 'string' &&
134
+ difference.includes('- Expected') &&
135
+ difference.includes('+ Received')
136
+ ) {
137
+ // Omit annotation in case multiple args have diff.
138
+ lines.push(`${difference.split('\n').slice(3).join('\n')},`);
139
+ continue;
140
+ }
141
+ }
142
+ }
143
+ if (i < expected.length) {
144
+ lines.push(
145
+ `${(0, _jestMatcherUtils.EXPECTED_COLOR)(
146
+ `- ${(0, _jestMatcherUtils.stringify)(expected[i])}`
147
+ )},`
148
+ );
149
+ }
150
+ if (i < received.length) {
151
+ lines.push(
152
+ `${(0, _jestMatcherUtils.RECEIVED_COLOR)(
153
+ `+ ${(0, _jestMatcherUtils.stringify)(received[i])}`
154
+ )},`
155
+ );
156
+ }
157
+ }
158
+ return `${lines.join('\n')}\n`;
159
+ }
160
+ return `${expectedLine + label + printReceivedArgs(received, expected)}\n`;
161
+ }
162
+ const printAligned = getRightAlignedPrinter(label);
163
+ return (
164
+ // eslint-disable-next-line prefer-template
165
+ expectedLine +
166
+ 'Received\n' +
167
+ indexedCalls.reduce((printed, [i, received]) => {
168
+ const aligned = printAligned(String(i + 1), i === iExpectedCall);
169
+ return `${
170
+ printed +
171
+ ((i === iExpectedCall || iExpectedCall === undefined) &&
172
+ isLineDiffableCall(expected, received)
173
+ ? aligned.replace(': ', '\n') +
174
+ printDiffCall(expected, received, expand)
175
+ : aligned + printReceivedArgs(received, expected))
176
+ }\n`;
177
+ }, '')
178
+ );
179
+ };
180
+ const indentation = 'Received'.replace(/\w/g, ' ');
181
+ const printDiffCall = (expected, received, expand) =>
182
+ received
183
+ .map((arg, i) => {
184
+ if (i < expected.length) {
185
+ if (isEqualValue(expected[i], arg)) {
186
+ return `${indentation} ${printCommon(arg)},`;
187
+ }
188
+ if (isLineDiffableArg(expected[i], arg)) {
189
+ const difference = (0, _jestMatcherUtils.diff)(expected[i], arg, {
190
+ expand
191
+ });
192
+ if (
193
+ typeof difference === 'string' &&
194
+ difference.includes('- Expected') &&
195
+ difference.includes('+ Received')
196
+ ) {
197
+ // Display diff with indentation.
198
+ // Omit annotation in case multiple args have diff.
199
+ return `${difference
200
+ .split('\n')
201
+ .slice(3)
202
+ .map(line => indentation + line)
203
+ .join('\n')},`;
204
+ }
205
+ }
206
+ }
207
+
208
+ // Display + only if received arg has no corresponding expected arg.
209
+ return `${
210
+ indentation +
211
+ (i < expected.length
212
+ ? ` ${(0, _jestMatcherUtils.printReceived)(arg)}`
213
+ : (0, _jestMatcherUtils.RECEIVED_COLOR)(
214
+ `+ ${(0, _jestMatcherUtils.stringify)(arg)}`
215
+ ))
216
+ },`;
217
+ })
218
+ .join('\n');
219
+ const isLineDiffableCall = (expected, received) =>
220
+ expected.some(
221
+ (arg, i) => i < received.length && isLineDiffableArg(arg, received[i])
222
+ );
223
+
224
+ // Almost redundant with function in jest-matcher-utils,
225
+ // except no line diff for any strings.
226
+ const isLineDiffableArg = (expected, received) => {
227
+ const expectedType = (0, _jestGetType.getType)(expected);
228
+ const receivedType = (0, _jestGetType.getType)(received);
229
+ if (expectedType !== receivedType) {
230
+ return false;
231
+ }
232
+ if ((0, _jestGetType.isPrimitive)(expected)) {
233
+ return false;
234
+ }
235
+ if (
236
+ expectedType === 'date' ||
237
+ expectedType === 'function' ||
238
+ expectedType === 'regexp'
239
+ ) {
240
+ return false;
241
+ }
242
+ if (expected instanceof Error && received instanceof Error) {
243
+ return false;
244
+ }
245
+ if (
246
+ expectedType === 'object' &&
247
+ typeof expected.asymmetricMatch === 'function'
248
+ ) {
249
+ return false;
250
+ }
251
+ if (
252
+ receivedType === 'object' &&
253
+ typeof received.asymmetricMatch === 'function'
254
+ ) {
255
+ return false;
256
+ }
257
+ return true;
258
+ };
259
+ const printResult = (result, expected) =>
260
+ result.type === 'throw'
261
+ ? 'function call threw an error'
262
+ : result.type === 'incomplete'
263
+ ? 'function call has not returned yet'
264
+ : isEqualValue(expected, result.value)
265
+ ? printCommon(result.value)
266
+ : (0, _jestMatcherUtils.printReceived)(result.value);
267
+ // Return either empty string or one line per indexed result,
268
+ // so additional empty line can separate from `Number of returns` which follows.
269
+ const printReceivedResults = (
270
+ label,
271
+ expected,
272
+ indexedResults,
273
+ isOnlyCall,
274
+ iExpectedCall
275
+ ) => {
276
+ if (indexedResults.length === 0) {
277
+ return '';
278
+ }
279
+ if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) {
280
+ return `${label + printResult(indexedResults[0][1], expected)}\n`;
281
+ }
282
+ const printAligned = getRightAlignedPrinter(label);
283
+ return (
284
+ // eslint-disable-next-line prefer-template
285
+ label.replace(':', '').trim() +
286
+ '\n' +
287
+ indexedResults.reduce(
288
+ (printed, [i, result]) =>
289
+ `${
290
+ printed +
291
+ printAligned(String(i + 1), i === iExpectedCall) +
292
+ printResult(result, expected)
293
+ }\n`,
294
+ ''
295
+ )
296
+ );
297
+ };
298
+ const createToBeCalledMatcher = matcherName =>
299
+ function (received, expected) {
300
+ const expectedArgument = '';
301
+ const options = {
302
+ isNot: this.isNot,
303
+ promise: this.promise
304
+ };
305
+ (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
306
+ ensureMockOrSpy(received, matcherName, expectedArgument, options);
307
+ const receivedIsSpy = isSpy(received);
308
+ const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
309
+ const count = receivedIsSpy
310
+ ? received.calls.count()
311
+ : received.mock.calls.length;
312
+ const calls = receivedIsSpy
313
+ ? received.calls.all().map(x => x.args)
314
+ : received.mock.calls;
315
+ const pass = count > 0;
316
+ const message = pass
317
+ ? () =>
318
+ // eslint-disable-next-line prefer-template
319
+ (0, _jestMatcherUtils.matcherHint)(
320
+ matcherName,
321
+ receivedName,
322
+ expectedArgument,
323
+ options
324
+ ) +
325
+ '\n\n' +
326
+ `Expected number of calls: ${(0, _jestMatcherUtils.printExpected)(
327
+ 0
328
+ )}\n` +
329
+ `Received number of calls: ${(0, _jestMatcherUtils.printReceived)(
330
+ count
331
+ )}\n\n` +
332
+ calls
333
+ .reduce((lines, args, i) => {
334
+ if (lines.length < PRINT_LIMIT) {
335
+ lines.push(`${i + 1}: ${printReceivedArgs(args)}`);
336
+ }
337
+ return lines;
338
+ }, [])
339
+ .join('\n')
340
+ : () =>
341
+ // eslint-disable-next-line prefer-template
342
+ (0, _jestMatcherUtils.matcherHint)(
343
+ matcherName,
344
+ receivedName,
345
+ expectedArgument,
346
+ options
347
+ ) +
348
+ '\n\n' +
349
+ `Expected number of calls: >= ${(0, _jestMatcherUtils.printExpected)(
350
+ 1
351
+ )}\n` +
352
+ `Received number of calls: ${(0, _jestMatcherUtils.printReceived)(
353
+ count
354
+ )}`;
355
+ return {
356
+ message,
357
+ pass
358
+ };
359
+ };
360
+ const createToReturnMatcher = matcherName =>
361
+ function (received, expected) {
362
+ const expectedArgument = '';
363
+ const options = {
364
+ isNot: this.isNot,
365
+ promise: this.promise
366
+ };
367
+ (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
368
+ ensureMock(received, matcherName, expectedArgument, options);
369
+ const receivedName = received.getMockName();
370
+
371
+ // Count return values that correspond only to calls that returned
372
+ const count = received.mock.results.reduce(
373
+ (n, result) => (result.type === 'return' ? n + 1 : n),
374
+ 0
375
+ );
376
+ const pass = count > 0;
377
+ const message = pass
378
+ ? () =>
379
+ // eslint-disable-next-line prefer-template
380
+ (0, _jestMatcherUtils.matcherHint)(
381
+ matcherName,
382
+ receivedName,
383
+ expectedArgument,
384
+ options
385
+ ) +
386
+ '\n\n' +
387
+ `Expected number of returns: ${(0, _jestMatcherUtils.printExpected)(
388
+ 0
389
+ )}\n` +
390
+ `Received number of returns: ${(0, _jestMatcherUtils.printReceived)(
391
+ count
392
+ )}\n\n` +
393
+ received.mock.results
394
+ .reduce((lines, result, i) => {
395
+ if (result.type === 'return' && lines.length < PRINT_LIMIT) {
396
+ lines.push(
397
+ `${i + 1}: ${(0, _jestMatcherUtils.printReceived)(
398
+ result.value
399
+ )}`
400
+ );
401
+ }
402
+ return lines;
403
+ }, [])
404
+ .join('\n') +
405
+ (received.mock.calls.length !== count
406
+ ? `\n\nReceived number of calls: ${(0,
407
+ _jestMatcherUtils.printReceived)(received.mock.calls.length)}`
408
+ : '')
409
+ : () =>
410
+ // eslint-disable-next-line prefer-template
411
+ (0, _jestMatcherUtils.matcherHint)(
412
+ matcherName,
413
+ receivedName,
414
+ expectedArgument,
415
+ options
416
+ ) +
417
+ '\n\n' +
418
+ `Expected number of returns: >= ${(0,
419
+ _jestMatcherUtils.printExpected)(1)}\n` +
420
+ `Received number of returns: ${(0,
421
+ _jestMatcherUtils.printReceived)(count)}` +
422
+ (received.mock.calls.length !== count
423
+ ? `\nReceived number of calls: ${(0,
424
+ _jestMatcherUtils.printReceived)(received.mock.calls.length)}`
425
+ : '');
426
+ return {
427
+ message,
428
+ pass
429
+ };
430
+ };
431
+ const createToBeCalledTimesMatcher = matcherName =>
432
+ function (received, expected) {
433
+ const expectedArgument = 'expected';
434
+ const options = {
435
+ isNot: this.isNot,
436
+ promise: this.promise
437
+ };
438
+ (0, _jestMatcherUtils.ensureExpectedIsNonNegativeInteger)(
439
+ expected,
440
+ matcherName,
441
+ options
442
+ );
443
+ ensureMockOrSpy(received, matcherName, expectedArgument, options);
444
+ const receivedIsSpy = isSpy(received);
445
+ const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
446
+ const count = receivedIsSpy
447
+ ? received.calls.count()
448
+ : received.mock.calls.length;
449
+ const pass = count === expected;
450
+ const message = pass
451
+ ? () =>
452
+ // eslint-disable-next-line prefer-template
453
+ (0, _jestMatcherUtils.matcherHint)(
454
+ matcherName,
455
+ receivedName,
456
+ expectedArgument,
457
+ options
458
+ ) +
459
+ '\n\n' +
460
+ `Expected number of calls: not ${(0, _jestMatcherUtils.printExpected)(
461
+ expected
462
+ )}`
463
+ : () =>
464
+ // eslint-disable-next-line prefer-template
465
+ (0, _jestMatcherUtils.matcherHint)(
466
+ matcherName,
467
+ receivedName,
468
+ expectedArgument,
469
+ options
470
+ ) +
471
+ '\n\n' +
472
+ `Expected number of calls: ${(0, _jestMatcherUtils.printExpected)(
473
+ expected
474
+ )}\n` +
475
+ `Received number of calls: ${(0, _jestMatcherUtils.printReceived)(
476
+ count
477
+ )}`;
478
+ return {
479
+ message,
480
+ pass
481
+ };
482
+ };
483
+ const createToReturnTimesMatcher = matcherName =>
484
+ function (received, expected) {
485
+ const expectedArgument = 'expected';
486
+ const options = {
487
+ isNot: this.isNot,
488
+ promise: this.promise
489
+ };
490
+ (0, _jestMatcherUtils.ensureExpectedIsNonNegativeInteger)(
491
+ expected,
492
+ matcherName,
493
+ options
494
+ );
495
+ ensureMock(received, matcherName, expectedArgument, options);
496
+ const receivedName = received.getMockName();
497
+
498
+ // Count return values that correspond only to calls that returned
499
+ const count = received.mock.results.reduce(
500
+ (n, result) => (result.type === 'return' ? n + 1 : n),
501
+ 0
502
+ );
503
+ const pass = count === expected;
504
+ const message = pass
505
+ ? () =>
506
+ // eslint-disable-next-line prefer-template
507
+ (0, _jestMatcherUtils.matcherHint)(
508
+ matcherName,
509
+ receivedName,
510
+ expectedArgument,
511
+ options
512
+ ) +
513
+ '\n\n' +
514
+ `Expected number of returns: not ${(0,
515
+ _jestMatcherUtils.printExpected)(expected)}` +
516
+ (received.mock.calls.length !== count
517
+ ? `\n\nReceived number of calls: ${(0,
518
+ _jestMatcherUtils.printReceived)(received.mock.calls.length)}`
519
+ : '')
520
+ : () =>
521
+ // eslint-disable-next-line prefer-template
522
+ (0, _jestMatcherUtils.matcherHint)(
523
+ matcherName,
524
+ receivedName,
525
+ expectedArgument,
526
+ options
527
+ ) +
528
+ '\n\n' +
529
+ `Expected number of returns: ${(0, _jestMatcherUtils.printExpected)(
530
+ expected
531
+ )}\n` +
532
+ `Received number of returns: ${(0, _jestMatcherUtils.printReceived)(
533
+ count
534
+ )}` +
535
+ (received.mock.calls.length !== count
536
+ ? `\nReceived number of calls: ${(0,
537
+ _jestMatcherUtils.printReceived)(received.mock.calls.length)}`
538
+ : '');
539
+ return {
540
+ message,
541
+ pass
542
+ };
543
+ };
544
+ const createToBeCalledWithMatcher = matcherName =>
545
+ function (received, ...expected) {
546
+ const expectedArgument = '...expected';
547
+ const options = {
548
+ isNot: this.isNot,
549
+ promise: this.promise
550
+ };
551
+ ensureMockOrSpy(received, matcherName, expectedArgument, options);
552
+ const receivedIsSpy = isSpy(received);
553
+ const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
554
+ const calls = receivedIsSpy
555
+ ? received.calls.all().map(x => x.args)
556
+ : received.mock.calls;
557
+ const pass = calls.some(call => isEqualCall(expected, call));
558
+ const message = pass
559
+ ? () => {
560
+ // Some examples of calls that are equal to expected value.
561
+ const indexedCalls = [];
562
+ let i = 0;
563
+ while (i < calls.length && indexedCalls.length < PRINT_LIMIT) {
564
+ if (isEqualCall(expected, calls[i])) {
565
+ indexedCalls.push([i, calls[i]]);
566
+ }
567
+ i += 1;
568
+ }
569
+ return (
570
+ // eslint-disable-next-line prefer-template
571
+ (0, _jestMatcherUtils.matcherHint)(
572
+ matcherName,
573
+ receivedName,
574
+ expectedArgument,
575
+ options
576
+ ) +
577
+ '\n\n' +
578
+ `Expected: not ${printExpectedArgs(expected)}\n` +
579
+ (calls.length === 1 &&
580
+ (0, _jestMatcherUtils.stringify)(calls[0]) ===
581
+ (0, _jestMatcherUtils.stringify)(expected)
582
+ ? ''
583
+ : printReceivedCallsNegative(
584
+ expected,
585
+ indexedCalls,
586
+ calls.length === 1
587
+ )) +
588
+ `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(
589
+ calls.length
590
+ )}`
591
+ );
592
+ }
593
+ : () => {
594
+ // Some examples of calls that are not equal to expected value.
595
+ const indexedCalls = [];
596
+ let i = 0;
597
+ while (i < calls.length && indexedCalls.length < PRINT_LIMIT) {
598
+ indexedCalls.push([i, calls[i]]);
599
+ i += 1;
600
+ }
601
+ return (
602
+ // eslint-disable-next-line prefer-template
603
+ (0, _jestMatcherUtils.matcherHint)(
604
+ matcherName,
605
+ receivedName,
606
+ expectedArgument,
607
+ options
608
+ ) +
609
+ '\n\n' +
610
+ printExpectedReceivedCallsPositive(
611
+ expected,
612
+ indexedCalls,
613
+ isExpand(this.expand),
614
+ calls.length === 1
615
+ ) +
616
+ `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(
617
+ calls.length
618
+ )}`
619
+ );
620
+ };
621
+ return {
622
+ message,
623
+ pass
624
+ };
625
+ };
626
+ const createToReturnWithMatcher = matcherName =>
627
+ function (received, expected) {
628
+ const expectedArgument = 'expected';
629
+ const options = {
630
+ isNot: this.isNot,
631
+ promise: this.promise
632
+ };
633
+ ensureMock(received, matcherName, expectedArgument, options);
634
+ const receivedName = received.getMockName();
635
+ const {calls, results} = received.mock;
636
+ const pass = results.some(result => isEqualReturn(expected, result));
637
+ const message = pass
638
+ ? () => {
639
+ // Some examples of results that are equal to expected value.
640
+ const indexedResults = [];
641
+ let i = 0;
642
+ while (i < results.length && indexedResults.length < PRINT_LIMIT) {
643
+ if (isEqualReturn(expected, results[i])) {
644
+ indexedResults.push([i, results[i]]);
645
+ }
646
+ i += 1;
647
+ }
648
+ return (
649
+ // eslint-disable-next-line prefer-template
650
+ (0, _jestMatcherUtils.matcherHint)(
651
+ matcherName,
652
+ receivedName,
653
+ expectedArgument,
654
+ options
655
+ ) +
656
+ '\n\n' +
657
+ `Expected: not ${(0, _jestMatcherUtils.printExpected)(
658
+ expected
659
+ )}\n` +
660
+ (results.length === 1 &&
661
+ results[0].type === 'return' &&
662
+ (0, _jestMatcherUtils.stringify)(results[0].value) ===
663
+ (0, _jestMatcherUtils.stringify)(expected)
664
+ ? ''
665
+ : printReceivedResults(
666
+ 'Received: ',
667
+ expected,
668
+ indexedResults,
669
+ results.length === 1
670
+ )) +
671
+ printNumberOfReturns(countReturns(results), calls.length)
672
+ );
673
+ }
674
+ : () => {
675
+ // Some examples of results that are not equal to expected value.
676
+ const indexedResults = [];
677
+ let i = 0;
678
+ while (i < results.length && indexedResults.length < PRINT_LIMIT) {
679
+ indexedResults.push([i, results[i]]);
680
+ i += 1;
681
+ }
682
+ return (
683
+ // eslint-disable-next-line prefer-template
684
+ (0, _jestMatcherUtils.matcherHint)(
685
+ matcherName,
686
+ receivedName,
687
+ expectedArgument,
688
+ options
689
+ ) +
690
+ '\n\n' +
691
+ `Expected: ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
692
+ printReceivedResults(
693
+ 'Received: ',
694
+ expected,
695
+ indexedResults,
696
+ results.length === 1
697
+ ) +
698
+ printNumberOfReturns(countReturns(results), calls.length)
699
+ );
700
+ };
701
+ return {
702
+ message,
703
+ pass
704
+ };
705
+ };
706
+ const createLastCalledWithMatcher = matcherName =>
707
+ function (received, ...expected) {
708
+ const expectedArgument = '...expected';
709
+ const options = {
710
+ isNot: this.isNot,
711
+ promise: this.promise
712
+ };
713
+ ensureMockOrSpy(received, matcherName, expectedArgument, options);
714
+ const receivedIsSpy = isSpy(received);
715
+ const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
716
+ const calls = receivedIsSpy
717
+ ? received.calls.all().map(x => x.args)
718
+ : received.mock.calls;
719
+ const iLast = calls.length - 1;
720
+ const pass = iLast >= 0 && isEqualCall(expected, calls[iLast]);
721
+ const message = pass
722
+ ? () => {
723
+ const indexedCalls = [];
724
+ if (iLast > 0) {
725
+ // Display preceding call as context.
726
+ indexedCalls.push([iLast - 1, calls[iLast - 1]]);
727
+ }
728
+ indexedCalls.push([iLast, calls[iLast]]);
729
+ return (
730
+ // eslint-disable-next-line prefer-template
731
+ (0, _jestMatcherUtils.matcherHint)(
732
+ matcherName,
733
+ receivedName,
734
+ expectedArgument,
735
+ options
736
+ ) +
737
+ '\n\n' +
738
+ `Expected: not ${printExpectedArgs(expected)}\n` +
739
+ (calls.length === 1 &&
740
+ (0, _jestMatcherUtils.stringify)(calls[0]) ===
741
+ (0, _jestMatcherUtils.stringify)(expected)
742
+ ? ''
743
+ : printReceivedCallsNegative(
744
+ expected,
745
+ indexedCalls,
746
+ calls.length === 1,
747
+ iLast
748
+ )) +
749
+ `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(
750
+ calls.length
751
+ )}`
752
+ );
753
+ }
754
+ : () => {
755
+ const indexedCalls = [];
756
+ if (iLast >= 0) {
757
+ if (iLast > 0) {
758
+ let i = iLast - 1;
759
+ // Is there a preceding call that is equal to expected args?
760
+ while (i >= 0 && !isEqualCall(expected, calls[i])) {
761
+ i -= 1;
762
+ }
763
+ if (i < 0) {
764
+ i = iLast - 1; // otherwise, preceding call
765
+ }
766
+
767
+ indexedCalls.push([i, calls[i]]);
768
+ }
769
+ indexedCalls.push([iLast, calls[iLast]]);
770
+ }
771
+ return (
772
+ // eslint-disable-next-line prefer-template
773
+ (0, _jestMatcherUtils.matcherHint)(
774
+ matcherName,
775
+ receivedName,
776
+ expectedArgument,
777
+ options
778
+ ) +
779
+ '\n\n' +
780
+ printExpectedReceivedCallsPositive(
781
+ expected,
782
+ indexedCalls,
783
+ isExpand(this.expand),
784
+ calls.length === 1,
785
+ iLast
786
+ ) +
787
+ `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(
788
+ calls.length
789
+ )}`
790
+ );
791
+ };
792
+ return {
793
+ message,
794
+ pass
795
+ };
796
+ };
797
+ const createLastReturnedMatcher = matcherName =>
798
+ function (received, expected) {
799
+ const expectedArgument = 'expected';
800
+ const options = {
801
+ isNot: this.isNot,
802
+ promise: this.promise
803
+ };
804
+ ensureMock(received, matcherName, expectedArgument, options);
805
+ const receivedName = received.getMockName();
806
+ const {calls, results} = received.mock;
807
+ const iLast = results.length - 1;
808
+ const pass = iLast >= 0 && isEqualReturn(expected, results[iLast]);
809
+ const message = pass
810
+ ? () => {
811
+ const indexedResults = [];
812
+ if (iLast > 0) {
813
+ // Display preceding result as context.
814
+ indexedResults.push([iLast - 1, results[iLast - 1]]);
815
+ }
816
+ indexedResults.push([iLast, results[iLast]]);
817
+ return (
818
+ // eslint-disable-next-line prefer-template
819
+ (0, _jestMatcherUtils.matcherHint)(
820
+ matcherName,
821
+ receivedName,
822
+ expectedArgument,
823
+ options
824
+ ) +
825
+ '\n\n' +
826
+ `Expected: not ${(0, _jestMatcherUtils.printExpected)(
827
+ expected
828
+ )}\n` +
829
+ (results.length === 1 &&
830
+ results[0].type === 'return' &&
831
+ (0, _jestMatcherUtils.stringify)(results[0].value) ===
832
+ (0, _jestMatcherUtils.stringify)(expected)
833
+ ? ''
834
+ : printReceivedResults(
835
+ 'Received: ',
836
+ expected,
837
+ indexedResults,
838
+ results.length === 1,
839
+ iLast
840
+ )) +
841
+ printNumberOfReturns(countReturns(results), calls.length)
842
+ );
843
+ }
844
+ : () => {
845
+ const indexedResults = [];
846
+ if (iLast >= 0) {
847
+ if (iLast > 0) {
848
+ let i = iLast - 1;
849
+ // Is there a preceding result that is equal to expected value?
850
+ while (i >= 0 && !isEqualReturn(expected, results[i])) {
851
+ i -= 1;
852
+ }
853
+ if (i < 0) {
854
+ i = iLast - 1; // otherwise, preceding result
855
+ }
856
+
857
+ indexedResults.push([i, results[i]]);
858
+ }
859
+ indexedResults.push([iLast, results[iLast]]);
860
+ }
861
+ return (
862
+ // eslint-disable-next-line prefer-template
863
+ (0, _jestMatcherUtils.matcherHint)(
864
+ matcherName,
865
+ receivedName,
866
+ expectedArgument,
867
+ options
868
+ ) +
869
+ '\n\n' +
870
+ `Expected: ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
871
+ printReceivedResults(
872
+ 'Received: ',
873
+ expected,
874
+ indexedResults,
875
+ results.length === 1,
876
+ iLast
877
+ ) +
878
+ printNumberOfReturns(countReturns(results), calls.length)
879
+ );
880
+ };
881
+ return {
882
+ message,
883
+ pass
884
+ };
885
+ };
886
+ const createNthCalledWithMatcher = matcherName =>
887
+ function (received, nth, ...expected) {
888
+ const expectedArgument = 'n';
889
+ const options = {
890
+ expectedColor: arg => arg,
891
+ isNot: this.isNot,
892
+ promise: this.promise,
893
+ secondArgument: '...expected'
894
+ };
895
+ ensureMockOrSpy(received, matcherName, expectedArgument, options);
896
+ if (!Number.isSafeInteger(nth) || nth < 1) {
897
+ throw new Error(
898
+ (0, _jestMatcherUtils.matcherErrorMessage)(
899
+ (0, _jestMatcherUtils.matcherHint)(
900
+ matcherName,
901
+ undefined,
902
+ expectedArgument,
903
+ options
904
+ ),
905
+ `${expectedArgument} must be a positive integer`,
906
+ (0, _jestMatcherUtils.printWithType)(
907
+ expectedArgument,
908
+ nth,
909
+ _jestMatcherUtils.stringify
910
+ )
911
+ )
912
+ );
913
+ }
914
+ const receivedIsSpy = isSpy(received);
915
+ const receivedName = receivedIsSpy ? 'spy' : received.getMockName();
916
+ const calls = receivedIsSpy
917
+ ? received.calls.all().map(x => x.args)
918
+ : received.mock.calls;
919
+ const length = calls.length;
920
+ const iNth = nth - 1;
921
+ const pass = iNth < length && isEqualCall(expected, calls[iNth]);
922
+ const message = pass
923
+ ? () => {
924
+ // Display preceding and following calls,
925
+ // in case assertions fails because index is off by one.
926
+ const indexedCalls = [];
927
+ if (iNth - 1 >= 0) {
928
+ indexedCalls.push([iNth - 1, calls[iNth - 1]]);
929
+ }
930
+ indexedCalls.push([iNth, calls[iNth]]);
931
+ if (iNth + 1 < length) {
932
+ indexedCalls.push([iNth + 1, calls[iNth + 1]]);
933
+ }
934
+ return (
935
+ // eslint-disable-next-line prefer-template
936
+ (0, _jestMatcherUtils.matcherHint)(
937
+ matcherName,
938
+ receivedName,
939
+ expectedArgument,
940
+ options
941
+ ) +
942
+ '\n\n' +
943
+ `n: ${nth}\n` +
944
+ `Expected: not ${printExpectedArgs(expected)}\n` +
945
+ (calls.length === 1 &&
946
+ (0, _jestMatcherUtils.stringify)(calls[0]) ===
947
+ (0, _jestMatcherUtils.stringify)(expected)
948
+ ? ''
949
+ : printReceivedCallsNegative(
950
+ expected,
951
+ indexedCalls,
952
+ calls.length === 1,
953
+ iNth
954
+ )) +
955
+ `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(
956
+ calls.length
957
+ )}`
958
+ );
959
+ }
960
+ : () => {
961
+ // Display preceding and following calls:
962
+ // * nearest call that is equal to expected args
963
+ // * otherwise, adjacent call
964
+ // in case assertions fails because of index, especially off by one.
965
+ const indexedCalls = [];
966
+ if (iNth < length) {
967
+ if (iNth - 1 >= 0) {
968
+ let i = iNth - 1;
969
+ // Is there a preceding call that is equal to expected args?
970
+ while (i >= 0 && !isEqualCall(expected, calls[i])) {
971
+ i -= 1;
972
+ }
973
+ if (i < 0) {
974
+ i = iNth - 1; // otherwise, adjacent call
975
+ }
976
+
977
+ indexedCalls.push([i, calls[i]]);
978
+ }
979
+ indexedCalls.push([iNth, calls[iNth]]);
980
+ if (iNth + 1 < length) {
981
+ let i = iNth + 1;
982
+ // Is there a following call that is equal to expected args?
983
+ while (i < length && !isEqualCall(expected, calls[i])) {
984
+ i += 1;
985
+ }
986
+ if (i >= length) {
987
+ i = iNth + 1; // otherwise, adjacent call
988
+ }
989
+
990
+ indexedCalls.push([i, calls[i]]);
991
+ }
992
+ } else if (length > 0) {
993
+ // The number of received calls is fewer than the expected number.
994
+ let i = length - 1;
995
+ // Is there a call that is equal to expected args?
996
+ while (i >= 0 && !isEqualCall(expected, calls[i])) {
997
+ i -= 1;
998
+ }
999
+ if (i < 0) {
1000
+ i = length - 1; // otherwise, last call
1001
+ }
1002
+
1003
+ indexedCalls.push([i, calls[i]]);
1004
+ }
1005
+ return (
1006
+ // eslint-disable-next-line prefer-template
1007
+ (0, _jestMatcherUtils.matcherHint)(
1008
+ matcherName,
1009
+ receivedName,
1010
+ expectedArgument,
1011
+ options
1012
+ ) +
1013
+ '\n\n' +
1014
+ `n: ${nth}\n` +
1015
+ printExpectedReceivedCallsPositive(
1016
+ expected,
1017
+ indexedCalls,
1018
+ isExpand(this.expand),
1019
+ calls.length === 1,
1020
+ iNth
1021
+ ) +
1022
+ `\nNumber of calls: ${(0, _jestMatcherUtils.printReceived)(
1023
+ calls.length
1024
+ )}`
1025
+ );
1026
+ };
1027
+ return {
1028
+ message,
1029
+ pass
1030
+ };
1031
+ };
1032
+ const createNthReturnedWithMatcher = matcherName =>
1033
+ function (received, nth, expected) {
1034
+ const expectedArgument = 'n';
1035
+ const options = {
1036
+ expectedColor: arg => arg,
1037
+ isNot: this.isNot,
1038
+ promise: this.promise,
1039
+ secondArgument: 'expected'
1040
+ };
1041
+ ensureMock(received, matcherName, expectedArgument, options);
1042
+ if (!Number.isSafeInteger(nth) || nth < 1) {
1043
+ throw new Error(
1044
+ (0, _jestMatcherUtils.matcherErrorMessage)(
1045
+ (0, _jestMatcherUtils.matcherHint)(
1046
+ matcherName,
1047
+ undefined,
1048
+ expectedArgument,
1049
+ options
1050
+ ),
1051
+ `${expectedArgument} must be a positive integer`,
1052
+ (0, _jestMatcherUtils.printWithType)(
1053
+ expectedArgument,
1054
+ nth,
1055
+ _jestMatcherUtils.stringify
1056
+ )
1057
+ )
1058
+ );
1059
+ }
1060
+ const receivedName = received.getMockName();
1061
+ const {calls, results} = received.mock;
1062
+ const length = results.length;
1063
+ const iNth = nth - 1;
1064
+ const pass = iNth < length && isEqualReturn(expected, results[iNth]);
1065
+ const message = pass
1066
+ ? () => {
1067
+ // Display preceding and following results,
1068
+ // in case assertions fails because index is off by one.
1069
+ const indexedResults = [];
1070
+ if (iNth - 1 >= 0) {
1071
+ indexedResults.push([iNth - 1, results[iNth - 1]]);
1072
+ }
1073
+ indexedResults.push([iNth, results[iNth]]);
1074
+ if (iNth + 1 < length) {
1075
+ indexedResults.push([iNth + 1, results[iNth + 1]]);
1076
+ }
1077
+ return (
1078
+ // eslint-disable-next-line prefer-template
1079
+ (0, _jestMatcherUtils.matcherHint)(
1080
+ matcherName,
1081
+ receivedName,
1082
+ expectedArgument,
1083
+ options
1084
+ ) +
1085
+ '\n\n' +
1086
+ `n: ${nth}\n` +
1087
+ `Expected: not ${(0, _jestMatcherUtils.printExpected)(
1088
+ expected
1089
+ )}\n` +
1090
+ (results.length === 1 &&
1091
+ results[0].type === 'return' &&
1092
+ (0, _jestMatcherUtils.stringify)(results[0].value) ===
1093
+ (0, _jestMatcherUtils.stringify)(expected)
1094
+ ? ''
1095
+ : printReceivedResults(
1096
+ 'Received: ',
1097
+ expected,
1098
+ indexedResults,
1099
+ results.length === 1,
1100
+ iNth
1101
+ )) +
1102
+ printNumberOfReturns(countReturns(results), calls.length)
1103
+ );
1104
+ }
1105
+ : () => {
1106
+ // Display preceding and following results:
1107
+ // * nearest result that is equal to expected value
1108
+ // * otherwise, adjacent result
1109
+ // in case assertions fails because of index, especially off by one.
1110
+ const indexedResults = [];
1111
+ if (iNth < length) {
1112
+ if (iNth - 1 >= 0) {
1113
+ let i = iNth - 1;
1114
+ // Is there a preceding result that is equal to expected value?
1115
+ while (i >= 0 && !isEqualReturn(expected, results[i])) {
1116
+ i -= 1;
1117
+ }
1118
+ if (i < 0) {
1119
+ i = iNth - 1; // otherwise, adjacent result
1120
+ }
1121
+
1122
+ indexedResults.push([i, results[i]]);
1123
+ }
1124
+ indexedResults.push([iNth, results[iNth]]);
1125
+ if (iNth + 1 < length) {
1126
+ let i = iNth + 1;
1127
+ // Is there a following result that is equal to expected value?
1128
+ while (i < length && !isEqualReturn(expected, results[i])) {
1129
+ i += 1;
1130
+ }
1131
+ if (i >= length) {
1132
+ i = iNth + 1; // otherwise, adjacent result
1133
+ }
1134
+
1135
+ indexedResults.push([i, results[i]]);
1136
+ }
1137
+ } else if (length > 0) {
1138
+ // The number of received calls is fewer than the expected number.
1139
+ let i = length - 1;
1140
+ // Is there a result that is equal to expected value?
1141
+ while (i >= 0 && !isEqualReturn(expected, results[i])) {
1142
+ i -= 1;
1143
+ }
1144
+ if (i < 0) {
1145
+ i = length - 1; // otherwise, last result
1146
+ }
1147
+
1148
+ indexedResults.push([i, results[i]]);
1149
+ }
1150
+ return (
1151
+ // eslint-disable-next-line prefer-template
1152
+ (0, _jestMatcherUtils.matcherHint)(
1153
+ matcherName,
1154
+ receivedName,
1155
+ expectedArgument,
1156
+ options
1157
+ ) +
1158
+ '\n\n' +
1159
+ `n: ${nth}\n` +
1160
+ `Expected: ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
1161
+ printReceivedResults(
1162
+ 'Received: ',
1163
+ expected,
1164
+ indexedResults,
1165
+ results.length === 1,
1166
+ iNth
1167
+ ) +
1168
+ printNumberOfReturns(countReturns(results), calls.length)
1169
+ );
1170
+ };
1171
+ return {
1172
+ message,
1173
+ pass
1174
+ };
1175
+ };
1176
+ const spyMatchers = {
1177
+ lastCalledWith: createLastCalledWithMatcher('lastCalledWith'),
1178
+ lastReturnedWith: createLastReturnedMatcher('lastReturnedWith'),
1179
+ nthCalledWith: createNthCalledWithMatcher('nthCalledWith'),
1180
+ nthReturnedWith: createNthReturnedWithMatcher('nthReturnedWith'),
1181
+ toBeCalled: createToBeCalledMatcher('toBeCalled'),
1182
+ toBeCalledTimes: createToBeCalledTimesMatcher('toBeCalledTimes'),
1183
+ toBeCalledWith: createToBeCalledWithMatcher('toBeCalledWith'),
1184
+ toHaveBeenCalled: createToBeCalledMatcher('toHaveBeenCalled'),
1185
+ toHaveBeenCalledTimes: createToBeCalledTimesMatcher('toHaveBeenCalledTimes'),
1186
+ toHaveBeenCalledWith: createToBeCalledWithMatcher('toHaveBeenCalledWith'),
1187
+ toHaveBeenLastCalledWith: createLastCalledWithMatcher(
1188
+ 'toHaveBeenLastCalledWith'
1189
+ ),
1190
+ toHaveBeenNthCalledWith: createNthCalledWithMatcher(
1191
+ 'toHaveBeenNthCalledWith'
1192
+ ),
1193
+ toHaveLastReturnedWith: createLastReturnedMatcher('toHaveLastReturnedWith'),
1194
+ toHaveNthReturnedWith: createNthReturnedWithMatcher('toHaveNthReturnedWith'),
1195
+ toHaveReturned: createToReturnMatcher('toHaveReturned'),
1196
+ toHaveReturnedTimes: createToReturnTimesMatcher('toHaveReturnedTimes'),
1197
+ toHaveReturnedWith: createToReturnWithMatcher('toHaveReturnedWith'),
1198
+ toReturn: createToReturnMatcher('toReturn'),
1199
+ toReturnTimes: createToReturnTimesMatcher('toReturnTimes'),
1200
+ toReturnWith: createToReturnWithMatcher('toReturnWith')
1201
+ };
1202
+ const isMock = received =>
1203
+ received != null && received._isMockFunction === true;
1204
+ const isSpy = received =>
1205
+ received != null &&
1206
+ received.calls != null &&
1207
+ typeof received.calls.all === 'function' &&
1208
+ typeof received.calls.count === 'function';
1209
+ const ensureMockOrSpy = (received, matcherName, expectedArgument, options) => {
1210
+ if (!isMock(received) && !isSpy(received)) {
1211
+ throw new Error(
1212
+ (0, _jestMatcherUtils.matcherErrorMessage)(
1213
+ (0, _jestMatcherUtils.matcherHint)(
1214
+ matcherName,
1215
+ undefined,
1216
+ expectedArgument,
1217
+ options
1218
+ ),
1219
+ `${(0, _jestMatcherUtils.RECEIVED_COLOR)(
1220
+ 'received'
1221
+ )} value must be a mock or spy function`,
1222
+ (0, _jestMatcherUtils.printWithType)(
1223
+ 'Received',
1224
+ received,
1225
+ _jestMatcherUtils.printReceived
1226
+ )
1227
+ )
1228
+ );
1229
+ }
1230
+ };
1231
+ const ensureMock = (received, matcherName, expectedArgument, options) => {
1232
+ if (!isMock(received)) {
1233
+ throw new Error(
1234
+ (0, _jestMatcherUtils.matcherErrorMessage)(
1235
+ (0, _jestMatcherUtils.matcherHint)(
1236
+ matcherName,
1237
+ undefined,
1238
+ expectedArgument,
1239
+ options
1240
+ ),
1241
+ `${(0, _jestMatcherUtils.RECEIVED_COLOR)(
1242
+ 'received'
1243
+ )} value must be a mock function`,
1244
+ (0, _jestMatcherUtils.printWithType)(
1245
+ 'Received',
1246
+ received,
1247
+ _jestMatcherUtils.printReceived
1248
+ )
1249
+ )
1250
+ );
1251
+ }
1252
+ };
1253
+ var _default = spyMatchers;
1254
+ exports.default = _default;