@bemedev/dev-utils 1.1.1 → 1.3.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 (278) hide show
  1. package/README.md +121 -0
  2. package/lib/_virtual/_rolldown/runtime.cjs +1 -1
  3. package/lib/build-tests/addTarball.cjs +5 -1
  4. package/lib/build-tests/addTarball.cjs.map +1 -1
  5. package/lib/build-tests/addTarball.d.ts +3 -0
  6. package/lib/build-tests/addTarball.js +5 -1
  7. package/lib/build-tests/addTarball.js.map +1 -1
  8. package/lib/build-tests/buildPackageJson.cjs +17 -9
  9. package/lib/build-tests/buildPackageJson.cjs.map +1 -1
  10. package/lib/build-tests/buildPackageJson.d.ts +5 -0
  11. package/lib/build-tests/buildPackageJson.js +17 -9
  12. package/lib/build-tests/buildPackageJson.js.map +1 -1
  13. package/lib/build-tests/cleanup.cjs +3 -0
  14. package/lib/build-tests/cleanup.cjs.map +1 -1
  15. package/lib/build-tests/cleanup.d.ts +3 -0
  16. package/lib/build-tests/cleanup.js +3 -0
  17. package/lib/build-tests/cleanup.js.map +1 -1
  18. package/lib/build-tests/cli/cli.cjs +6 -0
  19. package/lib/build-tests/cli/cli.cjs.map +1 -1
  20. package/lib/build-tests/cli/cli.d.ts +6 -0
  21. package/lib/build-tests/cli/cli.js +6 -0
  22. package/lib/build-tests/cli/cli.js.map +1 -1
  23. package/lib/build-tests/cli/index.cjs.map +1 -1
  24. package/lib/build-tests/cli/post.cjs +3 -0
  25. package/lib/build-tests/cli/post.cjs.map +1 -1
  26. package/lib/build-tests/cli/post.d.ts +3 -0
  27. package/lib/build-tests/cli/post.js +3 -0
  28. package/lib/build-tests/cli/post.js.map +1 -1
  29. package/lib/build-tests/cli/pre.cjs +3 -0
  30. package/lib/build-tests/cli/pre.cjs.map +1 -1
  31. package/lib/build-tests/cli/pre.d.ts +3 -0
  32. package/lib/build-tests/cli/pre.js +3 -0
  33. package/lib/build-tests/cli/pre.js.map +1 -1
  34. package/lib/build-tests/cli/test.cjs +3 -0
  35. package/lib/build-tests/cli/test.cjs.map +1 -1
  36. package/lib/build-tests/cli/test.d.ts +3 -0
  37. package/lib/build-tests/cli/test.js +3 -0
  38. package/lib/build-tests/cli/test.js.map +1 -1
  39. package/lib/build-tests/constants.cjs +42 -0
  40. package/lib/build-tests/constants.cjs.map +1 -1
  41. package/lib/build-tests/constants.d.ts +42 -0
  42. package/lib/build-tests/constants.js +42 -0
  43. package/lib/build-tests/constants.js.map +1 -1
  44. package/lib/build-tests/getRelativePath.cjs +7 -0
  45. package/lib/build-tests/getRelativePath.cjs.map +1 -1
  46. package/lib/build-tests/getRelativePath.d.ts +7 -0
  47. package/lib/build-tests/getRelativePath.js +7 -0
  48. package/lib/build-tests/getRelativePath.js.map +1 -1
  49. package/lib/build-tests/getTypescriptOutdir.cjs +5 -0
  50. package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
  51. package/lib/build-tests/getTypescriptOutdir.d.ts +5 -0
  52. package/lib/build-tests/getTypescriptOutdir.js +5 -0
  53. package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
  54. package/lib/build-tests/import.cjs +9 -0
  55. package/lib/build-tests/import.cjs.map +1 -1
  56. package/lib/build-tests/import.d.ts +9 -0
  57. package/lib/build-tests/import.js +9 -0
  58. package/lib/build-tests/import.js.map +1 -1
  59. package/lib/build-tests/imports/create.cjs +7 -0
  60. package/lib/build-tests/imports/create.cjs.map +1 -1
  61. package/lib/build-tests/imports/create.d.ts +13 -0
  62. package/lib/build-tests/imports/create.js +7 -0
  63. package/lib/build-tests/imports/create.js.map +1 -1
  64. package/lib/build-tests/imports/helper.cjs +9 -0
  65. package/lib/build-tests/imports/helper.cjs.map +1 -1
  66. package/lib/build-tests/imports/helper.d.ts +12 -0
  67. package/lib/build-tests/imports/helper.js +9 -0
  68. package/lib/build-tests/imports/helper.js.map +1 -1
  69. package/lib/build-tests/pack.cjs +7 -1
  70. package/lib/build-tests/pack.cjs.map +1 -1
  71. package/lib/build-tests/pack.d.ts +5 -0
  72. package/lib/build-tests/pack.js +7 -1
  73. package/lib/build-tests/pack.js.map +1 -1
  74. package/lib/plugins/hmr.cjs +72 -0
  75. package/lib/plugins/hmr.cjs.map +1 -0
  76. package/lib/plugins/hmr.d.ts +22 -0
  77. package/lib/plugins/hmr.js +71 -0
  78. package/lib/plugins/hmr.js.map +1 -0
  79. package/lib/plugins/index.cjs +5 -0
  80. package/lib/plugins/index.d.ts +2 -0
  81. package/lib/plugins/index.js +3 -0
  82. package/lib/plugins/suppressWarnings.cjs +37 -0
  83. package/lib/plugins/suppressWarnings.cjs.map +1 -0
  84. package/lib/plugins/suppressWarnings.d.ts +12 -0
  85. package/lib/plugins/suppressWarnings.js +36 -0
  86. package/lib/plugins/suppressWarnings.js.map +1 -0
  87. package/lib/rolldown-config/config.cjs +13 -5
  88. package/lib/rolldown-config/config.cjs.map +1 -1
  89. package/lib/rolldown-config/config.d.ts +7 -0
  90. package/lib/rolldown-config/config.js +13 -5
  91. package/lib/rolldown-config/config.js.map +1 -1
  92. package/lib/rolldown-config/constants.cjs +15 -0
  93. package/lib/rolldown-config/constants.cjs.map +1 -1
  94. package/lib/rolldown-config/constants.d.ts +15 -0
  95. package/lib/rolldown-config/constants.js +15 -0
  96. package/lib/rolldown-config/constants.js.map +1 -1
  97. package/lib/rolldown-config/helpers.cjs +16 -1
  98. package/lib/rolldown-config/helpers.cjs.map +1 -1
  99. package/lib/rolldown-config/helpers.d.ts +14 -0
  100. package/lib/rolldown-config/helpers.js +16 -1
  101. package/lib/rolldown-config/helpers.js.map +1 -1
  102. package/lib/rolldown-config/input.cjs +8 -0
  103. package/lib/rolldown-config/input.cjs.map +1 -1
  104. package/lib/rolldown-config/input.d.ts +8 -0
  105. package/lib/rolldown-config/input.js +8 -0
  106. package/lib/rolldown-config/input.js.map +1 -1
  107. package/lib/rolldown-config/output.cjs +8 -0
  108. package/lib/rolldown-config/output.cjs.map +1 -1
  109. package/lib/rolldown-config/output.d.ts +8 -0
  110. package/lib/rolldown-config/output.js +8 -0
  111. package/lib/rolldown-config/output.js.map +1 -1
  112. package/lib/rolldown-config/plugins/circulars.cjs +5 -5
  113. package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
  114. package/lib/rolldown-config/plugins/circulars.d.ts +10 -6
  115. package/lib/rolldown-config/plugins/circulars.js +5 -5
  116. package/lib/rolldown-config/plugins/circulars.js.map +1 -1
  117. package/lib/rolldown-config/plugins/clean.cjs +10 -1
  118. package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
  119. package/lib/rolldown-config/plugins/clean.d.ts +10 -0
  120. package/lib/rolldown-config/plugins/clean.js +10 -1
  121. package/lib/rolldown-config/plugins/clean.js.map +1 -1
  122. package/lib/rolldown-config/plugins/externals.cjs +4 -3
  123. package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
  124. package/lib/rolldown-config/plugins/externals.d.ts +7 -3
  125. package/lib/rolldown-config/plugins/externals.js +4 -3
  126. package/lib/rolldown-config/plugins/externals.js.map +1 -1
  127. package/lib/rolldown-config/plugins/index.cjs +6 -0
  128. package/lib/rolldown-config/plugins/index.cjs.map +1 -1
  129. package/lib/rolldown-config/plugins/index.d.ts +6 -0
  130. package/lib/rolldown-config/plugins/index.js +6 -0
  131. package/lib/rolldown-config/plugins/index.js.map +1 -1
  132. package/lib/rolldown-config/plugins/typescript.cjs +7 -0
  133. package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
  134. package/lib/rolldown-config/plugins/typescript.config.cjs +15 -0
  135. package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
  136. package/lib/rolldown-config/plugins/typescript.config.d.ts +15 -0
  137. package/lib/rolldown-config/plugins/typescript.config.js +15 -0
  138. package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
  139. package/lib/rolldown-config/plugins/typescript.d.ts +10 -0
  140. package/lib/rolldown-config/plugins/typescript.fast.cjs +9 -1
  141. package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -1
  142. package/lib/rolldown-config/plugins/typescript.fast.d.ts +10 -0
  143. package/lib/rolldown-config/plugins/typescript.fast.js +9 -1
  144. package/lib/rolldown-config/plugins/typescript.fast.js.map +1 -1
  145. package/lib/rolldown-config/plugins/typescript.js +7 -0
  146. package/lib/rolldown-config/plugins/typescript.js.map +1 -1
  147. package/lib/rolldown-config/types.d.ts +18 -0
  148. package/lib/utils/array.cjs +7 -0
  149. package/lib/utils/array.cjs.map +1 -1
  150. package/lib/utils/array.d.ts +8 -0
  151. package/lib/utils/array.js +7 -0
  152. package/lib/utils/array.js.map +1 -1
  153. package/lib/utils/bemedev/globals/types.d.ts +20 -0
  154. package/lib/utils/bemedev/globals/utils/expandFn.cjs +11 -0
  155. package/lib/utils/bemedev/globals/utils/expandFn.cjs.map +1 -1
  156. package/lib/utils/bemedev/globals/utils/expandFn.d.ts +11 -0
  157. package/lib/utils/bemedev/globals/utils/expandFn.js +11 -0
  158. package/lib/utils/bemedev/globals/utils/expandFn.js.map +1 -1
  159. package/lib/utils/clamp.cjs +18 -0
  160. package/lib/utils/clamp.cjs.map +1 -0
  161. package/lib/utils/clamp.d.ts +10 -0
  162. package/lib/utils/clamp.js +17 -0
  163. package/lib/utils/clamp.js.map +1 -0
  164. package/lib/utils/identity.cjs +9 -0
  165. package/lib/utils/identity.cjs.map +1 -1
  166. package/lib/utils/identity.d.ts +9 -0
  167. package/lib/utils/identity.js +9 -0
  168. package/lib/utils/identity.js.map +1 -1
  169. package/lib/utils/index.cjs +2 -0
  170. package/lib/utils/index.d.ts +1 -0
  171. package/lib/utils/index.js +2 -1
  172. package/lib/utils/sleep.cjs +7 -0
  173. package/lib/utils/sleep.cjs.map +1 -1
  174. package/lib/utils/sleep.d.ts +7 -0
  175. package/lib/utils/sleep.js +7 -0
  176. package/lib/utils/sleep.js.map +1 -1
  177. package/lib/utils/types.d.ts +17 -1
  178. package/lib/vitest-exclude/constants.cjs +3 -0
  179. package/lib/vitest-exclude/constants.cjs.map +1 -1
  180. package/lib/vitest-exclude/constants.d.ts +3 -0
  181. package/lib/vitest-exclude/constants.js +3 -0
  182. package/lib/vitest-exclude/constants.js.map +1 -1
  183. package/lib/vitest-exclude/types.d.ts +11 -0
  184. package/lib/vitest-exclude/vitest.cjs +25 -12
  185. package/lib/vitest-exclude/vitest.cjs.map +1 -1
  186. package/lib/vitest-exclude/vitest.d.ts +9 -8
  187. package/lib/vitest-exclude/vitest.js +25 -12
  188. package/lib/vitest-exclude/vitest.js.map +1 -1
  189. package/lib/vitest-exclude/vitest.utils.cjs +30 -0
  190. package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
  191. package/lib/vitest-exclude/vitest.utils.d.ts +30 -0
  192. package/lib/vitest-exclude/vitest.utils.js +30 -0
  193. package/lib/vitest-exclude/vitest.utils.js.map +1 -1
  194. package/lib/vitest-extended/acceptation.cjs +11 -2
  195. package/lib/vitest-extended/acceptation.cjs.map +1 -1
  196. package/lib/vitest-extended/acceptation.d.ts +9 -1
  197. package/lib/vitest-extended/acceptation.js +11 -2
  198. package/lib/vitest-extended/acceptation.js.map +1 -1
  199. package/lib/vitest-extended/createTests.cjs +34 -27
  200. package/lib/vitest-extended/createTests.cjs.map +1 -1
  201. package/lib/vitest-extended/createTests.d.ts +20 -37
  202. package/lib/vitest-extended/createTests.js +34 -27
  203. package/lib/vitest-extended/createTests.js.map +1 -1
  204. package/lib/vitest-extended/createTests.types.d.ts +13 -2
  205. package/lib/vitest-extended/done.cjs +18 -15
  206. package/lib/vitest-extended/done.cjs.map +1 -1
  207. package/lib/vitest-extended/done.d.ts +6 -5
  208. package/lib/vitest-extended/done.js +18 -15
  209. package/lib/vitest-extended/done.js.map +1 -1
  210. package/lib/vitest-extended/each/error.cjs +12 -0
  211. package/lib/vitest-extended/each/error.cjs.map +1 -1
  212. package/lib/vitest-extended/each/error.d.ts +12 -0
  213. package/lib/vitest-extended/each/error.js +12 -0
  214. package/lib/vitest-extended/each/error.js.map +1 -1
  215. package/lib/vitest-extended/each/error.types.d.ts +17 -0
  216. package/lib/vitest-extended/each/pass.cjs +9 -20
  217. package/lib/vitest-extended/each/pass.cjs.map +1 -1
  218. package/lib/vitest-extended/each/pass.d.ts +9 -20
  219. package/lib/vitest-extended/each/pass.js +9 -20
  220. package/lib/vitest-extended/each/pass.js.map +1 -1
  221. package/lib/vitest-extended/each/pass.types.d.ts +24 -0
  222. package/lib/vitest-extended/fakeWaiter.cjs +7 -0
  223. package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
  224. package/lib/vitest-extended/fakeWaiter.d.ts +32 -0
  225. package/lib/vitest-extended/fakeWaiter.js +7 -0
  226. package/lib/vitest-extended/fakeWaiter.js.map +1 -1
  227. package/lib/vitest-extended/fixtures/coverage.cjs +11 -0
  228. package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
  229. package/lib/vitest-extended/fixtures/coverage.js +11 -0
  230. package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
  231. package/lib/vitest-extended/fixtures/partialCall.cjs +9 -4
  232. package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
  233. package/lib/vitest-extended/fixtures/partialCall.js +9 -4
  234. package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
  235. package/lib/vitest-extended/fixtures/toUpper.cjs +18 -0
  236. package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
  237. package/lib/vitest-extended/fixtures/toUpper.js +18 -0
  238. package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
  239. package/lib/vitest-extended/fixtures/vitest.cjs +3 -0
  240. package/lib/vitest-extended/fixtures/vitest.cjs.map +1 -1
  241. package/lib/vitest-extended/fixtures/vitest.js +3 -0
  242. package/lib/vitest-extended/fixtures/vitest.js.map +1 -1
  243. package/lib/vitest-extended/fixtures/zod.cjs +22 -0
  244. package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
  245. package/lib/vitest-extended/fixtures/zod.js +22 -0
  246. package/lib/vitest-extended/fixtures/zod.js.map +1 -1
  247. package/lib/vitest-extended/identity.cjs +18 -0
  248. package/lib/vitest-extended/identity.cjs.map +1 -1
  249. package/lib/vitest-extended/identity.d.ts +18 -0
  250. package/lib/vitest-extended/identity.js +18 -0
  251. package/lib/vitest-extended/identity.js.map +1 -1
  252. package/lib/vitest-extended/isDefined.cjs +9 -0
  253. package/lib/vitest-extended/isDefined.cjs.map +1 -1
  254. package/lib/vitest-extended/isDefined.d.ts +9 -0
  255. package/lib/vitest-extended/isDefined.js +9 -0
  256. package/lib/vitest-extended/isDefined.js.map +1 -1
  257. package/lib/vitest-extended/isFunction.cjs +7 -0
  258. package/lib/vitest-extended/isFunction.cjs.map +1 -1
  259. package/lib/vitest-extended/isFunction.d.ts +7 -0
  260. package/lib/vitest-extended/isFunction.js +7 -0
  261. package/lib/vitest-extended/isFunction.js.map +1 -1
  262. package/lib/vitest-extended/project.cjs +7 -0
  263. package/lib/vitest-extended/project.cjs.map +1 -1
  264. package/lib/vitest-extended/project.d.ts +7 -0
  265. package/lib/vitest-extended/project.js +7 -0
  266. package/lib/vitest-extended/project.js.map +1 -1
  267. package/lib/vitest-extended/toArray.cjs +6 -0
  268. package/lib/vitest-extended/toArray.cjs.map +1 -1
  269. package/lib/vitest-extended/toArray.d.ts +6 -0
  270. package/lib/vitest-extended/toArray.js +6 -0
  271. package/lib/vitest-extended/toArray.js.map +1 -1
  272. package/lib/vitest-extended/toStringFlat.cjs +8 -0
  273. package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
  274. package/lib/vitest-extended/toStringFlat.d.ts +8 -0
  275. package/lib/vitest-extended/toStringFlat.js +8 -0
  276. package/lib/vitest-extended/toStringFlat.js.map +1 -1
  277. package/lib/vitest-extended/types.d.ts +64 -0
  278. package/package.json +14 -9
