@bemedev/dev-utils 0.8.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/README.md +2 -8
  2. package/lib/build-tests/addTarball.cjs.map +1 -1
  3. package/lib/build-tests/addTarball.d.ts +1 -1
  4. package/lib/build-tests/addTarball.js.map +1 -1
  5. package/lib/build-tests/buildPackageJson.cjs.map +1 -1
  6. package/lib/build-tests/buildPackageJson.d.ts +3 -3
  7. package/lib/build-tests/buildPackageJson.js.map +1 -1
  8. package/lib/build-tests/cleanup.cjs.map +1 -1
  9. package/lib/build-tests/cleanup.d.ts +1 -1
  10. package/lib/build-tests/cleanup.js.map +1 -1
  11. package/lib/build-tests/cli/cli.cjs +0 -1
  12. package/lib/build-tests/cli/cli.cjs.map +1 -1
  13. package/lib/build-tests/cli/cli.d.ts +1 -51
  14. package/lib/build-tests/cli/cli.js.map +1 -1
  15. package/lib/build-tests/cli/index.cjs +0 -1
  16. package/lib/build-tests/cli/index.cjs.map +1 -1
  17. package/lib/build-tests/cli/index.d.ts +0 -1
  18. package/lib/build-tests/cli/index.js.map +1 -1
  19. package/lib/build-tests/cli/post.cjs +0 -1
  20. package/lib/build-tests/cli/post.cjs.map +1 -1
  21. package/lib/build-tests/cli/post.d.ts +1 -5
  22. package/lib/build-tests/cli/post.js.map +1 -1
  23. package/lib/build-tests/cli/pre.cjs +0 -1
  24. package/lib/build-tests/cli/pre.cjs.map +1 -1
  25. package/lib/build-tests/cli/pre.d.ts +1 -5
  26. package/lib/build-tests/cli/pre.js.map +1 -1
  27. package/lib/build-tests/cli/test.cjs.map +1 -1
  28. package/lib/build-tests/cli/test.d.ts +1 -15
  29. package/lib/build-tests/cli/test.js.map +1 -1
  30. package/lib/build-tests/constants.cjs +2 -0
  31. package/lib/build-tests/constants.cjs.map +1 -1
  32. package/lib/build-tests/constants.d.ts +2 -1
  33. package/lib/build-tests/constants.js +2 -1
  34. package/lib/build-tests/constants.js.map +1 -1
  35. package/lib/build-tests/getRelativePath.cjs +0 -1
  36. package/lib/build-tests/getRelativePath.cjs.map +1 -1
  37. package/lib/build-tests/getRelativePath.d.ts +1 -1
  38. package/lib/build-tests/getRelativePath.js.map +1 -1
  39. package/lib/build-tests/getTypescriptOutdir.cjs +2 -5
  40. package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
  41. package/lib/build-tests/getTypescriptOutdir.d.ts +1 -1
  42. package/lib/build-tests/getTypescriptOutdir.js +4 -6
  43. package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
  44. package/lib/build-tests/import.cjs.map +1 -1
  45. package/lib/build-tests/import.d.ts +2 -2
  46. package/lib/build-tests/import.js.map +1 -1
  47. package/lib/build-tests/imports/create.cjs +0 -1
  48. package/lib/build-tests/imports/create.cjs.map +1 -1
  49. package/lib/build-tests/imports/create.d.ts +3 -3
  50. package/lib/build-tests/imports/create.js.map +1 -1
  51. package/lib/build-tests/imports/helper.cjs +0 -1
  52. package/lib/build-tests/imports/helper.cjs.map +1 -1
  53. package/lib/build-tests/imports/helper.d.ts +3 -7
  54. package/lib/build-tests/imports/helper.js.map +1 -1
  55. package/lib/build-tests/imports/index.d.ts +1 -1
  56. package/lib/build-tests/index.d.ts +5 -5
  57. package/lib/build-tests/pack.cjs.map +1 -1
  58. package/lib/build-tests/pack.d.ts +1 -1
  59. package/lib/build-tests/pack.js.map +1 -1
  60. package/lib/rolldown-config/config.cjs +6 -11
  61. package/lib/rolldown-config/config.cjs.map +1 -1
  62. package/lib/rolldown-config/config.d.ts +1 -1
  63. package/lib/rolldown-config/config.js +1 -5
  64. package/lib/rolldown-config/config.js.map +1 -1
  65. package/lib/rolldown-config/constants.cjs.map +1 -1
  66. package/lib/rolldown-config/constants.d.ts +5 -5
  67. package/lib/rolldown-config/constants.js.map +1 -1
  68. package/lib/rolldown-config/helpers.cjs +0 -1
  69. package/lib/rolldown-config/helpers.cjs.map +1 -1
  70. package/lib/rolldown-config/helpers.d.ts +2 -2
  71. package/lib/rolldown-config/helpers.js.map +1 -1
  72. package/lib/rolldown-config/index.d.ts +3 -3
  73. package/lib/rolldown-config/input.cjs +1 -2
  74. package/lib/rolldown-config/input.cjs.map +1 -1
  75. package/lib/rolldown-config/input.d.ts +1 -1
  76. package/lib/rolldown-config/input.js +1 -1
  77. package/lib/rolldown-config/input.js.map +1 -1
  78. package/lib/rolldown-config/output.cjs.map +1 -1
  79. package/lib/rolldown-config/output.d.ts +1 -15
  80. package/lib/rolldown-config/output.js.map +1 -1
  81. package/lib/rolldown-config/plugins/circulars.cjs +6 -5
  82. package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
  83. package/lib/rolldown-config/plugins/circulars.d.ts +9 -7
  84. package/lib/rolldown-config/plugins/circulars.js +5 -3
  85. package/lib/rolldown-config/plugins/circulars.js.map +1 -1
  86. package/lib/rolldown-config/plugins/clean.cjs +4 -9
  87. package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
  88. package/lib/rolldown-config/plugins/clean.d.ts +4 -13
  89. package/lib/rolldown-config/plugins/clean.js +4 -7
  90. package/lib/rolldown-config/plugins/clean.js.map +1 -1
  91. package/lib/rolldown-config/plugins/externals.cjs +1 -1
  92. package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
  93. package/lib/rolldown-config/plugins/externals.d.ts +7 -6
  94. package/lib/rolldown-config/plugins/externals.js +1 -0
  95. package/lib/rolldown-config/plugins/externals.js.map +1 -1
  96. package/lib/rolldown-config/plugins/index.cjs +1 -8
  97. package/lib/rolldown-config/plugins/index.cjs.map +1 -1
  98. package/lib/rolldown-config/plugins/index.d.ts +2 -27
  99. package/lib/rolldown-config/plugins/index.js +0 -6
  100. package/lib/rolldown-config/plugins/index.js.map +1 -1
  101. package/lib/rolldown-config/plugins/typescript.cjs +45 -33
  102. package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
  103. package/lib/rolldown-config/plugins/typescript.config.cjs +39 -46
  104. package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
  105. package/lib/rolldown-config/plugins/typescript.config.d.ts +4 -2
  106. package/lib/rolldown-config/plugins/typescript.config.js +41 -47
  107. package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
  108. package/lib/rolldown-config/plugins/typescript.d.ts +6 -6
  109. package/lib/rolldown-config/plugins/typescript.js +44 -30
  110. package/lib/rolldown-config/plugins/typescript.js.map +1 -1
  111. package/lib/rolldown-config/types.d.ts +13 -13
  112. package/lib/{rolldown-config/utils.cjs → utils/array.cjs} +2 -2
  113. package/lib/utils/array.cjs.map +1 -0
  114. package/lib/utils/array.d.ts +2 -0
  115. package/lib/{rolldown-config/utils.js → utils/array.js} +2 -2
  116. package/lib/utils/array.js.map +1 -0
  117. package/lib/utils/identity.d.ts +1 -1
  118. package/lib/utils/index.cjs +2 -0
  119. package/lib/utils/index.d.ts +4 -3
  120. package/lib/utils/index.js +2 -1
  121. package/lib/utils/sleep.cjs.map +1 -1
  122. package/lib/utils/sleep.d.ts +1 -1
  123. package/lib/utils/sleep.js.map +1 -1
  124. package/lib/utils/types.d.ts +5 -1
  125. package/lib/vitest-exclude/index.d.ts +1 -1
  126. package/lib/vitest-exclude/types.d.ts +8 -11
  127. package/lib/vitest-exclude/vitest.cjs +6 -9
  128. package/lib/vitest-exclude/vitest.cjs.map +1 -1
  129. package/lib/vitest-exclude/vitest.d.ts +15 -30
  130. package/lib/vitest-exclude/vitest.js +6 -9
  131. package/lib/vitest-exclude/vitest.js.map +1 -1
  132. package/lib/vitest-exclude/vitest.utils.cjs +1 -2
  133. package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
  134. package/lib/vitest-exclude/vitest.utils.d.ts +2 -2
  135. package/lib/vitest-exclude/vitest.utils.js +1 -1
  136. package/lib/vitest-exclude/vitest.utils.js.map +1 -1
  137. package/lib/vitest-extended/acceptation.cjs +1 -5
  138. package/lib/vitest-extended/acceptation.cjs.map +1 -1
  139. package/lib/vitest-extended/acceptation.d.ts +3 -7
  140. package/lib/vitest-extended/acceptation.js +1 -4
  141. package/lib/vitest-extended/acceptation.js.map +1 -1
  142. package/lib/vitest-extended/bemedev/globals/types.d.ts +4 -1
  143. package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs +4 -3
  144. package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs.map +1 -1
  145. package/lib/vitest-extended/bemedev/globals/utils/_unknown.d.ts +10 -9
  146. package/lib/vitest-extended/bemedev/globals/utils/_unknown.js +4 -3
  147. package/lib/vitest-extended/bemedev/globals/utils/_unknown.js.map +1 -1
  148. package/lib/vitest-extended/createTests.cjs +22 -24
  149. package/lib/vitest-extended/createTests.cjs.map +1 -1
  150. package/lib/vitest-extended/createTests.d.ts +34 -56
  151. package/lib/vitest-extended/createTests.js +22 -23
  152. package/lib/vitest-extended/createTests.js.map +1 -1
  153. package/lib/vitest-extended/createTests.types.d.ts +10 -6
  154. package/lib/vitest-extended/done.cjs +6 -4
  155. package/lib/vitest-extended/done.cjs.map +1 -1
  156. package/lib/vitest-extended/done.d.ts +8 -13
  157. package/lib/vitest-extended/done.js +6 -3
  158. package/lib/vitest-extended/done.js.map +1 -1
  159. package/lib/vitest-extended/each/error.cjs +0 -1
  160. package/lib/vitest-extended/each/error.cjs.map +1 -1
  161. package/lib/vitest-extended/each/error.d.ts +1 -1
  162. package/lib/vitest-extended/each/error.js.map +1 -1
  163. package/lib/vitest-extended/each/error.types.d.ts +10 -4
  164. package/lib/vitest-extended/each/index.d.ts +2 -2
  165. package/lib/vitest-extended/each/pass.cjs +13 -16
  166. package/lib/vitest-extended/each/pass.cjs.map +1 -1
  167. package/lib/vitest-extended/each/pass.d.ts +26 -28
  168. package/lib/vitest-extended/each/pass.js +13 -15
  169. package/lib/vitest-extended/each/pass.js.map +1 -1
  170. package/lib/vitest-extended/each/pass.types.d.ts +18 -6
  171. package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
  172. package/lib/vitest-extended/fakeWaiter.d.ts +3 -3
  173. package/lib/vitest-extended/fakeWaiter.js.map +1 -1
  174. package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
  175. package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
  176. package/lib/vitest-extended/fixtures/partialCall.cjs +2 -2
  177. package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
  178. package/lib/vitest-extended/fixtures/partialCall.js +2 -2
  179. package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
  180. package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
  181. package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
  182. package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
  183. package/lib/vitest-extended/fixtures/zod.js.map +1 -1
  184. package/lib/vitest-extended/identity.cjs +0 -1
  185. package/lib/vitest-extended/identity.cjs.map +1 -1
  186. package/lib/vitest-extended/identity.d.ts +2 -2
  187. package/lib/vitest-extended/identity.js.map +1 -1
  188. package/lib/vitest-extended/index.d.ts +6 -6
  189. package/lib/vitest-extended/isDefined.cjs.map +1 -1
  190. package/lib/vitest-extended/isDefined.d.ts +1 -1
  191. package/lib/vitest-extended/isDefined.js.map +1 -1
  192. package/lib/vitest-extended/isFunction.cjs.map +1 -1
  193. package/lib/vitest-extended/isFunction.d.ts +1 -1
  194. package/lib/vitest-extended/isFunction.js.map +1 -1
  195. package/lib/vitest-extended/toArray.cjs.map +1 -1
  196. package/lib/vitest-extended/toArray.d.ts +1 -1
  197. package/lib/vitest-extended/toArray.js.map +1 -1
  198. package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
  199. package/lib/vitest-extended/toStringFlat.d.ts +1 -1
  200. package/lib/vitest-extended/toStringFlat.js.map +1 -1
  201. package/lib/vitest-extended/types.d.ts +40 -42
  202. package/package.json +14 -10
  203. package/lib/rolldown-config/plugins/alias.cjs +0 -17
  204. package/lib/rolldown-config/plugins/alias.cjs.map +0 -1
  205. package/lib/rolldown-config/plugins/alias.d.ts +0 -25
  206. package/lib/rolldown-config/plugins/alias.js +0 -14
  207. package/lib/rolldown-config/plugins/alias.js.map +0 -1
  208. package/lib/rolldown-config/plugins/tsPaths.cjs +0 -17
  209. package/lib/rolldown-config/plugins/tsPaths.cjs.map +0 -1
  210. package/lib/rolldown-config/plugins/tsPaths.d.ts +0 -9
  211. package/lib/rolldown-config/plugins/tsPaths.js +0 -14
  212. package/lib/rolldown-config/plugins/tsPaths.js.map +0 -1
  213. package/lib/rolldown-config/utils.cjs.map +0 -1
  214. package/lib/rolldown-config/utils.d.ts +0 -2
  215. package/lib/rolldown-config/utils.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"_unknown.cjs","names":[],"sources":["../../../../../src/vitest-extended/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be modified.\n * Any manual changes will be overwritten during the next generation.\n *\n * @generated\n * @readonly\n * @author chlbri (bri_lvi@icloud.com)\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,YAAe,UAAoB"}