@@ -9,26 +9,12 @@ const useEachCases = (func, transform = require_vitest_extended_identity.identit
9
9
  });
10
10
  };
11
11
  /**
12
- * A better version of **test.each**
12
+ * Runs parameterized tests with strict equality checks across multiple cases.
13
13
  *
14
- * Type parameters
14
+ * @param func - Function to test.
15
+ * @param transform - Optional transformer applied to the return value.
15
16
  *
16
- * @type A Parameters of the function, extends Array type
17
- * @type R ReturnType of the function
18
- * @param func The function to test
19
- * @param cases The cases to test, The invite is the first arguments. It's
20
- * an array of Array.
21
- *
22
- * - #1 The first arg is the invite of the test
23
- * - #2 The second arg is the parameters to to pass to the function. It's
24
- * an array (param array).
25
- * - #3 The third arg is the expected result
26
- *
27
- * Example: For a function like **_(arg1: string)=>any**_, the second arg
28
- * with be : **_[string]**_
29
- * @if R are not provided, the return is a function to test with TestArgs arguments
30
- *
31
- * @else It tests every cases provided
17
+ * @returns Function accepting test cases to execute.
32
18
  */
33
19
  const useEach = (func, transform) => {
34
20
  return (...cases) => useEachCases(func, transform, ...cases);
@@ -39,9 +25,12 @@ const useEachAsyncCases = (f, transform = require_vitest_extended_identity.ident
39
25
  });
40
26
  };
41
27
  /**
42
- * Same as _**useEach**_
28
+ * Runs asynchronous parameterized tests with strict equality checks across multiple cases.
29
+ *
30
+ * @param func - Async function to test.
31
+ * @param transform - Optional transformer applied to the resolved return value.
43
32
  *
44
- * But for async functions
33
+ * @returns Function accepting test cases to execute.
45
34
  */
46
35
  const useEachAsync = (func, transform) => {
47
36
  return (...cases) => useEachAsyncCases(func, transform, ...cases);
@@ -1 +1 @@
1
- {"version":3,"file":"pass.cjs","names":["identity","toArrayVitest","defaultEquality"],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\n\nimport { defaultEquality, identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type {\n _UseAsyncEach_F,\n _UseEach_F,\n UseAsyncEach_F,\n UseEach_F,\n} from './pass.types';\n\n// #region Sync\nconst useEachCases: _UseEach_F = (\n func,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n (_, args, expected, test = defaultEquality) => {\n const value = transform(func(...args));\n return test(value, expected);\n },\n );\n};\n\n/**\n * A better version of **test.each**\n *\n * Type parameters\n *\n * @type A Parameters of the function, extends Array type\n * @type R ReturnType of the function\n * @param func The function to test\n * @param cases The cases to test, The invite is the first arguments. It's\n * an array of Array.\n *\n * - #1 The first arg is the invite of the test\n * - #2 The second arg is the parameters to to pass to the function. It's\n * an array (param array).\n * - #3 The third arg is the expected result\n *\n * Example: For a function like **_(arg1: string)=>any**_, the second arg\n * with be : **_[string]**_\n * @if R are not provided, the return is a function to test with TestArgs arguments\n *\n * @else It tests every cases provided\n */\nexport const useEach: UseEach_F = (func, transform) => {\n return (...cases) => useEachCases(func, transform, ...cases);\n};\n// #endregion\n\n// #region Async\nconst useEachAsyncCases: _UseAsyncEach_F = (\n f,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n async (_, args, expected, test = defaultEquality) => {\n const _value = await f(...args);\n const value = await transform(_value);\n return test(value, expected);\n },\n );\n};\n\n/**\n * Same as _**useEach**_\n *\n * But for async functions\n */\nexport const useEachAsync: UseAsyncEach_F = (func, transform) => {\n return (...cases) => useEachAsyncCases(func, transform, ...cases);\n};\n// #endregion\n"],"mappings":";;;;;AAYA,MAAM,gBACJ,MACA,YAAYA,iCAAAA,UACZ,GAAG,UACA;CACH,OAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,KAAK,CAAC,CAAC,CACxC,OACC,GAAG,MAAM,UAAU,OAAOC,iCAAAA,oBAAoB;EAE7C,OAAO,KADO,UAAU,KAAK,GAAG,IAAI,CACpB,GAAG,QAAQ;CAC7B,CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,WAAsB,MAAM,cAAc;CACrD,QAAQ,GAAG,UAAU,aAAa,MAAM,WAAW,GAAG,KAAK;AAC7D;AAIA,MAAM,qBACJ,GACA,YAAYF,iCAAAA,UACZ,GAAG,UACA;CACH,OAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,KAAK,CAAC,CAAC,CACxC,MACA,OAAO,GAAG,MAAM,UAAU,OAAOC,iCAAAA,oBAAoB;EAGnD,OAAO,KAAK,MADQ,UAAU,MADT,EAAE,GAAG,IAAI,CACM,GACjB,QAAQ;CAC7B,CACF;AACF;;;;;;AAOA,MAAa,gBAAgC,MAAM,cAAc;CAC/D,QAAQ,GAAG,UAAU,kBAAkB,MAAM,WAAW,GAAG,KAAK;AAClE"}
1
+ {"version":3,"file":"pass.cjs","names":["identity","toArrayVitest","defaultEquality"],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\n\nimport { defaultEquality, identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type {\n _UseAsyncEach_F,\n _UseEach_F,\n UseAsyncEach_F,\n UseEach_F,\n} from './pass.types';\n\n// #region Sync\nconst useEachCases: _UseEach_F = (\n func,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n (_, args, expected, test = defaultEquality) => {\n const value = transform(func(...args));\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Function to test.\n * @param transform - Optional transformer applied to the return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEach: UseEach_F = (func, transform) => {\n return (...cases) => useEachCases(func, transform, ...cases);\n};\n// #endregion\n\n// #region Async\nconst useEachAsyncCases: _UseAsyncEach_F = (\n f,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n async (_, args, expected, test = defaultEquality) => {\n const _value = await f(...args);\n const value = await transform(_value);\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs asynchronous parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Async function to test.\n * @param transform - Optional transformer applied to the resolved return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEachAsync: UseAsyncEach_F = (func, transform) => {\n return (...cases) => useEachAsyncCases(func, transform, ...cases);\n};\n\n// #endregion\n"],"mappings":";;;;;AAYA,MAAM,gBACJ,MACA,YAAYA,iCAAAA,UACZ,GAAG,UACA;CACH,OAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,KAAK,CAAC,CAAC,CACxC,OACC,GAAG,MAAM,UAAU,OAAOC,iCAAAA,oBAAoB;EAE7C,OAAO,KADO,UAAU,KAAK,GAAG,IAAI,CACpB,GAAG,QAAQ;CAC7B,CACF;AACF;;;;;;;;;AAUA,MAAa,WAAsB,MAAM,cAAc;CACrD,QAAQ,GAAG,UAAU,aAAa,MAAM,WAAW,GAAG,KAAK;AAC7D;AAIA,MAAM,qBACJ,GACA,YAAYF,iCAAAA,UACZ,GAAG,UACA;CACH,OAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,KAAK,CAAC,CAAC,CACxC,MACA,OAAO,GAAG,MAAM,UAAU,OAAOC,iCAAAA,oBAAoB;EAGnD,OAAO,KAAK,MADQ,UAAU,MADT,EAAE,GAAG,IAAI,CACM,GACjB,QAAQ;CAC7B,CACF;AACF;;;;;;;;;AAUA,MAAa,gBAAgC,MAAM,cAAc;CAC/D,QAAQ,GAAG,UAAU,kBAAkB,MAAM,WAAW,GAAG,KAAK;AAClE"}
@@ -1,30 +1,19 @@
1
1
  import type { UseAsyncEach_F, UseEach_F } from './pass.types';
2
2
  /**
3
- * A better version of **test.each**
3
+ * Runs parameterized tests with strict equality checks across multiple cases.
4
4
  *
5
- * Type parameters
5
+ * @param func - Function to test.
6
+ * @param transform - Optional transformer applied to the return value.
6
7
  *
7
- * @type A Parameters of the function, extends Array type
8
- * @type R ReturnType of the function
9
- * @param func The function to test
10
- * @param cases The cases to test, The invite is the first arguments. It's
11
- * an array of Array.
12
- *
13
- * - #1 The first arg is the invite of the test
14
- * - #2 The second arg is the parameters to to pass to the function. It's
15
- * an array (param array).
16
- * - #3 The third arg is the expected result
17
- *
18
- * Example: For a function like **_(arg1: string)=>any**_, the second arg
19
- * with be : **_[string]**_
20
- * @if R are not provided, the return is a function to test with TestArgs arguments
21
- *
22
- * @else It tests every cases provided
8
+ * @returns Function accepting test cases to execute.
23
9
  */
24
10
  export declare const useEach: UseEach_F;
25
11
  /**
26
- * Same as _**useEach**_
12
+ * Runs asynchronous parameterized tests with strict equality checks across multiple cases.
13
+ *
14
+ * @param func - Async function to test.
15
+ * @param transform - Optional transformer applied to the resolved return value.
27
16
  *
28
- * But for async functions
17
+ * @returns Function accepting test cases to execute.
29
18
  */
30
19
  export declare const useEachAsync: UseAsyncEach_F;
@@ -8,26 +8,12 @@ const useEachCases = (func, transform = identity, ...cases) => {
8
8
  });
9
9
  };
10
10
  /**
11
- * A better version of **test.each**
11
+ * Runs parameterized tests with strict equality checks across multiple cases.
12
12
  *
13
- * Type parameters
13
+ * @param func - Function to test.
14
+ * @param transform - Optional transformer applied to the return value.
14
15
  *
15
- * @type A Parameters of the function, extends Array type
16
- * @type R ReturnType of the function
17
- * @param func The function to test
18
- * @param cases The cases to test, The invite is the first arguments. It's
19
- * an array of Array.
20
- *
21
- * - #1 The first arg is the invite of the test
22
- * - #2 The second arg is the parameters to to pass to the function. It's
23
- * an array (param array).
24
- * - #3 The third arg is the expected result
25
- *
26
- * Example: For a function like **_(arg1: string)=>any**_, the second arg
27
- * with be : **_[string]**_
28
- * @if R are not provided, the return is a function to test with TestArgs arguments
29
- *
30
- * @else It tests every cases provided
16
+ * @returns Function accepting test cases to execute.
31
17
  */
32
18
  const useEach = (func, transform) => {
33
19
  return (...cases) => useEachCases(func, transform, ...cases);
@@ -38,9 +24,12 @@ const useEachAsyncCases = (f, transform = identity, ...cases) => {
38
24
  });
39
25
  };
40
26
  /**
41
- * Same as _**useEach**_
27
+ * Runs asynchronous parameterized tests with strict equality checks across multiple cases.
28
+ *
29
+ * @param func - Async function to test.
30
+ * @param transform - Optional transformer applied to the resolved return value.
42
31
  *
43
- * But for async functions
32
+ * @returns Function accepting test cases to execute.
44
33
  */
45
34
  const useEachAsync = (func, transform) => {
46
35
  return (...cases) => useEachAsyncCases(func, transform, ...cases);
@@ -1 +1 @@
1
- {"version":3,"file":"pass.js","names":[],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\n\nimport { defaultEquality, identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type {\n _UseAsyncEach_F,\n _UseEach_F,\n UseAsyncEach_F,\n UseEach_F,\n} from './pass.types';\n\n// #region Sync\nconst useEachCases: _UseEach_F = (\n func,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n (_, args, expected, test = defaultEquality) => {\n const value = transform(func(...args));\n return test(value, expected);\n },\n );\n};\n\n/**\n * A better version of **test.each**\n *\n * Type parameters\n *\n * @type A Parameters of the function, extends Array type\n * @type R ReturnType of the function\n * @param func The function to test\n * @param cases The cases to test, The invite is the first arguments. It's\n * an array of Array.\n *\n * - #1 The first arg is the invite of the test\n * - #2 The second arg is the parameters to to pass to the function. It's\n * an array (param array).\n * - #3 The third arg is the expected result\n *\n * Example: For a function like **_(arg1: string)=>any**_, the second arg\n * with be : **_[string]**_\n * @if R are not provided, the return is a function to test with TestArgs arguments\n *\n * @else It tests every cases provided\n */\nexport const useEach: UseEach_F = (func, transform) => {\n return (...cases) => useEachCases(func, transform, ...cases);\n};\n// #endregion\n\n// #region Async\nconst useEachAsyncCases: _UseAsyncEach_F = (\n f,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n async (_, args, expected, test = defaultEquality) => {\n const _value = await f(...args);\n const value = await transform(_value);\n return test(value, expected);\n },\n );\n};\n\n/**\n * Same as _**useEach**_\n *\n * But for async functions\n */\nexport const useEachAsync: UseAsyncEach_F = (func, transform) => {\n return (...cases) => useEachAsyncCases(func, transform, ...cases);\n};\n// #endregion\n"],"mappings":";;;;AAYA,MAAM,gBACJ,MACA,YAAY,UACZ,GAAG,UACA;CACH,KAAK,WAAW,KAAK,cAAc,KAAK,CAAC,CAAC,CACxC,OACC,GAAG,MAAM,UAAU,OAAO,oBAAoB;EAE7C,OAAO,KADO,UAAU,KAAK,GAAG,IAAI,CACpB,GAAG,QAAQ;CAC7B,CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,WAAsB,MAAM,cAAc;CACrD,QAAQ,GAAG,UAAU,aAAa,MAAM,WAAW,GAAG,KAAK;AAC7D;AAIA,MAAM,qBACJ,GACA,YAAY,UACZ,GAAG,UACA;CACH,KAAK,WAAW,KAAK,cAAc,KAAK,CAAC,CAAC,CACxC,MACA,OAAO,GAAG,MAAM,UAAU,OAAO,oBAAoB;EAGnD,OAAO,KAAK,MADQ,UAAU,MADT,EAAE,GAAG,IAAI,CACM,GACjB,QAAQ;CAC7B,CACF;AACF;;;;;;AAOA,MAAa,gBAAgC,MAAM,cAAc;CAC/D,QAAQ,GAAG,UAAU,kBAAkB,MAAM,WAAW,GAAG,KAAK;AAClE"}
1
+ {"version":3,"file":"pass.js","names":[],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\n\nimport { defaultEquality, identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type {\n _UseAsyncEach_F,\n _UseEach_F,\n UseAsyncEach_F,\n UseEach_F,\n} from './pass.types';\n\n// #region Sync\nconst useEachCases: _UseEach_F = (\n func,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n (_, args, expected, test = defaultEquality) => {\n const value = transform(func(...args));\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Function to test.\n * @param transform - Optional transformer applied to the return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEach: UseEach_F = (func, transform) => {\n return (...cases) => useEachCases(func, transform, ...cases);\n};\n// #endregion\n\n// #region Async\nconst useEachAsyncCases: _UseAsyncEach_F = (\n f,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n async (_, args, expected, test = defaultEquality) => {\n const _value = await f(...args);\n const value = await transform(_value);\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs asynchronous parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Async function to test.\n * @param transform - Optional transformer applied to the resolved return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEachAsync: UseAsyncEach_F = (func, transform) => {\n return (...cases) => useEachAsyncCases(func, transform, ...cases);\n};\n\n// #endregion\n"],"mappings":";;;;AAYA,MAAM,gBACJ,MACA,YAAY,UACZ,GAAG,UACA;CACH,KAAK,WAAW,KAAK,cAAc,KAAK,CAAC,CAAC,CACxC,OACC,GAAG,MAAM,UAAU,OAAO,oBAAoB;EAE7C,OAAO,KADO,UAAU,KAAK,GAAG,IAAI,CACpB,GAAG,QAAQ;CAC7B,CACF;AACF;;;;;;;;;AAUA,MAAa,WAAsB,MAAM,cAAc;CACrD,QAAQ,GAAG,UAAU,aAAa,MAAM,WAAW,GAAG,KAAK;AAC7D;AAIA,MAAM,qBACJ,GACA,YAAY,UACZ,GAAG,UACA;CACH,KAAK,WAAW,KAAK,cAAc,KAAK,CAAC,CAAC,CACxC,MACA,OAAO,GAAG,MAAM,UAAU,OAAO,oBAAoB;EAGnD,OAAO,KAAK,MADQ,UAAU,MADT,EAAE,GAAG,IAAI,CACM,GACjB,QAAQ;CAC7B,CACF;AACF;;;;;;;;;AAUA,MAAa,gBAAgC,MAAM,cAAc;CAC/D,QAAQ,GAAG,UAAU,kBAAkB,MAAM,WAAW,GAAG,KAAK;AAClE"}
@@ -1,6 +1,30 @@
1
1
  import type { Fn } from '../../utils/bemedev/globals/types';
2
2
  import type { ChainedFn, Identity, NextFn, TestArgs } from '../types';
3
+ /**
4
+ * Runner function signature for synchronous parameterized tests.
5
+ *
6
+ * @template | {@linkcode Fn} `F` - Source function under test.
7
+ * @template | {@linkcode NextFn} `T` - Output transformer type, defaults to {@linkcode Identity}.
8
+ */
3
9
  export type _UseEach_F = <F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, transform?: T, ...cases: TestArgs<ChainedFn<F, T>>) => void;
10
+ /**
11
+ * Higher-order function returning a test runner for synchronous parameterized tests.
12
+ *
13
+ * @template | {@linkcode Fn} `F` - Source function under test.
14
+ * @template | {@linkcode NextFn} `T` - Output transformer type, defaults to {@linkcode Identity}.
15
+ */
4
16
  export type UseEach_F = <F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, transform?: T) => (...cases: TestArgs<ChainedFn<F, T>>) => void;
17
+ /**
18
+ * Runner function signature for asynchronous parameterized tests.
19
+ *
20
+ * @template | {@linkcode Fn} `F` - Source async function under test.
21
+ * @template | {@linkcode NextFn} `T` - Output transformer type, defaults to {@linkcode Identity}.
22
+ */
5
23
  export type _UseAsyncEach_F = <F extends Fn<any, Promise<any>>, T extends NextFn<F> = Identity<F>>(f: F, transform?: T, ...cases: TestArgs<ChainedFn<F, T>>) => void;
24
+ /**
25
+ * Higher-order function returning a test runner for asynchronous parameterized tests.
26
+ *
27
+ * @template | {@linkcode Fn} `F` - Source async function under test.
28
+ * @template | {@linkcode NextFn} `T` - Output transformer type, defaults to {@linkcode Identity}.
29
+ */
6
30
  export type UseAsyncEach_F = <F extends Fn<any, Promise<any>>, T extends NextFn<F> = Identity<F>>(f: F, transform?: T) => (...cases: TestArgs<ChainedFn<F, T>>) => void;
@@ -2,6 +2,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_sleep = require("../utils/sleep.cjs");
3
3
  //#region src/vitest-extended/fakeWaiter.ts
4
4
  const buildInvite = (index = 0, ms = 0, times = 1) => `#${index} Wait for ${ms}ms times ${times}`;
5
+ /**
6
+ * Creates a timer-advancing waiter function that supports both fake timers and real delays.
7
+ *
8
+ * @param vi - Vitest utilities instance of type {@linkcode VitestUtils}.
9
+ *
10
+ * @returns An asynchronous waiting function.
11
+ */
5
12
  const createFakeWaiter = (vi) => {
6
13
  return async (ms = 0, times = 1) => {
7
14
  const check = vi.isFakeTimers();
@@ -1 +1 @@
1
- {"version":3,"file":"fakeWaiter.cjs","names":["sleep"],"sources":["../../src/vitest-extended/fakeWaiter.ts"],"sourcesContent":["import type { VitestUtils } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\nexport type FakeWaiter1_F = (\n vi: VitestUtils,\n) => (ms?: number, times?: number) => Promise<void>;\n\nexport type FakeWaiter2_F = (\n vi: VitestUtils,\n ms?: number,\n) => (index: number, times?: number) => [string, () => Promise<void>];\n\nexport type FakeWaiter3_F = (\n vi: VitestUtils,\n) => (\n index: number,\n ms?: number,\n times?: number,\n) => [string, () => Promise<void>];\n\nexport type FakeWaiter = FakeWaiter1_F & {\n withDefaultDelay: FakeWaiter2_F;\n all: FakeWaiter3_F;\n};\n\nconst buildInvite = (index = 0, ms = 0, times = 1) =>\n `#${index} Wait for ${ms}ms times ${times}`;\n\nexport const createFakeWaiter: FakeWaiter = vi => {\n return async (ms = 0, times = 1) => {\n const check = vi.isFakeTimers();\n for (let i = 0; i < times; i++) {\n if (check) await vi.advanceTimersByTimeAsync(ms);\n else await sleep(ms);\n }\n };\n};\n\ncreateFakeWaiter.withDefaultDelay = (vi, ms = 0) => {\n return (index, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n\ncreateFakeWaiter.all = vi => {\n return (index, ms = 0, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n"],"mappings":";;;AA0BA,MAAM,eAAe,QAAQ,GAAG,KAAK,GAAG,QAAQ,MAC9C,IAAI,MAAM,YAAY,GAAG,WAAW;AAEtC,MAAa,oBAA+B,OAAM;CAChD,OAAO,OAAO,KAAK,GAAG,QAAQ,MAAM;EAClC,MAAM,QAAQ,GAAG,aAAa;EAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,IAAI,OAAO,MAAM,GAAG,yBAAyB,EAAE;OAC1C,MAAMA,oBAAAA,MAAM,EAAE;CAEvB;AACF;AAEA,iBAAiB,oBAAoB,IAAI,KAAK,MAAM;CAClD,QAAQ,OAAO,QAAQ,MAAM;EAC3B,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF;AAEA,iBAAiB,OAAM,OAAM;CAC3B,QAAQ,OAAO,KAAK,GAAG,QAAQ,MAAM;EACnC,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF"}
1
+ {"version":3,"file":"fakeWaiter.cjs","names":["sleep"],"sources":["../../src/vitest-extended/fakeWaiter.ts"],"sourcesContent":["import type { VitestUtils } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\n/**\n * Function creating a waiter using Vitest utilities.\n *\n * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.\n *\n * @returns An async function accepting delay `ms` and repeat `times`.\n */\nexport type FakeWaiter1_F = (\n vi: VitestUtils,\n) => (ms?: number, times?: number) => Promise<void>;\n\n/**\n * Function creating a waiter with a fixed default delay.\n *\n * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.\n * @param ms - Delay in milliseconds.\n *\n * @returns A function taking index and times that returns a test invite and execution callback tuple.\n */\nexport type FakeWaiter2_F = (\n vi: VitestUtils,\n ms?: number,\n) => (index: number, times?: number) => [string, () => Promise<void>];\n\n/**\n * Function creating a waiter accepting index, delay, and repeat count.\n *\n * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.\n *\n * @returns A function taking index, ms, and times that returns a test invite and execution callback tuple.\n */\nexport type FakeWaiter3_F = (\n vi: VitestUtils,\n) => (\n index: number,\n ms?: number,\n times?: number,\n) => [string, () => Promise<void>];\n\n/**\n * Composite fake waiter function with helper properties.\n */\nexport type FakeWaiter = FakeWaiter1_F & {\n withDefaultDelay: FakeWaiter2_F;\n all: FakeWaiter3_F;\n};\n\nconst buildInvite = (index = 0, ms = 0, times = 1) =>\n `#${index} Wait for ${ms}ms times ${times}`;\n\n/**\n * Creates a timer-advancing waiter function that supports both fake timers and real delays.\n *\n * @param vi - Vitest utilities instance of type {@linkcode VitestUtils}.\n *\n * @returns An asynchronous waiting function.\n */\nexport const createFakeWaiter: FakeWaiter = vi => {\n return async (ms = 0, times = 1) => {\n const check = vi.isFakeTimers();\n for (let i = 0; i < times; i++) {\n if (check) await vi.advanceTimersByTimeAsync(ms);\n else await sleep(ms);\n }\n };\n};\n\ncreateFakeWaiter.withDefaultDelay = (vi, ms = 0) => {\n return (index, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n\ncreateFakeWaiter.all = vi => {\n return (index, ms = 0, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n"],"mappings":";;;AAmDA,MAAM,eAAe,QAAQ,GAAG,KAAK,GAAG,QAAQ,MAC9C,IAAI,MAAM,YAAY,GAAG,WAAW;;;;;;;;AAStC,MAAa,oBAA+B,OAAM;CAChD,OAAO,OAAO,KAAK,GAAG,QAAQ,MAAM;EAClC,MAAM,QAAQ,GAAG,aAAa;EAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,IAAI,OAAO,MAAM,GAAG,yBAAyB,EAAE;OAC1C,MAAMA,oBAAAA,MAAM,EAAE;CAEvB;AACF;AAEA,iBAAiB,oBAAoB,IAAI,KAAK,MAAM;CAClD,QAAQ,OAAO,QAAQ,MAAM;EAC3B,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF;AAEA,iBAAiB,OAAM,OAAM;CAC3B,QAAQ,OAAO,KAAK,GAAG,QAAQ,MAAM;EACnC,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF"}
@@ -1,9 +1,41 @@
1
1
  import type { VitestUtils } from 'vitest';
2
+ /**
3
+ * Function creating a waiter using Vitest utilities.
4
+ *
5
+ * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.
6
+ *
7
+ * @returns An async function accepting delay `ms` and repeat `times`.
8
+ */
2
9
  export type FakeWaiter1_F = (vi: VitestUtils) => (ms?: number, times?: number) => Promise<void>;
10
+ /**
11
+ * Function creating a waiter with a fixed default delay.
12
+ *
13
+ * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.
14
+ * @param ms - Delay in milliseconds.
15
+ *
16
+ * @returns A function taking index and times that returns a test invite and execution callback tuple.
17
+ */
3
18
  export type FakeWaiter2_F = (vi: VitestUtils, ms?: number) => (index: number, times?: number) => [string, () => Promise<void>];
19
+ /**
20
+ * Function creating a waiter accepting index, delay, and repeat count.
21
+ *
22
+ * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.
23
+ *
24
+ * @returns A function taking index, ms, and times that returns a test invite and execution callback tuple.
25
+ */
4
26
  export type FakeWaiter3_F = (vi: VitestUtils) => (index: number, ms?: number, times?: number) => [string, () => Promise<void>];
27
+ /**
28
+ * Composite fake waiter function with helper properties.
29
+ */
5
30
  export type FakeWaiter = FakeWaiter1_F & {
6
31
  withDefaultDelay: FakeWaiter2_F;
7
32
  all: FakeWaiter3_F;
8
33
  };
34
+ /**
35
+ * Creates a timer-advancing waiter function that supports both fake timers and real delays.
36
+ *
37
+ * @param vi - Vitest utilities instance of type {@linkcode VitestUtils}.
38
+ *
39
+ * @returns An asynchronous waiting function.
40
+ */
9
41
  export declare const createFakeWaiter: FakeWaiter;
@@ -1,6 +1,13 @@
1
1
  import { sleep } from "../utils/sleep.js";
2
2
  //#region src/vitest-extended/fakeWaiter.ts
3
3
  const buildInvite = (index = 0, ms = 0, times = 1) => `#${index} Wait for ${ms}ms times ${times}`;
4
+ /**
5
+ * Creates a timer-advancing waiter function that supports both fake timers and real delays.
6
+ *
7
+ * @param vi - Vitest utilities instance of type {@linkcode VitestUtils}.
8
+ *
9
+ * @returns An asynchronous waiting function.
10
+ */
4
11
  const createFakeWaiter = (vi) => {
5
12
  return async (ms = 0, times = 1) => {
6
13
  const check = vi.isFakeTimers();
@@ -1 +1 @@
1
- {"version":3,"file":"fakeWaiter.js","names":[],"sources":["../../src/vitest-extended/fakeWaiter.ts"],"sourcesContent":["import type { VitestUtils } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\nexport type FakeWaiter1_F = (\n vi: VitestUtils,\n) => (ms?: number, times?: number) => Promise<void>;\n\nexport type FakeWaiter2_F = (\n vi: VitestUtils,\n ms?: number,\n) => (index: number, times?: number) => [string, () => Promise<void>];\n\nexport type FakeWaiter3_F = (\n vi: VitestUtils,\n) => (\n index: number,\n ms?: number,\n times?: number,\n) => [string, () => Promise<void>];\n\nexport type FakeWaiter = FakeWaiter1_F & {\n withDefaultDelay: FakeWaiter2_F;\n all: FakeWaiter3_F;\n};\n\nconst buildInvite = (index = 0, ms = 0, times = 1) =>\n `#${index} Wait for ${ms}ms times ${times}`;\n\nexport const createFakeWaiter: FakeWaiter = vi => {\n return async (ms = 0, times = 1) => {\n const check = vi.isFakeTimers();\n for (let i = 0; i < times; i++) {\n if (check) await vi.advanceTimersByTimeAsync(ms);\n else await sleep(ms);\n }\n };\n};\n\ncreateFakeWaiter.withDefaultDelay = (vi, ms = 0) => {\n return (index, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n\ncreateFakeWaiter.all = vi => {\n return (index, ms = 0, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n"],"mappings":";;AA0BA,MAAM,eAAe,QAAQ,GAAG,KAAK,GAAG,QAAQ,MAC9C,IAAI,MAAM,YAAY,GAAG,WAAW;AAEtC,MAAa,oBAA+B,OAAM;CAChD,OAAO,OAAO,KAAK,GAAG,QAAQ,MAAM;EAClC,MAAM,QAAQ,GAAG,aAAa;EAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,IAAI,OAAO,MAAM,GAAG,yBAAyB,EAAE;OAC1C,MAAM,MAAM,EAAE;CAEvB;AACF;AAEA,iBAAiB,oBAAoB,IAAI,KAAK,MAAM;CAClD,QAAQ,OAAO,QAAQ,MAAM;EAC3B,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF;AAEA,iBAAiB,OAAM,OAAM;CAC3B,QAAQ,OAAO,KAAK,GAAG,QAAQ,MAAM;EACnC,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF"}
1
+ {"version":3,"file":"fakeWaiter.js","names":[],"sources":["../../src/vitest-extended/fakeWaiter.ts"],"sourcesContent":["import type { VitestUtils } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\n/**\n * Function creating a waiter using Vitest utilities.\n *\n * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.\n *\n * @returns An async function accepting delay `ms` and repeat `times`.\n */\nexport type FakeWaiter1_F = (\n vi: VitestUtils,\n) => (ms?: number, times?: number) => Promise<void>;\n\n/**\n * Function creating a waiter with a fixed default delay.\n *\n * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.\n * @param ms - Delay in milliseconds.\n *\n * @returns A function taking index and times that returns a test invite and execution callback tuple.\n */\nexport type FakeWaiter2_F = (\n vi: VitestUtils,\n ms?: number,\n) => (index: number, times?: number) => [string, () => Promise<void>];\n\n/**\n * Function creating a waiter accepting index, delay, and repeat count.\n *\n * @param vi - Vitest utilities object of type {@linkcode VitestUtils}.\n *\n * @returns A function taking index, ms, and times that returns a test invite and execution callback tuple.\n */\nexport type FakeWaiter3_F = (\n vi: VitestUtils,\n) => (\n index: number,\n ms?: number,\n times?: number,\n) => [string, () => Promise<void>];\n\n/**\n * Composite fake waiter function with helper properties.\n */\nexport type FakeWaiter = FakeWaiter1_F & {\n withDefaultDelay: FakeWaiter2_F;\n all: FakeWaiter3_F;\n};\n\nconst buildInvite = (index = 0, ms = 0, times = 1) =>\n `#${index} Wait for ${ms}ms times ${times}`;\n\n/**\n * Creates a timer-advancing waiter function that supports both fake timers and real delays.\n *\n * @param vi - Vitest utilities instance of type {@linkcode VitestUtils}.\n *\n * @returns An asynchronous waiting function.\n */\nexport const createFakeWaiter: FakeWaiter = vi => {\n return async (ms = 0, times = 1) => {\n const check = vi.isFakeTimers();\n for (let i = 0; i < times; i++) {\n if (check) await vi.advanceTimersByTimeAsync(ms);\n else await sleep(ms);\n }\n };\n};\n\ncreateFakeWaiter.withDefaultDelay = (vi, ms = 0) => {\n return (index, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n\ncreateFakeWaiter.all = vi => {\n return (index, ms = 0, times = 1) => {\n const invite = buildInvite(index, ms, times);\n const fn = () => createFakeWaiter(vi)(ms, times);\n return [invite, fn] as const;\n };\n};\n"],"mappings":";;AAmDA,MAAM,eAAe,QAAQ,GAAG,KAAK,GAAG,QAAQ,MAC9C,IAAI,MAAM,YAAY,GAAG,WAAW;;;;;;;;AAStC,MAAa,oBAA+B,OAAM;CAChD,OAAO,OAAO,KAAK,GAAG,QAAQ,MAAM;EAClC,MAAM,QAAQ,GAAG,aAAa;EAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,IAAI,OAAO,MAAM,GAAG,yBAAyB,EAAE;OAC1C,MAAM,MAAM,EAAE;CAEvB;AACF;AAEA,iBAAiB,oBAAoB,IAAI,KAAK,MAAM;CAClD,QAAQ,OAAO,QAAQ,MAAM;EAC3B,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF;AAEA,iBAAiB,OAAM,OAAM;CAC3B,QAAQ,OAAO,KAAK,GAAG,QAAQ,MAAM;EACnC,MAAM,SAAS,YAAY,OAAO,IAAI,KAAK;EAC3C,MAAM,WAAW,iBAAiB,EAAE,CAAC,CAAC,IAAI,KAAK;EAC/C,OAAO,CAAC,QAAQ,EAAE;CACpB;AACF"}
@@ -1,7 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/vitest-extended/fixtures/coverage.ts
3
+ /**
4
+ * Test fixture constant.
5
+ */
3
6
  const expected = "done!";
7
+ /**
8
+ * Test fixture returning a constant string.
9
+ *
10
+ * @returns Expected constant string.
11
+ */
4
12
  const noArgs = () => expected;
13
+ /**
14
+ * Test fixture adding multiple numbers together.
15
+ */
5
16
  const addMany = (...numbers) => numbers.reduce((acc, value) => acc + value, 0);
6
17
  //#endregion
7
18
  exports.addMany = addMany;
@@ -1 +1 @@
1
- {"version":3,"file":"coverage.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/coverage.ts"],"sourcesContent":["export const expected = 'done!';\n\nexport const noArgs = () => expected;\n\ntype AddMany = (...params: number[]) => number;\n\nexport const addMany: AddMany = (...numbers) =>\n numbers.reduce((acc, value) => acc + value, 0);\n"],"mappings":";;AAAA,MAAa,WAAW;AAExB,MAAa,eAAe;AAI5B,MAAa,WAAoB,GAAG,YAClC,QAAQ,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"coverage.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/coverage.ts"],"sourcesContent":["/**\n * Test fixture constant.\n */\nexport const expected = 'done!';\n\n/**\n * Test fixture returning a constant string.\n *\n * @returns Expected constant string.\n */\nexport const noArgs = () => expected;\n\ntype AddMany = (...params: number[]) => number;\n\n/**\n * Test fixture adding multiple numbers together.\n */\nexport const addMany: AddMany = (...numbers) =>\n numbers.reduce((acc, value) => acc + value, 0);\n"],"mappings":";;;;;AAGA,MAAa,WAAW;;;;;;AAOxB,MAAa,eAAe;;;;AAO5B,MAAa,WAAoB,GAAG,YAClC,QAAQ,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC"}
@@ -1,6 +1,17 @@
1
1
  //#region src/vitest-extended/fixtures/coverage.ts
2
+ /**
3
+ * Test fixture constant.
4
+ */
2
5
  const expected = "done!";
6
+ /**
7
+ * Test fixture returning a constant string.
8
+ *
9
+ * @returns Expected constant string.
10
+ */
3
11
  const noArgs = () => expected;
12
+ /**
13
+ * Test fixture adding multiple numbers together.
14
+ */
4
15
  const addMany = (...numbers) => numbers.reduce((acc, value) => acc + value, 0);
5
16
  //#endregion
6
17
  export { addMany, expected, noArgs };
@@ -1 +1 @@
1
- {"version":3,"file":"coverage.js","names":[],"sources":["../../../src/vitest-extended/fixtures/coverage.ts"],"sourcesContent":["export const expected = 'done!';\n\nexport const noArgs = () => expected;\n\ntype AddMany = (...params: number[]) => number;\n\nexport const addMany: AddMany = (...numbers) =>\n numbers.reduce((acc, value) => acc + value, 0);\n"],"mappings":";AAAA,MAAa,WAAW;AAExB,MAAa,eAAe;AAI5B,MAAa,WAAoB,GAAG,YAClC,QAAQ,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"coverage.js","names":[],"sources":["../../../src/vitest-extended/fixtures/coverage.ts"],"sourcesContent":["/**\n * Test fixture constant.\n */\nexport const expected = 'done!';\n\n/**\n * Test fixture returning a constant string.\n *\n * @returns Expected constant string.\n */\nexport const noArgs = () => expected;\n\ntype AddMany = (...params: number[]) => number;\n\n/**\n * Test fixture adding multiple numbers together.\n */\nexport const addMany: AddMany = (...numbers) =>\n numbers.reduce((acc, value) => acc + value, 0);\n"],"mappings":";;;;AAGA,MAAa,WAAW;;;;;;AAOxB,MAAa,eAAe;;;;AAO5B,MAAa,WAAoB,GAAG,YAClC,QAAQ,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC"}
@@ -1,11 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/vitest-extended/fixtures/partialCall.ts
3
3
  /**
4
- * Reducer for function with _**one object**_ parameter which
4
+ * Creates a partially applied function for a single object parameter function.
5
5
  *
6
- * @param f The function to test
7
- * @param headArgs First arguments for reducing
8
- * @returns A new function without the **_headArgs**_ provided
6
+ * @template | {@linkcode object} `T` - Partial argument shape.
7
+ * @template `U` - Full argument shape extending `T`.
8
+ * @template `R` - Return type.
9
+ *
10
+ * @param f - Target function.
11
+ * @param headArgs - Initial partial argument values.
12
+ *
13
+ * @returns Function accepting remaining arguments.
9
14
  */
10
15
  function partialCallO(f, headArgs) {
11
16
  return (remainArgs) => f({
@@ -1 +1 @@
1
- {"version":3,"file":"partialCall.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/partialCall.ts"],"sourcesContent":["/**\n * Reducer for function with _**one object**_ parameter which\n *\n * @param f The function to test\n * @param headArgs First arguments for reducing\n * @returns A new function without the **_headArgs**_ provided\n */\nexport function partialCallO<T extends object, U extends T, R>(\n f: (arg: U) => R,\n headArgs?: T,\n) {\n return (remainArgs: Omit<U, keyof T>) =>\n f({ ...remainArgs, ...headArgs } as U);\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgB,aACd,GACA,UACA;CACA,QAAQ,eACN,EAAE;EAAE,GAAG;EAAY,GAAG;CAAS,CAAM;AACzC"}
1
+ {"version":3,"file":"partialCall.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/partialCall.ts"],"sourcesContent":["/**\n * Creates a partially applied function for a single object parameter function.\n *\n * @template | {@linkcode object} `T` - Partial argument shape.\n * @template `U` - Full argument shape extending `T`.\n * @template `R` - Return type.\n *\n * @param f - Target function.\n * @param headArgs - Initial partial argument values.\n *\n * @returns Function accepting remaining arguments.\n */\nexport function partialCallO<T extends object, U extends T, R>(\n f: (arg: U) => R,\n headArgs?: T,\n) {\n return (remainArgs: Omit<U, keyof T>) =>\n f({ ...remainArgs, ...headArgs } as U);\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,aACd,GACA,UACA;CACA,QAAQ,eACN,EAAE;EAAE,GAAG;EAAY,GAAG;CAAS,CAAM;AACzC"}
@@ -1,10 +1,15 @@
1
1
  //#region src/vitest-extended/fixtures/partialCall.ts
2
2
  /**
3
- * Reducer for function with _**one object**_ parameter which
3
+ * Creates a partially applied function for a single object parameter function.
4
4
  *
5
- * @param f The function to test
6
- * @param headArgs First arguments for reducing
7
- * @returns A new function without the **_headArgs**_ provided
5
+ * @template | {@linkcode object} `T` - Partial argument shape.
6
+ * @template `U` - Full argument shape extending `T`.
7
+ * @template `R` - Return type.
8
+ *
9
+ * @param f - Target function.
10
+ * @param headArgs - Initial partial argument values.
11
+ *
12
+ * @returns Function accepting remaining arguments.
8
13
  */
9
14
  function partialCallO(f, headArgs) {
10
15
  return (remainArgs) => f({
@@ -1 +1 @@
1
- {"version":3,"file":"partialCall.js","names":[],"sources":["../../../src/vitest-extended/fixtures/partialCall.ts"],"sourcesContent":["/**\n * Reducer for function with _**one object**_ parameter which\n *\n * @param f The function to test\n * @param headArgs First arguments for reducing\n * @returns A new function without the **_headArgs**_ provided\n */\nexport function partialCallO<T extends object, U extends T, R>(\n f: (arg: U) => R,\n headArgs?: T,\n) {\n return (remainArgs: Omit<U, keyof T>) =>\n f({ ...remainArgs, ...headArgs } as U);\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,aACd,GACA,UACA;CACA,QAAQ,eACN,EAAE;EAAE,GAAG;EAAY,GAAG;CAAS,CAAM;AACzC"}
1
+ {"version":3,"file":"partialCall.js","names":[],"sources":["../../../src/vitest-extended/fixtures/partialCall.ts"],"sourcesContent":["/**\n * Creates a partially applied function for a single object parameter function.\n *\n * @template | {@linkcode object} `T` - Partial argument shape.\n * @template `U` - Full argument shape extending `T`.\n * @template `R` - Return type.\n *\n * @param f - Target function.\n * @param headArgs - Initial partial argument values.\n *\n * @returns Function accepting remaining arguments.\n */\nexport function partialCallO<T extends object, U extends T, R>(\n f: (arg: U) => R,\n headArgs?: T,\n) {\n return (remainArgs: Omit<U, keyof T>) =>\n f({ ...remainArgs, ...headArgs } as U);\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,aACd,GACA,UACA;CACA,QAAQ,eACN,EAAE;EAAE,GAAG;EAAY,GAAG;CAAS,CAAM;AACzC"}
@@ -1,8 +1,26 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/vitest-extended/fixtures/toUpper.ts
3
+ /**
4
+ * Converts a string to uppercase.
5
+ *
6
+ * @template `S` - String type.
7
+ *
8
+ * @param str - Input string.
9
+ *
10
+ * @returns Uppercase string of type `Uppercase<S>`.
11
+ */
3
12
  const _toUpper = (str) => {
4
13
  return str.toUpperCase();
5
14
  };
15
+ /**
16
+ * Converts an array of strings to uppercase.
17
+ *
18
+ * @template `S` - String array type.
19
+ *
20
+ * @param strs - Array of strings.
21
+ *
22
+ * @returns Array of uppercase strings.
23
+ */
6
24
  const toUpper = (...strs) => {
7
25
  return strs.map(_toUpper);
8
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"toUpper.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/toUpper.ts"],"sourcesContent":["export const _toUpper = <S extends string>(str: S) => {\n const out = str.toUpperCase();\n return out as Uppercase<S>;\n};\nexport const toUpper = <S extends string[]>(...strs: S) => {\n return strs.map(_toUpper);\n};\n"],"mappings":";;AAAA,MAAa,YAA8B,QAAW;CAEpD,OADY,IAAI,YACP;AACX;AACA,MAAa,WAA+B,GAAG,SAAY;CACzD,OAAO,KAAK,IAAI,QAAQ;AAC1B"}
1
+ {"version":3,"file":"toUpper.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/toUpper.ts"],"sourcesContent":["/**\n * Converts a string to uppercase.\n *\n * @template `S` - String type.\n *\n * @param str - Input string.\n *\n * @returns Uppercase string of type `Uppercase<S>`.\n */\nexport const _toUpper = <S extends string>(str: S) => {\n const out = str.toUpperCase();\n return out as Uppercase<S>;\n};\n\n/**\n * Converts an array of strings to uppercase.\n *\n * @template `S` - String array type.\n *\n * @param strs - Array of strings.\n *\n * @returns Array of uppercase strings.\n */\nexport const toUpper = <S extends string[]>(...strs: S) => {\n return strs.map(_toUpper);\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,YAA8B,QAAW;CAEpD,OADY,IAAI,YACP;AACX;;;;;;;;;;AAWA,MAAa,WAA+B,GAAG,SAAY;CACzD,OAAO,KAAK,IAAI,QAAQ;AAC1B"}
@@ -1,7 +1,25 @@
1
1
  //#region src/vitest-extended/fixtures/toUpper.ts
2
+ /**
3
+ * Converts a string to uppercase.
4
+ *
5
+ * @template `S` - String type.
6
+ *
7
+ * @param str - Input string.
8
+ *
9
+ * @returns Uppercase string of type `Uppercase<S>`.
10
+ */
2
11
  const _toUpper = (str) => {
3
12
  return str.toUpperCase();
4
13
  };
14
+ /**
15
+ * Converts an array of strings to uppercase.
16
+ *
17
+ * @template `S` - String array type.
18
+ *
19
+ * @param strs - Array of strings.
20
+ *
21
+ * @returns Array of uppercase strings.
22
+ */
5
23
  const toUpper = (...strs) => {
6
24
  return strs.map(_toUpper);
7
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"toUpper.js","names":[],"sources":["../../../src/vitest-extended/fixtures/toUpper.ts"],"sourcesContent":["export const _toUpper = <S extends string>(str: S) => {\n const out = str.toUpperCase();\n return out as Uppercase<S>;\n};\nexport const toUpper = <S extends string[]>(...strs: S) => {\n return strs.map(_toUpper);\n};\n"],"mappings":";AAAA,MAAa,YAA8B,QAAW;CAEpD,OADY,IAAI,YACP;AACX;AACA,MAAa,WAA+B,GAAG,SAAY;CACzD,OAAO,KAAK,IAAI,QAAQ;AAC1B"}
1
+ {"version":3,"file":"toUpper.js","names":[],"sources":["../../../src/vitest-extended/fixtures/toUpper.ts"],"sourcesContent":["/**\n * Converts a string to uppercase.\n *\n * @template `S` - String type.\n *\n * @param str - Input string.\n *\n * @returns Uppercase string of type `Uppercase<S>`.\n */\nexport const _toUpper = <S extends string>(str: S) => {\n const out = str.toUpperCase();\n return out as Uppercase<S>;\n};\n\n/**\n * Converts an array of strings to uppercase.\n *\n * @template `S` - String array type.\n *\n * @param strs - Array of strings.\n *\n * @returns Array of uppercase strings.\n */\nexport const toUpper = <S extends string[]>(...strs: S) => {\n return strs.map(_toUpper);\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,YAA8B,QAAW;CAEpD,OADY,IAAI,YACP;AACX;;;;;;;;;;AAWA,MAAa,WAA+B,GAAG,SAAY;CACzD,OAAO,KAAK,IAAI,QAAQ;AAC1B"}
@@ -1,5 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/vitest-extended/fixtures/vitest.ts
3
+ /**
4
+ * Flag indicating whether tests are executed within the VS Code Vitest extension.
5
+ */
3
6
  const IS_EXTENSION = process.env.VITEST_VSCODE === "true";
4
7
  //#endregion
5
8
  exports.IS_EXTENSION = IS_EXTENSION;
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/vitest.ts"],"sourcesContent":["export const IS_EXTENSION = process.env.VITEST_VSCODE === 'true';\n"],"mappings":";;AAAA,MAAa,eAAe,QAAQ,IAAI,kBAAkB"}
1
+ {"version":3,"file":"vitest.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/vitest.ts"],"sourcesContent":["/**\n * Flag indicating whether tests are executed within the VS Code Vitest extension.\n */\nexport const IS_EXTENSION = process.env.VITEST_VSCODE === 'true';\n"],"mappings":";;;;;AAGA,MAAa,eAAe,QAAQ,IAAI,kBAAkB"}
@@ -1,4 +1,7 @@
1
1
  //#region src/vitest-extended/fixtures/vitest.ts
2
+ /**
3
+ * Flag indicating whether tests are executed within the VS Code Vitest extension.
4
+ */
2
5
  const IS_EXTENSION = process.env.VITEST_VSCODE === "true";
3
6
  //#endregion
4
7
  export { IS_EXTENSION };
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.js","names":[],"sources":["../../../src/vitest-extended/fixtures/vitest.ts"],"sourcesContent":["export const IS_EXTENSION = process.env.VITEST_VSCODE === 'true';\n"],"mappings":";AAAA,MAAa,eAAe,QAAQ,IAAI,kBAAkB"}
1
+ {"version":3,"file":"vitest.js","names":[],"sources":["../../../src/vitest-extended/fixtures/vitest.ts"],"sourcesContent":["/**\n * Flag indicating whether tests are executed within the VS Code Vitest extension.\n */\nexport const IS_EXTENSION = process.env.VITEST_VSCODE === 'true';\n"],"mappings":";;;;AAGA,MAAa,eAAe,QAAQ,IAAI,kBAAkB"}
@@ -1,18 +1,40 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/vitest-extended/fixtures/zod.ts
3
+ /**
4
+ * Converts a Zod schema into a synchronous type-guard validation function.
5
+ *
6
+ * @template | {@linkcode Any} `T` - Zod schema type.
7
+ *
8
+ * @param zod - Zod schema instance.
9
+ *
10
+ * @returns Type guard validation function.
11
+ */
3
12
  const transformZodToFunction = (zod) => {
4
13
  const f = (arg) => {
5
14
  return zod.safeParse(arg).success;
6
15
  };
7
16
  return f;
8
17
  };
18
+ /**
19
+ * Alias for {@linkcode transformZodToFunction}.
20
+ */
9
21
  const transformZTF = transformZodToFunction;
22
+ /**
23
+ * Converts a Zod schema into an asynchronous boolean validation function.
24
+ *
25
+ * @param zod - Zod schema instance of type {@linkcode Any}.
26
+ *
27
+ * @returns Async validation function returning a boolean.
28
+ */
10
29
  const transformZodToFunctionAsync = (zod) => {
11
30
  const f = async (arg) => {
12
31
  return (await zod.safeParseAsync(arg)).success;
13
32
  };
14
33
  return f;
15
34
  };
35
+ /**
36
+ * Alias for {@linkcode transformZodToFunctionAsync}.
37
+ */
16
38
  const transformZTFAsync = transformZodToFunctionAsync;
17
39
  //#endregion
18
40
  exports.transformZTF = transformZTF;
@@ -1 +1 @@
1
- {"version":3,"file":"zod.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport type Any = z.ZodTypeAny;\n\nexport const transformZodToFunction = <T extends Any>(zod: T) => {\n type Z = z.infer<T>;\n\n const f = (arg: any): arg is Z => {\n return zod.safeParse(arg).success;\n };\n\n return f;\n};\n\nexport const transformZTF = transformZodToFunction;\n\nexport const transformZodToFunctionAsync = (zod: Any) => {\n const f = async (arg: any) => {\n const _zod = await zod.safeParseAsync(arg);\n return _zod.success;\n };\n\n return f;\n};\n\nexport const transformZTFAsync = transformZodToFunctionAsync;\n"],"mappings":";;AAIA,MAAa,0BAAyC,QAAW;CAG/D,MAAM,KAAK,QAAuB;EAChC,OAAO,IAAI,UAAU,GAAG,CAAC,CAAC;CAC5B;CAEA,OAAO;AACT;AAEA,MAAa,eAAe;AAE5B,MAAa,+BAA+B,QAAa;CACvD,MAAM,IAAI,OAAO,QAAa;EAE5B,QAAO,MADY,IAAI,eAAe,GAAG,EAAA,CAC7B;CACd;CAEA,OAAO;AACT;AAEA,MAAa,oBAAoB"}
1
+ {"version":3,"file":"zod.cjs","names":[],"sources":["../../../src/vitest-extended/fixtures/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Type alias for any Zod schema.\n */\nexport type Any = z.ZodTypeAny;\n\n/**\n * Converts a Zod schema into a synchronous type-guard validation function.\n *\n * @template | {@linkcode Any} `T` - Zod schema type.\n *\n * @param zod - Zod schema instance.\n *\n * @returns Type guard validation function.\n */\nexport const transformZodToFunction = <T extends Any>(zod: T) => {\n type Z = z.infer<T>;\n\n const f = (arg: any): arg is Z => {\n return zod.safeParse(arg).success;\n };\n\n return f;\n};\n\n/**\n * Alias for {@linkcode transformZodToFunction}.\n */\nexport const transformZTF = transformZodToFunction;\n\n/**\n * Converts a Zod schema into an asynchronous boolean validation function.\n *\n * @param zod - Zod schema instance of type {@linkcode Any}.\n *\n * @returns Async validation function returning a boolean.\n */\nexport const transformZodToFunctionAsync = (zod: Any) => {\n const f = async (arg: any) => {\n const _zod = await zod.safeParseAsync(arg);\n return _zod.success;\n };\n\n return f;\n};\n\n/**\n * Alias for {@linkcode transformZodToFunctionAsync}.\n */\nexport const transformZTFAsync = transformZodToFunctionAsync;\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,0BAAyC,QAAW;CAG/D,MAAM,KAAK,QAAuB;EAChC,OAAO,IAAI,UAAU,GAAG,CAAC,CAAC;CAC5B;CAEA,OAAO;AACT;;;;AAKA,MAAa,eAAe;;;;;;;;AAS5B,MAAa,+BAA+B,QAAa;CACvD,MAAM,IAAI,OAAO,QAAa;EAE5B,QAAO,MADY,IAAI,eAAe,GAAG,EAAA,CAC7B;CACd;CAEA,OAAO;AACT;;;;AAKA,MAAa,oBAAoB"}
@@ -1,17 +1,39 @@
1
1
  //#region src/vitest-extended/fixtures/zod.ts
2
+ /**
3
+ * Converts a Zod schema into a synchronous type-guard validation function.
4
+ *
5
+ * @template | {@linkcode Any} `T` - Zod schema type.
6
+ *
7
+ * @param zod - Zod schema instance.
8
+ *
9
+ * @returns Type guard validation function.
10
+ */
2
11
  const transformZodToFunction = (zod) => {
3
12
  const f = (arg) => {
4
13
  return zod.safeParse(arg).success;
5
14
  };
6
15
  return f;
7
16
  };
17
+ /**
18
+ * Alias for {@linkcode transformZodToFunction}.
19
+ */
8
20
  const transformZTF = transformZodToFunction;
21
+ /**
22
+ * Converts a Zod schema into an asynchronous boolean validation function.
23
+ *
24
+ * @param zod - Zod schema instance of type {@linkcode Any}.
25
+ *
26
+ * @returns Async validation function returning a boolean.
27
+ */
9
28
  const transformZodToFunctionAsync = (zod) => {
10
29
  const f = async (arg) => {
11
30
  return (await zod.safeParseAsync(arg)).success;
12
31
  };
13
32
  return f;
14
33
  };
34
+ /**
35
+ * Alias for {@linkcode transformZodToFunctionAsync}.
36
+ */
15
37
  const transformZTFAsync = transformZodToFunctionAsync;
16
38
  //#endregion
17
39
  export { transformZTF, transformZTFAsync, transformZodToFunction, transformZodToFunctionAsync };
@@ -1 +1 @@
1
- {"version":3,"file":"zod.js","names":[],"sources":["../../../src/vitest-extended/fixtures/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport type Any = z.ZodTypeAny;\n\nexport const transformZodToFunction = <T extends Any>(zod: T) => {\n type Z = z.infer<T>;\n\n const f = (arg: any): arg is Z => {\n return zod.safeParse(arg).success;\n };\n\n return f;\n};\n\nexport const transformZTF = transformZodToFunction;\n\nexport const transformZodToFunctionAsync = (zod: Any) => {\n const f = async (arg: any) => {\n const _zod = await zod.safeParseAsync(arg);\n return _zod.success;\n };\n\n return f;\n};\n\nexport const transformZTFAsync = transformZodToFunctionAsync;\n"],"mappings":";AAIA,MAAa,0BAAyC,QAAW;CAG/D,MAAM,KAAK,QAAuB;EAChC,OAAO,IAAI,UAAU,GAAG,CAAC,CAAC;CAC5B;CAEA,OAAO;AACT;AAEA,MAAa,eAAe;AAE5B,MAAa,+BAA+B,QAAa;CACvD,MAAM,IAAI,OAAO,QAAa;EAE5B,QAAO,MADY,IAAI,eAAe,GAAG,EAAA,CAC7B;CACd;CAEA,OAAO;AACT;AAEA,MAAa,oBAAoB"}
1
+ {"version":3,"file":"zod.js","names":[],"sources":["../../../src/vitest-extended/fixtures/zod.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Type alias for any Zod schema.\n */\nexport type Any = z.ZodTypeAny;\n\n/**\n * Converts a Zod schema into a synchronous type-guard validation function.\n *\n * @template | {@linkcode Any} `T` - Zod schema type.\n *\n * @param zod - Zod schema instance.\n *\n * @returns Type guard validation function.\n */\nexport const transformZodToFunction = <T extends Any>(zod: T) => {\n type Z = z.infer<T>;\n\n const f = (arg: any): arg is Z => {\n return zod.safeParse(arg).success;\n };\n\n return f;\n};\n\n/**\n * Alias for {@linkcode transformZodToFunction}.\n */\nexport const transformZTF = transformZodToFunction;\n\n/**\n * Converts a Zod schema into an asynchronous boolean validation function.\n *\n * @param zod - Zod schema instance of type {@linkcode Any}.\n *\n * @returns Async validation function returning a boolean.\n */\nexport const transformZodToFunctionAsync = (zod: Any) => {\n const f = async (arg: any) => {\n const _zod = await zod.safeParseAsync(arg);\n return _zod.success;\n };\n\n return f;\n};\n\n/**\n * Alias for {@linkcode transformZodToFunctionAsync}.\n */\nexport const transformZTFAsync = transformZodToFunctionAsync;\n"],"mappings":";;;;;;;;;;AAgBA,MAAa,0BAAyC,QAAW;CAG/D,MAAM,KAAK,QAAuB;EAChC,OAAO,IAAI,UAAU,GAAG,CAAC,CAAC;CAC5B;CAEA,OAAO;AACT;;;;AAKA,MAAa,eAAe;;;;;;;;AAS5B,MAAa,+BAA+B,QAAa;CACvD,MAAM,IAAI,OAAO,QAAa;EAE5B,QAAO,MADY,IAAI,eAAe,GAAG,EAAA,CAC7B;CACd;CAEA,OAAO;AACT;;;;AAKA,MAAa,oBAAoB"}