1
+ {"version":3,"file":"_unknown.cjs","names":[],"sources":["../../../../../src/vitest-extended/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
@@ -1,11 +1,12 @@
1
1
  /**
2
- * _unknown variable - Auto-generated expression
3
- *
4
- * ⚠️ WARNING: This expression is auto-generated and should not be modified.
5
- * Any manual changes will be overwritten during the next generation.
6
- *
7
- * @generated
8
- * @readonly
9
- * @author chlbri (bri_lvi@icloud.com)
10
- */
2
+ * _unknown variable - Auto-generated expression
3
+ *
4
+ * ⚠️ WARNING: This expression is auto-generated and should not be
5
+ * modified. Any manual changes will be overwritten during the next
6
+ * generation.
7
+ *
8
+ * @author chlbri (bri_lvi@icloud.com)
9
+ * @generated
10
+ * @readonly
11
+ */
11
12
  export declare const _unknown: <T>(value?: unknown) => T;
@@ -2,12 +2,13 @@
2
2
  /**
3
3
  * _unknown variable - Auto-generated expression
4
4
  *
5
- * ⚠️ WARNING: This expression is auto-generated and should not be modified.
6
- * Any manual changes will be overwritten during the next generation.
5
+ * ⚠️ WARNING: This expression is auto-generated and should not be
6
+ * modified. Any manual changes will be overwritten during the next
7
+ * generation.
7
8
  *
9
+ * @author chlbri (bri_lvi@icloud.com)
8
10
  * @generated
9
11
  * @readonly
10
- * @author chlbri (bri_lvi@icloud.com)
11
12
  */
12
13
  const _unknown = (value) => value;
13
14
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"_unknown.js","names":[],"sources":["../../../../../src/vitest-extended/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be modified.\n * Any manual changes will be overwritten during the next generation.\n *\n * @generated\n * @readonly\n * @author chlbri (bri_lvi@icloud.com)\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,YAAe,UAAoB"}
1
+ {"version":3,"file":"_unknown.js","names":[],"sources":["../../../../../src/vitest-extended/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.cjs");
3
2
  const require_vitest_extended_toStringFlat = require("./toStringFlat.cjs");
4
3
  const require_vitest_extended_acceptation = require("./acceptation.cjs");
5
4
  const require_vitest_extended_each_error = require("./each/error.cjs");
@@ -37,38 +36,37 @@ const _create = (func, transform, toError, name) => {
37
36
  };
38
37
  };
39
38
  /**
40
- * Creates tests for function in a better way
41
- * NB : We use strict-equality, {@link useEach|see}
42
- * @param library The test library
43
- * @param f The function to test
44
- * @param
45
- * @returns A test.each like function to tests many cases
46
- *
47
- * NB: If the first argument is an array, wrap the value in another array,
39
+ * Creates tests for function in a better way NB : We use strict-equality,
40
+ * {@link useEach|see}
48
41
  *
49
42
  * @example
50
- * // ./add.ts
51
- *export const add = (args: string[]) => args.reduce(
52
- * (acc, value) => {
53
- * acc+=value
54
- * return acc;
55
- * },
56
- * 0)
43
+ * // ./add.ts
44
+ * *export const add = (args: string[]) => args.reduce(
45
+ * (acc, value) => {
46
+ * acc+=value
47
+ * return acc;
48
+ * },
49
+ * 0)
57
50
  *
58
51
  *
59
- * // .add.test.ts
60
- *import { createTests } from '@bemedev/vitest-extended';
61
- *import { add } from './add';
52
+ * // .add.test.ts
53
+ * *import { createTests } from '@bemedev/vitest-extended';
54
+ * *import { add } from './add';
62
55
  *
63
- *const useTests = createTests(add)
56
+ * *const useTests = createTests(add)
64
57
  *
65
- *useTests(
58
+ * *useTests(
66
59
  * {
67
- * invite: 'For : 1,2,3,4,5,6,7,8,9',
68
- * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!
60
+ * invite: 'For : 1,2,3,4,5,6,7,8,9',
61
+ * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!
69
62
  * }
70
- *)
63
+ * )
71
64
  *
65
+ * @param library The test library
66
+ * @param f The function to test
67
+ * @param *
68
+ * @returns A test.each like function to tests many cases NB: If the first
69
+ * argument is an array, wrap the value in another array,
72
70
  */
73
71
  const createTests = (func, args) => {
74
72
  const { transform, toError } = args || {};
@@ -1 +1 @@
1
- {"version":3,"file":"createTests.cjs","names":["useTFA","useErrorAsyncEach","toStringFlat","useEachAsync","vi"],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\nimport { useTFA } from './acceptation';\nimport type { Fn } from './bemedev/globals/types';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type { _CreateTests_F };\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(\n func,\n transform as any,\n toError,\n );\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func as any, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way\n * NB : We use strict-equality, {@link useEach|see}\n * @param library The test library\n * @param f The function to test\n * @param\n * @returns A test.each like function to tests many cases\n *\n * NB: If the first argument is an array, wrap the value in another array,\n *\n * @example\n * // ./add.ts\n *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n *import { createTests } from '@bemedev/vitest-extended';\n *import { add } from './add';\n *\n *const useTests = createTests(add)\n *\n *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n *)\n *\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: {\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <F0 extends any[], F1, F2 = F1>(\n f: Fn<NoInfer<F0>, NoInfer<F1>>,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<Fn<F0, F1>> | Fn<F0, F1>;\n name: string;\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;;;AAcA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;AAClE,QAAO;EACL,mBAAmBA,oCAAAA,OAAO,MAAM,KAAK;EAErC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;AAErB,gBAAa;AAeX,WAdiBC,mCAAAA,kBACf,MACA,WACA,QAWa,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;AAGjD,YAAO;MADO,QAAA,IADKC,qCAAAA,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MACxB;MAIW,CAAC;;;EAI9B,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;AACrB,gBAAa;AAWX,WAViBC,kCAAAA,aAAa,MAAa,UAU5B,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;AAG1D,YAAO;MADO,QAAA,IADKD,qCAAAA,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAU;MAClC;MAIW,CAAC;;;EAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCH,MAAa,eACX,MACA,SAIG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,EAAE;AACzC,QAAO,QAAQ,MAAM,WAAW,QAAQ;;AAG1C,YAAY,sBACV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAOE,OAAAA,GAAG,GAAG,EAAE;AAErB,KAAI,cACF,EAAA,GAAA,OAAA,WAAU,YAAY;EACpB,MAAM,OAAO,MAAM,eAAe;AAClC,OAAK,mBAAmB,KAAK;GAC7B;AAGJ,QAAO,QAAQ,MAAM,WAAW,SAAS,KAAK;;AAGhD,YAAY,wBAAwB"}
1
+ {"version":3,"file":"createTests.cjs","names":["useTFA","useErrorAsyncEach","toStringFlat","useEachAsync","vi"],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\n\nimport { useTFA } from './acceptation';\nimport type { Fn } from './bemedev/globals/types';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type { _CreateTests_F };\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(\n func,\n transform as any,\n toError,\n );\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func as any, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way NB : We use strict-equality,\n * {@link useEach|see}\n *\n * @example\n * // ./add.ts\n * *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n * *import { createTests } from '@bemedev/vitest-extended';\n * *import { add } from './add';\n *\n * *const useTests = createTests(add)\n *\n * *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n * )\n *\n * @param library The test library\n * @param f The function to test\n * @param *\n * @returns A test.each like function to tests many cases NB: If the first\n * argument is an array, wrap the value in another array,\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: {\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <F0 extends any[], F1, F2 = F1>(\n f: Fn<NoInfer<F0>, NoInfer<F1>>,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<Fn<F0, F1>> | Fn<F0, F1>;\n name: string;\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;;AAeA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;CAClE,OAAO;EACL,mBAAmBA,oCAAAA,OAAO,MAAM,IAAI;EAEpC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;GAErB,aAAa;IAeX,OAdiBC,mCAAAA,kBACf,MACA,WACA,OAWY,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;KAGjD,OAAO;MADO,QAAA,IADKC,qCAAAA,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;KACzB;IACX,CAGsB,CAAC;GAC3B;EACF;EAEA,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;GACrB,aAAa;IAWX,OAViBC,kCAAAA,aAAa,MAAa,SAU7B,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;KAG1D,OAAO;MADO,QAAA,IADKD,qCAAAA,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;MAAU;KACnC;IACX,CAGsB,CAAC;GAC3B;EACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,eACX,MACA,SAIG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,CAAC;CACxC,OAAO,QAAQ,MAAM,WAAW,OAAO;AACzC;AAEA,YAAY,sBACV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAOE,OAAAA,GAAG,GAAG,CAAC;CAEpB,IAAI,eACF,CAAA,GAAA,OAAA,UAAA,CAAU,YAAY;EACpB,MAAM,OAAO,MAAM,cAAc;EACjC,KAAK,mBAAmB,IAAI;CAC9B,CAAC;CAGH,OAAO,QAAQ,MAAM,WAAW,SAAS,IAAI;AAC/C;AAEA,YAAY,wBAAwB"}
@@ -1,58 +1,36 @@
1
- import type { Fn } from './bemedev/globals/types';
2
- import type { _CreateTests_F } from './createTests.types';
1
+ import type { _CreateTests_F } from "./createTests.types";
3
2
  export type { _CreateTests_F };
4
3
  /**
5
- * Creates tests for function in a better way
6
- * NB : We use strict-equality, {@link useEach|see}
7
- * @param library The test library
8
- * @param f The function to test
9
- * @param
10
- * @returns A test.each like function to tests many cases
11
- *
12
- * NB: If the first argument is an array, wrap the value in another array,
13
- *
14
- * @example
15
- * // ./add.ts
16
- *export const add = (args: string[]) => args.reduce(
17
- * (acc, value) => {
18
- * acc+=value
19
- * return acc;
20
- * },
21
- * 0)
22
- *
23
- *
24
- * // .add.test.ts
25
- *import { createTests } from '@bemedev/vitest-extended';
26
- *import { add } from './add';
27
- *
28
- *const useTests = createTests(add)
29
- *
30
- *useTests(
31
- * {
32
- * invite: 'For : 1,2,3,4,5,6,7,8,9',
33
- * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!
34
- * }
35
- *)
36
- *
37
- */
38
- export declare const createTests: {
39
- <F0 extends any[], F1, F2 = F1>(func: Fn<F0, F1>, args?: {
40
- transform?: Fn<[Awaited<F1>], F2>;
41
- toError?: Fn<F0, string | undefined>;
42
- }): {
43
- acceptation: () => void;
44
- success: (...cases: import("./types").TestArgs<Fn<F0, F2>>) => () => void;
45
- fails: (...cases: import("./types").TestErrors<Fn<F0, F2>>) => () => void;
46
- };
47
- withImplementation<F0 extends any[], F1, F2 = F1>(f: Fn<NoInfer<F0>, NoInfer<F1>>, { instanciation, name, transform, toError, }: {
48
- instanciation: () => Promise<Fn<F0, F1>> | Fn<F0, F1>;
49
- name: string;
50
- transform?: Fn<[Awaited<F1>], F2>;
51
- toError?: Fn<F0, string | undefined>;
52
- }): {
53
- acceptation: () => void;
54
- success: (...cases: import("./types").TestArgs<Fn<F0, F2>>) => () => void;
55
- fails: (...cases: import("./types").TestErrors<Fn<F0, F2>>) => () => void;
56
- };
57
- withoutImplementation: /*elided*/ any;
58
- };
4
+ * Creates tests for function in a better way NB : We use strict-equality,
5
+ * {@link useEach|see}
6
+ *
7
+ * @example
8
+ * // ./add.ts
9
+ * *export const add = (args: string[]) => args.reduce(
10
+ * (acc, value) => {
11
+ * acc+=value
12
+ * return acc;
13
+ * },
14
+ * 0)
15
+ *
16
+ *
17
+ * // .add.test.ts
18
+ * *import { createTests } from '@bemedev/vitest-extended';
19
+ * *import { add } from './add';
20
+ *
21
+ * *const useTests = createTests(add)
22
+ *
23
+ * *useTests(
24
+ * {
25
+ * invite: 'For : 1,2,3,4,5,6,7,8,9',
26
+ * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!
27
+ * }
28
+ * )
29
+ *
30
+ * @param library The test library
31
+ * @param f The function to test
32
+ * @param *
33
+ * @returns A test.each like function to tests many cases NB: If the first
34
+ * argument is an array, wrap the value in another array,
35
+ */
36
+ export declare const createTests: unknown;
@@ -35,38 +35,37 @@ const _create = (func, transform, toError, name) => {
35
35
  };
36
36
  };
37
37
  /**
38
- * Creates tests for function in a better way
39
- * NB : We use strict-equality, {@link useEach|see}
40
- * @param library The test library
41
- * @param f The function to test
42
- * @param
43
- * @returns A test.each like function to tests many cases
44
- *
45
- * NB: If the first argument is an array, wrap the value in another array,
38
+ * Creates tests for function in a better way NB : We use strict-equality,
39
+ * {@link useEach|see}
46
40
  *
47
41
  * @example
48
- * // ./add.ts
49
- *export const add = (args: string[]) => args.reduce(
50
- * (acc, value) => {
51
- * acc+=value
52
- * return acc;
53
- * },
54
- * 0)
42
+ * // ./add.ts
43
+ * *export const add = (args: string[]) => args.reduce(
44
+ * (acc, value) => {
45
+ * acc+=value
46
+ * return acc;
47
+ * },
48
+ * 0)
55
49
  *
56
50
  *
57
- * // .add.test.ts
58
- *import { createTests } from '@bemedev/vitest-extended';
59
- *import { add } from './add';
51
+ * // .add.test.ts
52
+ * *import { createTests } from '@bemedev/vitest-extended';
53
+ * *import { add } from './add';
60
54
  *
61
- *const useTests = createTests(add)
55
+ * *const useTests = createTests(add)
62
56
  *
63
- *useTests(
57
+ * *useTests(
64
58
  * {
65
- * invite: 'For : 1,2,3,4,5,6,7,8,9',
66
- * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!
59
+ * invite: 'For : 1,2,3,4,5,6,7,8,9',
60
+ * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!
67
61
  * }
68
- *)
62
+ * )
69
63
  *
64
+ * @param library The test library
65
+ * @param f The function to test
66
+ * @param *
67
+ * @returns A test.each like function to tests many cases NB: If the first
68
+ * argument is an array, wrap the value in another array,
70
69
  */
71
70
  const createTests = (func, args) => {
72
71
  const { transform, toError } = args || {};
@@ -1 +1 @@
1
- {"version":3,"file":"createTests.js","names":[],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\nimport { useTFA } from './acceptation';\nimport type { Fn } from './bemedev/globals/types';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type { _CreateTests_F };\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(\n func,\n transform as any,\n toError,\n );\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func as any, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way\n * NB : We use strict-equality, {@link useEach|see}\n * @param library The test library\n * @param f The function to test\n * @param\n * @returns A test.each like function to tests many cases\n *\n * NB: If the first argument is an array, wrap the value in another array,\n *\n * @example\n * // ./add.ts\n *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n *import { createTests } from '@bemedev/vitest-extended';\n *import { add } from './add';\n *\n *const useTests = createTests(add)\n *\n *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n *)\n *\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: {\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <F0 extends any[], F1, F2 = F1>(\n f: Fn<NoInfer<F0>, NoInfer<F1>>,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<Fn<F0, F1>> | Fn<F0, F1>;\n name: string;\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;AAcA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;AAClE,QAAO;EACL,mBAAmB,OAAO,MAAM,KAAK;EAErC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;AAErB,gBAAa;AAeX,WAdiB,kBACf,MACA,WACA,QAWa,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;AAGjD,YAAO;MADO,QAAA,IADK,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MACxB;MAIW,CAAC;;;EAI9B,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;AACrB,gBAAa;AAWX,WAViB,aAAa,MAAa,UAU5B,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;AAG1D,YAAO;MADO,QAAA,IADK,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAU;MAClC;MAIW,CAAC;;;EAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCH,MAAa,eACX,MACA,SAIG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,EAAE;AACzC,QAAO,QAAQ,MAAM,WAAW,QAAQ;;AAG1C,YAAY,sBACV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAO,GAAG,GAAG,EAAE;AAErB,KAAI,cACF,WAAU,YAAY;EACpB,MAAM,OAAO,MAAM,eAAe;AAClC,OAAK,mBAAmB,KAAK;GAC7B;AAGJ,QAAO,QAAQ,MAAM,WAAW,SAAS,KAAK;;AAGhD,YAAY,wBAAwB"}
1
+ {"version":3,"file":"createTests.js","names":[],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\n\nimport { useTFA } from './acceptation';\nimport type { Fn } from './bemedev/globals/types';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type { _CreateTests_F };\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(\n func,\n transform as any,\n toError,\n );\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func as any, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way NB : We use strict-equality,\n * {@link useEach|see}\n *\n * @example\n * // ./add.ts\n * *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n * *import { createTests } from '@bemedev/vitest-extended';\n * *import { add } from './add';\n *\n * *const useTests = createTests(add)\n *\n * *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n * )\n *\n * @param library The test library\n * @param f The function to test\n * @param *\n * @returns A test.each like function to tests many cases NB: If the first\n * argument is an array, wrap the value in another array,\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: {\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <F0 extends any[], F1, F2 = F1>(\n f: Fn<NoInfer<F0>, NoInfer<F1>>,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<Fn<F0, F1>> | Fn<F0, F1>;\n name: string;\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;AAeA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;CAClE,OAAO;EACL,mBAAmB,OAAO,MAAM,IAAI;EAEpC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;GAErB,aAAa;IAeX,OAdiB,kBACf,MACA,WACA,OAWY,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;KAGjD,OAAO;MADO,QAAA,IADK,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;KACzB;IACX,CAGsB,CAAC;GAC3B;EACF;EAEA,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;GACrB,aAAa;IAWX,OAViB,aAAa,MAAa,SAU7B,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;KAG1D,OAAO;MADO,QAAA,IADK,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;MAAU;KACnC;IACX,CAGsB,CAAC;GAC3B;EACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,eACX,MACA,SAIG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,CAAC;CACxC,OAAO,QAAQ,MAAM,WAAW,OAAO;AACzC;AAEA,YAAY,sBACV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAO,GAAG,GAAG,CAAC;CAEpB,IAAI,eACF,UAAU,YAAY;EACpB,MAAM,OAAO,MAAM,cAAc;EACjC,KAAK,mBAAmB,IAAI;CAC9B,CAAC;CAGH,OAAO,QAAQ,MAAM,WAAW,SAAS,IAAI;AAC/C;AAEA,YAAY,wBAAwB"}
@@ -1,9 +1,13 @@
1
- import type { Fn } from './bemedev/globals/types';
2
- import type { TestArgs, TestErrors } from './types';
1
+ import type { Fn } from "./bemedev/globals/types";
2
+ import type { TestArgs, TestErrors } from "./types";
3
3
  type ReturnR<F extends Fn> = {
4
- acceptation: () => void;
5
- success: (...cases: TestArgs<F>) => () => void;
6
- fails: (...cases: TestErrors<F>) => () => void;
4
+ acceptation: () => void;
5
+ success: (...cases: TestArgs<F>) => () => void;
6
+ fails: (...cases: TestErrors<F>) => () => void;
7
7
  };
8
- export type _CreateTests_F = <F0 extends any[], F1, F2 = F1>(func: Fn<F0, F1>, transform?: Fn<[Awaited<F1>], F2>, toError?: Fn<F0, string | undefined>, name?: string) => ReturnR<Fn<F0, F2>>;
8
+ export type _CreateTests_F = <
9
+ F0 extends any[],
10
+ F1,
11
+ F2 = F1
12
+ >(func: Fn<F0, F1>, transform?: Fn<[Awaited<F1>], F2>, toError?: Fn<F0, string | undefined>, name?: string) => ReturnR<Fn<F0, F2>>;
9
13
  export {};
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.cjs");
3
2
  const require_utils_sleep = require("../utils/sleep.cjs");
4
3
  let vitest = require("vitest");
5
4
  //#region src/vitest-extended/done.ts
@@ -32,10 +31,11 @@ const objectify = (options) => {
32
31
  };
33
32
  /**
34
33
  * Build a test with a done function with a timeout
34
+ *
35
35
  * @param invite The description of the test
36
36
  * @param fn Where you can test, Don't async this function
37
37
  * @param options Options for the test like TestAPI from vitest
38
- * @returns a vitest test
38
+ * @returns A vitest test
39
39
  */
40
40
  const doneTest = (invite, fn, options = 100) => {
41
41
  const [_options, ms] = objectify(options);
@@ -47,10 +47,11 @@ const doneTest = (invite, fn, options = 100) => {
47
47
  };
48
48
  /**
49
49
  * Build a test that fails with a done function with a timeout
50
+ *
50
51
  * @param invite The description of the test
51
52
  * @param fn Where you can test, Don't async this function
52
53
  * @param options Options for the test like TestAPI from vitest
53
- * @returns a vitest test
54
+ * @returns A vitest test
54
55
  */
55
56
  doneTest.fails = (invite, fn, options = 100) => {
56
57
  const [_options, ms] = objectify(options);
@@ -62,10 +63,11 @@ doneTest.fails = (invite, fn, options = 100) => {
62
63
  };
63
64
  /**
64
65
  * Build a concurrent test with a done function with a timeout
66
+ *
65
67
  * @param invite The description of the test
66
68
  * @param fn Where you can test, Don't async this function
67
69
  * @param options Options for the test like TestAPI from vitest
68
- * @returns a vitest test
70
+ * @returns A vitest test
69
71
  */
70
72
  doneTest.concurrent = (invite, fn, options = 100) => {
71
73
  const [_options, ms] = objectify(options);
@@ -1 +1 @@
1
- {"version":3,"file":"done.cjs","names":["sleep","test"],"sources":["../../src/vitest-extended/done.ts"],"sourcesContent":["import { sleep } from '../utils/sleep';\nimport { expect, test, type TestOptions } from 'vitest';\nimport type { TestDoneFunction } from './types';\n\nconst useDone = (ms = 0) => {\n let executed = false;\n const done = () => (executed = true);\n\n const testDone = async () => {\n await sleep(ms);\n expect(executed).toBe(true);\n };\n\n return { done, testDone };\n};\n\nconst min100 = (ms = 0) => Math.max(100, ms);\n\n// #region Preparation\nconst getTimeout = (options?: TestOptions | number) => {\n if (typeof options === 'number') return min100(options);\n return min100(options?.timeout);\n};\n\nconst objectify = (\n options?: TestOptions | number,\n): [TestOptions, number] => {\n const _timeout = getTimeout(options);\n const timeout = _timeout + 100;\n\n let _options = { timeout };\n if (!(typeof options === 'number')) {\n _options = { ...options, timeout };\n }\n\n return [_options, _timeout];\n};\n// #endregion\n\n/**\n * Build a test with a done function with a timeout\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns a vitest test\n */\nexport const doneTest = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a test that fails with a done function with a timeout\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns a vitest test\n */\ndoneTest.fails = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.fails(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a concurrent test with a done function with a timeout\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns a vitest test\n */\ndoneTest.concurrent = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.concurrent(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n"],"mappings":";;;;;AAIA,MAAM,WAAW,KAAK,MAAM;CAC1B,IAAI,WAAW;CACf,MAAM,aAAc,WAAW;CAE/B,MAAM,WAAW,YAAY;AAC3B,QAAMA,oBAAAA,MAAM,GAAG;AACf,GAAA,GAAA,OAAA,QAAO,SAAS,CAAC,KAAK,KAAK;;AAG7B,QAAO;EAAE;EAAM;EAAU;;AAG3B,MAAM,UAAU,KAAK,MAAM,KAAK,IAAI,KAAK,GAAG;AAG5C,MAAM,cAAc,YAAmC;AACrD,KAAI,OAAO,YAAY,SAAU,QAAO,OAAO,QAAQ;AACvD,QAAO,OAAO,SAAS,QAAQ;;AAGjC,MAAM,aACJ,YAC0B;CAC1B,MAAM,WAAW,WAAW,QAAQ;CACpC,MAAM,UAAU,WAAW;CAE3B,IAAI,WAAW,EAAE,SAAS;AAC1B,KAAI,EAAE,OAAO,YAAY,UACvB,YAAW;EAAE,GAAG;EAAS;EAAS;AAGpC,QAAO,CAAC,UAAU,SAAS;;;;;;;;;AAW7B,MAAa,YACX,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,QAAQ;AAEzC,SAAA,GAAA,OAAA,MAAY,QAAQ,gBAAgB;EAClC,MAAM,EAAE,MAAM,aAAa,QAAQ,GAAG;AACtC,KAAG,KAAK;AACR,SAAO,UAAU;GACjB;;;;;;;;;AAUJ,SAAS,SACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,QAAQ;AAEzC,QAAOC,OAAAA,KAAK,MAAM,QAAQ,gBAAgB;EACxC,MAAM,EAAE,MAAM,aAAa,QAAQ,GAAG;AACtC,KAAG,KAAK;AACR,SAAO,UAAU;GACjB;;;;;;;;;AAUJ,SAAS,cACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,QAAQ;AAEzC,QAAOA,OAAAA,KAAK,WAAW,QAAQ,gBAAgB;EAC7C,MAAM,EAAE,MAAM,aAAa,QAAQ,GAAG;AACtC,KAAG,KAAK;AACR,SAAO,UAAU;GACjB"}
1
+ {"version":3,"file":"done.cjs","names":["sleep","test"],"sources":["../../src/vitest-extended/done.ts"],"sourcesContent":["import { expect, test, type TestOptions } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\nimport type { TestDoneFunction } from './types';\n\nconst useDone = (ms = 0) => {\n let executed = false;\n const done = () => (executed = true);\n\n const testDone = async () => {\n await sleep(ms);\n expect(executed).toBe(true);\n };\n\n return { done, testDone };\n};\n\nconst min100 = (ms = 0) => Math.max(100, ms);\n\n// #region Preparation\nconst getTimeout = (options?: TestOptions | number) => {\n if (typeof options === 'number') return min100(options);\n return min100(options?.timeout);\n};\n\nconst objectify = (\n options?: TestOptions | number,\n): [TestOptions, number] => {\n const _timeout = getTimeout(options);\n const timeout = _timeout + 100;\n\n let _options = { timeout };\n if (!(typeof options === 'number')) {\n _options = { ...options, timeout };\n }\n\n return [_options, _timeout];\n};\n// #endregion\n\n/**\n * Build a test with a done function with a timeout\n *\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns A vitest test\n */\nexport const doneTest = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a test that fails with a done function with a timeout\n *\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns A vitest test\n */\ndoneTest.fails = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.fails(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a concurrent test with a done function with a timeout\n *\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns A vitest test\n */\ndoneTest.concurrent = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.concurrent(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n"],"mappings":";;;;AAMA,MAAM,WAAW,KAAK,MAAM;CAC1B,IAAI,WAAW;CACf,MAAM,aAAc,WAAW;CAE/B,MAAM,WAAW,YAAY;EAC3B,MAAMA,oBAAAA,MAAM,EAAE;EACd,CAAA,GAAA,OAAA,OAAA,CAAO,QAAQ,CAAC,CAAC,KAAK,IAAI;CAC5B;CAEA,OAAO;EAAE;EAAM;CAAS;AAC1B;AAEA,MAAM,UAAU,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AAG3C,MAAM,cAAc,YAAmC;CACrD,IAAI,OAAO,YAAY,UAAU,OAAO,OAAO,OAAO;CACtD,OAAO,OAAO,SAAS,OAAO;AAChC;AAEA,MAAM,aACJ,YAC0B;CAC1B,MAAM,WAAW,WAAW,OAAO;CACnC,MAAM,UAAU,WAAW;CAE3B,IAAI,WAAW,EAAE,QAAQ;CACzB,IAAI,EAAE,OAAO,YAAY,WACvB,WAAW;EAAE,GAAG;EAAS;CAAQ;CAGnC,OAAO,CAAC,UAAU,QAAQ;AAC5B;;;;;;;;;AAWA,MAAa,YACX,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,QAAA,GAAA,OAAA,KAAA,CAAY,QAAQ,gBAAgB;EAClC,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH;;;;;;;;;AAUA,SAAS,SACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,OAAOC,OAAAA,KAAK,MAAM,QAAQ,gBAAgB;EACxC,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH;;;;;;;;;AAUA,SAAS,cACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,OAAOA,OAAAA,KAAK,WAAW,QAAQ,gBAAgB;EAC7C,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH"}
@@ -1,14 +1,9 @@
1
- import { type TestOptions } from 'vitest';
2
- import type { TestDoneFunction } from './types';
3
1
  /**
4
- * Build a test with a done function with a timeout
5
- * @param invite The description of the test
6
- * @param fn Where you can test, Don't async this function
7
- * @param options Options for the test like TestAPI from vitest
8
- * @returns a vitest test
9
- */
10
- export declare const doneTest: {
11
- (invite: string, fn: TestDoneFunction, options?: number | TestOptions): void;
12
- fails(invite: string, fn: TestDoneFunction, options?: number | TestOptions): void;
13
- concurrent(invite: string, fn: TestDoneFunction, options?: number | TestOptions): void;
14
- };
2
+ * Build a test with a done function with a timeout
3
+ *
4
+ * @param invite The description of the test
5
+ * @param fn Where you can test, Don't async this function
6
+ * @param options Options for the test like TestAPI from vitest
7
+ * @returns A vitest test
8
+ */
9
+ export declare const doneTest: unknown;
@@ -30,10 +30,11 @@ const objectify = (options) => {
30
30
  };
31
31
  /**
32
32
  * Build a test with a done function with a timeout
33
+ *
33
34
  * @param invite The description of the test
34
35
  * @param fn Where you can test, Don't async this function
35
36
  * @param options Options for the test like TestAPI from vitest
36
- * @returns a vitest test
37
+ * @returns A vitest test
37
38
  */
38
39
  const doneTest = (invite, fn, options = 100) => {
39
40
  const [_options, ms] = objectify(options);
@@ -45,10 +46,11 @@ const doneTest = (invite, fn, options = 100) => {
45
46
  };
46
47
  /**
47
48
  * Build a test that fails with a done function with a timeout
49
+ *
48
50
  * @param invite The description of the test
49
51
  * @param fn Where you can test, Don't async this function
50
52
  * @param options Options for the test like TestAPI from vitest
51
- * @returns a vitest test
53
+ * @returns A vitest test
52
54
  */
53
55
  doneTest.fails = (invite, fn, options = 100) => {
54
56
  const [_options, ms] = objectify(options);
@@ -60,10 +62,11 @@ doneTest.fails = (invite, fn, options = 100) => {
60
62
  };
61
63
  /**
62
64
  * Build a concurrent test with a done function with a timeout
65
+ *
63
66
  * @param invite The description of the test
64
67
  * @param fn Where you can test, Don't async this function
65
68
  * @param options Options for the test like TestAPI from vitest
66
- * @returns a vitest test
69
+ * @returns A vitest test
67
70
  */
68
71
  doneTest.concurrent = (invite, fn, options = 100) => {
69
72
  const [_options, ms] = objectify(options);
@@ -1 +1 @@
1
- {"version":3,"file":"done.js","names":[],"sources":["../../src/vitest-extended/done.ts"],"sourcesContent":["import { sleep } from '../utils/sleep';\nimport { expect, test, type TestOptions } from 'vitest';\nimport type { TestDoneFunction } from './types';\n\nconst useDone = (ms = 0) => {\n let executed = false;\n const done = () => (executed = true);\n\n const testDone = async () => {\n await sleep(ms);\n expect(executed).toBe(true);\n };\n\n return { done, testDone };\n};\n\nconst min100 = (ms = 0) => Math.max(100, ms);\n\n// #region Preparation\nconst getTimeout = (options?: TestOptions | number) => {\n if (typeof options === 'number') return min100(options);\n return min100(options?.timeout);\n};\n\nconst objectify = (\n options?: TestOptions | number,\n): [TestOptions, number] => {\n const _timeout = getTimeout(options);\n const timeout = _timeout + 100;\n\n let _options = { timeout };\n if (!(typeof options === 'number')) {\n _options = { ...options, timeout };\n }\n\n return [_options, _timeout];\n};\n// #endregion\n\n/**\n * Build a test with a done function with a timeout\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns a vitest test\n */\nexport const doneTest = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a test that fails with a done function with a timeout\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns a vitest test\n */\ndoneTest.fails = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.fails(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a concurrent test with a done function with a timeout\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns a vitest test\n */\ndoneTest.concurrent = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.concurrent(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n"],"mappings":";;;AAIA,MAAM,WAAW,KAAK,MAAM;CAC1B,IAAI,WAAW;CACf,MAAM,aAAc,WAAW;CAE/B,MAAM,WAAW,YAAY;AAC3B,QAAM,MAAM,GAAG;AACf,SAAO,SAAS,CAAC,KAAK,KAAK;;AAG7B,QAAO;EAAE;EAAM;EAAU;;AAG3B,MAAM,UAAU,KAAK,MAAM,KAAK,IAAI,KAAK,GAAG;AAG5C,MAAM,cAAc,YAAmC;AACrD,KAAI,OAAO,YAAY,SAAU,QAAO,OAAO,QAAQ;AACvD,QAAO,OAAO,SAAS,QAAQ;;AAGjC,MAAM,aACJ,YAC0B;CAC1B,MAAM,WAAW,WAAW,QAAQ;CACpC,MAAM,UAAU,WAAW;CAE3B,IAAI,WAAW,EAAE,SAAS;AAC1B,KAAI,EAAE,OAAO,YAAY,UACvB,YAAW;EAAE,GAAG;EAAS;EAAS;AAGpC,QAAO,CAAC,UAAU,SAAS;;;;;;;;;AAW7B,MAAa,YACX,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,QAAQ;AAEzC,QAAO,KAAK,QAAQ,gBAAgB;EAClC,MAAM,EAAE,MAAM,aAAa,QAAQ,GAAG;AACtC,KAAG,KAAK;AACR,SAAO,UAAU;GACjB;;;;;;;;;AAUJ,SAAS,SACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,QAAQ;AAEzC,QAAO,KAAK,MAAM,QAAQ,gBAAgB;EACxC,MAAM,EAAE,MAAM,aAAa,QAAQ,GAAG;AACtC,KAAG,KAAK;AACR,SAAO,UAAU;GACjB;;;;;;;;;AAUJ,SAAS,cACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,QAAQ;AAEzC,QAAO,KAAK,WAAW,QAAQ,gBAAgB;EAC7C,MAAM,EAAE,MAAM,aAAa,QAAQ,GAAG;AACtC,KAAG,KAAK;AACR,SAAO,UAAU;GACjB"}
1
+ {"version":3,"file":"done.js","names":[],"sources":["../../src/vitest-extended/done.ts"],"sourcesContent":["import { expect, test, type TestOptions } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\nimport type { TestDoneFunction } from './types';\n\nconst useDone = (ms = 0) => {\n let executed = false;\n const done = () => (executed = true);\n\n const testDone = async () => {\n await sleep(ms);\n expect(executed).toBe(true);\n };\n\n return { done, testDone };\n};\n\nconst min100 = (ms = 0) => Math.max(100, ms);\n\n// #region Preparation\nconst getTimeout = (options?: TestOptions | number) => {\n if (typeof options === 'number') return min100(options);\n return min100(options?.timeout);\n};\n\nconst objectify = (\n options?: TestOptions | number,\n): [TestOptions, number] => {\n const _timeout = getTimeout(options);\n const timeout = _timeout + 100;\n\n let _options = { timeout };\n if (!(typeof options === 'number')) {\n _options = { ...options, timeout };\n }\n\n return [_options, _timeout];\n};\n// #endregion\n\n/**\n * Build a test with a done function with a timeout\n *\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns A vitest test\n */\nexport const doneTest = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a test that fails with a done function with a timeout\n *\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns A vitest test\n */\ndoneTest.fails = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.fails(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a concurrent test with a done function with a timeout\n *\n * @param invite The description of the test\n * @param fn Where you can test, Don't async this function\n * @param options Options for the test like TestAPI from vitest\n * @returns A vitest test\n */\ndoneTest.concurrent = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.concurrent(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n"],"mappings":";;;AAMA,MAAM,WAAW,KAAK,MAAM;CAC1B,IAAI,WAAW;CACf,MAAM,aAAc,WAAW;CAE/B,MAAM,WAAW,YAAY;EAC3B,MAAM,MAAM,EAAE;EACd,OAAO,QAAQ,CAAC,CAAC,KAAK,IAAI;CAC5B;CAEA,OAAO;EAAE;EAAM;CAAS;AAC1B;AAEA,MAAM,UAAU,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AAG3C,MAAM,cAAc,YAAmC;CACrD,IAAI,OAAO,YAAY,UAAU,OAAO,OAAO,OAAO;CACtD,OAAO,OAAO,SAAS,OAAO;AAChC;AAEA,MAAM,aACJ,YAC0B;CAC1B,MAAM,WAAW,WAAW,OAAO;CACnC,MAAM,UAAU,WAAW;CAE3B,IAAI,WAAW,EAAE,QAAQ;CACzB,IAAI,EAAE,OAAO,YAAY,WACvB,WAAW;EAAE,GAAG;EAAS;CAAQ;CAGnC,OAAO,CAAC,UAAU,QAAQ;AAC5B;;;;;;;;;AAWA,MAAa,YACX,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,OAAO,KAAK,QAAQ,gBAAgB;EAClC,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH;;;;;;;;;AAUA,SAAS,SACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,OAAO,KAAK,MAAM,QAAQ,gBAAgB;EACxC,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH;;;;;;;;;AAUA,SAAS,cACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,OAAO,KAAK,WAAW,QAAQ,gBAAgB;EAC7C,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../../_virtual/_rolldown/runtime.cjs");
3
2
  const require_vitest_extended_toArray = require("../toArray.cjs");
4
3
  const require_vitest_extended_identity = require("../identity.cjs");
5
4
  let vitest = require("vitest");
@@ -1 +1 @@
1
- {"version":3,"file":"error.cjs","names":["identity","toArrayVitest"],"sources":["../../../src/vitest-extended/each/error.ts"],"sourcesContent":["import { expect, test } from 'vitest';\nimport { identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type { _UseErrorEach_F, UseErrorEach_F } from './error.types';\n\nexport const useErrorAsyncEachCases: _UseErrorEach_F = (\n f,\n transform = identity as any,\n toError = () => undefined,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest.error(cases))(\n '%s',\n async (_, args, _error) => {\n const actual = async () => {\n const out = await f(...args);\n return transform(out);\n };\n const check = _error === undefined;\n const error = check ? toError(...args) : _error;\n\n await expect(actual).rejects.toThrowError(error);\n },\n );\n};\n\nexport const useErrorAsyncEach: UseErrorEach_F = (\n f,\n transform,\n toError,\n) => {\n return (...cases) =>\n useErrorAsyncEachCases(f, transform, toError, ...cases);\n};\n"],"mappings":";;;;;;AAKA,MAAa,0BACX,GACA,YAAYA,iCAAAA,UACZ,gBAAgB,KAAA,GAChB,GAAG,UACA;AACH,QAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,MAAM,MAAM,CAAC,CAC9C,MACA,OAAO,GAAG,MAAM,WAAW;EACzB,MAAM,SAAS,YAAY;AAEzB,UAAO,UAAU,MADC,EAAE,GAAG,KAAK,CACP;;EAGvB,MAAM,QADQ,WAAW,KAAA,IACH,QAAQ,GAAG,KAAK,GAAG;AAEzC,SAAA,GAAA,OAAA,QAAa,OAAO,CAAC,QAAQ,aAAa,MAAM;GAEnD;;AAGH,MAAa,qBACX,GACA,WACA,YACG;AACH,SAAQ,GAAG,UACT,uBAAuB,GAAG,WAAW,SAAS,GAAG,MAAM"}
1
+ {"version":3,"file":"error.cjs","names":["identity","toArrayVitest"],"sources":["../../../src/vitest-extended/each/error.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport { identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type { _UseErrorEach_F, UseErrorEach_F } from './error.types';\n\nexport const useErrorAsyncEachCases: _UseErrorEach_F = (\n f,\n transform = identity as any,\n toError = () => undefined,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest.error(cases))(\n '%s',\n async (_, args, _error) => {\n const actual = async () => {\n const out = await f(...args);\n return transform(out);\n };\n const check = _error === undefined;\n const error = check ? toError(...args) : _error;\n\n await expect(actual).rejects.toThrowError(error);\n },\n );\n};\n\nexport const useErrorAsyncEach: UseErrorEach_F = (\n f,\n transform,\n toError,\n) => {\n return (...cases) =>\n useErrorAsyncEachCases(f, transform, toError, ...cases);\n};\n"],"mappings":";;;;;AAMA,MAAa,0BACX,GACA,YAAYA,iCAAAA,UACZ,gBAAgB,KAAA,GAChB,GAAG,UACA;CACH,OAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,MAAM,KAAK,CAAC,CAAC,CAC9C,MACA,OAAO,GAAG,MAAM,WAAW;EACzB,MAAM,SAAS,YAAY;GAEzB,OAAO,UAAU,MADC,EAAE,GAAG,IAAI,CACP;EACtB;EAEA,MAAM,QADQ,WAAW,KAAA,IACH,QAAQ,GAAG,IAAI,IAAI;EAEzC,OAAA,GAAA,OAAA,OAAA,CAAa,MAAM,CAAC,CAAC,QAAQ,aAAa,KAAK;CACjD,CACF;AACF;AAEA,MAAa,qBACX,GACA,WACA,YACG;CACH,QAAQ,GAAG,UACT,uBAAuB,GAAG,WAAW,SAAS,GAAG,KAAK;AAC1D"}
@@ -1,3 +1,3 @@
1
- import type { _UseErrorEach_F, UseErrorEach_F } from './error.types';
1
+ import type { _UseErrorEach_F, UseErrorEach_F } from "./error.types";
2
2
  export declare const useErrorAsyncEachCases: _UseErrorEach_F;
3
3
  export declare const useErrorAsyncEach: UseErrorEach_F;
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","names":[],"sources":["../../../src/vitest-extended/each/error.ts"],"sourcesContent":["import { expect, test } from 'vitest';\nimport { identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type { _UseErrorEach_F, UseErrorEach_F } from './error.types';\n\nexport const useErrorAsyncEachCases: _UseErrorEach_F = (\n f,\n transform = identity as any,\n toError = () => undefined,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest.error(cases))(\n '%s',\n async (_, args, _error) => {\n const actual = async () => {\n const out = await f(...args);\n return transform(out);\n };\n const check = _error === undefined;\n const error = check ? toError(...args) : _error;\n\n await expect(actual).rejects.toThrowError(error);\n },\n );\n};\n\nexport const useErrorAsyncEach: UseErrorEach_F = (\n f,\n transform,\n toError,\n) => {\n return (...cases) =>\n useErrorAsyncEachCases(f, transform, toError, ...cases);\n};\n"],"mappings":";;;;AAKA,MAAa,0BACX,GACA,YAAY,UACZ,gBAAgB,KAAA,GAChB,GAAG,UACA;AACH,MAAK,WAAW,KAAK,cAAc,MAAM,MAAM,CAAC,CAC9C,MACA,OAAO,GAAG,MAAM,WAAW;EACzB,MAAM,SAAS,YAAY;AAEzB,UAAO,UAAU,MADC,EAAE,GAAG,KAAK,CACP;;EAGvB,MAAM,QADQ,WAAW,KAAA,IACH,QAAQ,GAAG,KAAK,GAAG;AAEzC,QAAM,OAAO,OAAO,CAAC,QAAQ,aAAa,MAAM;GAEnD;;AAGH,MAAa,qBACX,GACA,WACA,YACG;AACH,SAAQ,GAAG,UACT,uBAAuB,GAAG,WAAW,SAAS,GAAG,MAAM"}
1
+ {"version":3,"file":"error.js","names":[],"sources":["../../../src/vitest-extended/each/error.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport { identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type { _UseErrorEach_F, UseErrorEach_F } from './error.types';\n\nexport const useErrorAsyncEachCases: _UseErrorEach_F = (\n f,\n transform = identity as any,\n toError = () => undefined,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest.error(cases))(\n '%s',\n async (_, args, _error) => {\n const actual = async () => {\n const out = await f(...args);\n return transform(out);\n };\n const check = _error === undefined;\n const error = check ? toError(...args) : _error;\n\n await expect(actual).rejects.toThrowError(error);\n },\n );\n};\n\nexport const useErrorAsyncEach: UseErrorEach_F = (\n f,\n transform,\n toError,\n) => {\n return (...cases) =>\n useErrorAsyncEachCases(f, transform, toError, ...cases);\n};\n"],"mappings":";;;;AAMA,MAAa,0BACX,GACA,YAAY,UACZ,gBAAgB,KAAA,GAChB,GAAG,UACA;CACH,KAAK,WAAW,KAAK,cAAc,MAAM,KAAK,CAAC,CAAC,CAC9C,MACA,OAAO,GAAG,MAAM,WAAW;EACzB,MAAM,SAAS,YAAY;GAEzB,OAAO,UAAU,MADC,EAAE,GAAG,IAAI,CACP;EACtB;EAEA,MAAM,QADQ,WAAW,KAAA,IACH,QAAQ,GAAG,IAAI,IAAI;EAEzC,MAAM,OAAO,MAAM,CAAC,CAAC,QAAQ,aAAa,KAAK;CACjD,CACF;AACF;AAEA,MAAa,qBACX,GACA,WACA,YACG;CACH,QAAQ,GAAG,UACT,uBAAuB,GAAG,WAAW,SAAS,GAAG,KAAK;AAC1D"}
@@ -1,5 +1,11 @@
1
- import type { Fn } from '../bemedev/globals/types';
2
- import type { Identity, NextFn, TestErrors } from '../types';
1
+ import type { Fn } from "../bemedev/globals/types";
2
+ import type { Identity, NextFn, TestErrors } from "../types";
3
3
  export type ToError_F<F extends Fn> = (...params: Parameters<F>) => string | undefined;
4
- export type _UseErrorEach_F = <F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, transform?: T, toError?: ToError_F<F>, ...cases: TestErrors<F>) => void;
5
- export type UseErrorEach_F = <F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, transform?: T, toError?: ToError_F<F>) => Fn<TestErrors<F>, void>;
4
+ export type _UseErrorEach_F = <
5
+ F extends Fn,
6
+ T extends NextFn<F> = Identity<F>
7
+ >(f: F, transform?: T, toError?: ToError_F<F>, ...cases: TestErrors<F>) => void;
8
+ export type UseErrorEach_F = <
9
+ F extends Fn,
10
+ T extends NextFn<F> = Identity<F>
11
+ >(f: F, transform?: T, toError?: ToError_F<F>) => Fn<TestErrors<F>, void>;
@@ -1,2 +1,2 @@
1
- export * from './error';
2
- export * from './pass';
1
+ export * from "./error";
2
+ export * from "./pass";
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../../_virtual/_rolldown/runtime.cjs");
3
2
  const require_vitest_extended_toArray = require("../toArray.cjs");
4
3
  const require_vitest_extended_identity = require("../identity.cjs");
5
4
  let vitest = require("vitest");
@@ -16,22 +15,21 @@ const useEachCases = (func, transform = require_vitest_extended_identity.identit
16
15
  *
17
16
  * @type A Parameters of the function, extends Array type
18
17
  * @type R ReturnType of the function
19
- *
20
- * @if R are not provided, the return is a function to test with TestArgs arguments
21
- *
22
- * @else It tests every cases provided
23
- *
24
18
  * @param func The function to test
25
- * @param cases The cases to test, The invite is the first arguments.
26
- * It's an array of Array.
27
- * * #1 The first arg is the invite of the test
19
+ * @param cases The cases to test, The invite is the first arguments. It's
20
+ * an array of Array.
28
21
  *
29
- * * #2 The second arg is the parameters to to pass to the function. It's an array (param array).
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
30
26
  *
31
- * * #3 The third arg is the expected result
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
32
30
  *
33
- * Example: For a function like ***(arg1: string)=>any***, the second arg with be : ***[string]***
34
- * */
31
+ * @else It tests every cases provided
32
+ */
35
33
  const useEach = (func, transform) => {
36
34
  return (...cases) => useEachCases(func, transform, ...cases);
37
35
  };
@@ -41,11 +39,10 @@ const useEachAsyncCases = (f, transform = require_vitest_extended_identity.ident
41
39
  });
42
40
  };
43
41
  /**
44
- * Same as ***useEach***
42
+ * Same as _**useEach**_
45
43
  *
46
44
  * But for async functions
47
- *
48
- * */
45
+ */
49
46
  const useEachAsync = (func, transform) => {
50
47
  return (...cases) => useEachAsyncCases(func, transform, ...cases);
51
48
  };