@bemedev/dev-utils 0.8.3 → 1.0.1
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.
- package/README.md +8 -19
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/addTarball.d.ts +1 -1
- package/lib/build-tests/addTarball.js.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.d.ts +3 -3
- package/lib/build-tests/buildPackageJson.js.map +1 -1
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cleanup.d.ts +1 -1
- package/lib/build-tests/cleanup.js.map +1 -1
- package/lib/build-tests/cli/cli.cjs +0 -1
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/cli.d.ts +1 -51
- package/lib/build-tests/cli/cli.js.map +1 -1
- package/lib/build-tests/cli/index.cjs +0 -1
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/cli/index.d.ts +0 -1
- package/lib/build-tests/cli/index.js.map +1 -1
- package/lib/build-tests/cli/post.cjs +0 -1
- package/lib/build-tests/cli/post.cjs.map +1 -1
- package/lib/build-tests/cli/post.d.ts +1 -5
- package/lib/build-tests/cli/post.js.map +1 -1
- package/lib/build-tests/cli/pre.cjs +0 -1
- package/lib/build-tests/cli/pre.cjs.map +1 -1
- package/lib/build-tests/cli/pre.d.ts +1 -5
- package/lib/build-tests/cli/pre.js.map +1 -1
- package/lib/build-tests/cli/test.cjs.map +1 -1
- package/lib/build-tests/cli/test.d.ts +1 -15
- package/lib/build-tests/cli/test.js.map +1 -1
- package/lib/build-tests/constants.cjs.map +1 -1
- package/lib/build-tests/constants.d.ts +1 -1
- package/lib/build-tests/constants.js.map +1 -1
- package/lib/build-tests/getRelativePath.cjs +0 -1
- package/lib/build-tests/getRelativePath.cjs.map +1 -1
- package/lib/build-tests/getRelativePath.d.ts +1 -1
- package/lib/build-tests/getRelativePath.js.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.d.ts +1 -1
- package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
- package/lib/build-tests/import.cjs.map +1 -1
- package/lib/build-tests/import.d.ts +2 -2
- package/lib/build-tests/import.js.map +1 -1
- package/lib/build-tests/imports/create.cjs +0 -1
- package/lib/build-tests/imports/create.cjs.map +1 -1
- package/lib/build-tests/imports/create.d.ts +3 -3
- package/lib/build-tests/imports/create.js.map +1 -1
- package/lib/build-tests/imports/helper.cjs +0 -1
- package/lib/build-tests/imports/helper.cjs.map +1 -1
- package/lib/build-tests/imports/helper.d.ts +3 -7
- package/lib/build-tests/imports/helper.js.map +1 -1
- package/lib/build-tests/imports/index.d.ts +1 -1
- package/lib/build-tests/index.d.ts +5 -5
- package/lib/build-tests/pack.cjs.map +1 -1
- package/lib/build-tests/pack.d.ts +1 -1
- package/lib/build-tests/pack.js.map +1 -1
- package/lib/rolldown-config/config.cjs +6 -11
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.d.ts +1 -1
- package/lib/rolldown-config/config.js +1 -5
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.cjs.map +1 -1
- package/lib/rolldown-config/constants.d.ts +5 -5
- package/lib/rolldown-config/constants.js.map +1 -1
- package/lib/rolldown-config/helpers.cjs +0 -1
- package/lib/rolldown-config/helpers.cjs.map +1 -1
- package/lib/rolldown-config/helpers.d.ts +2 -2
- package/lib/rolldown-config/helpers.js.map +1 -1
- package/lib/rolldown-config/index.d.ts +3 -3
- package/lib/rolldown-config/input.cjs +1 -2
- package/lib/rolldown-config/input.cjs.map +1 -1
- package/lib/rolldown-config/input.d.ts +1 -1
- package/lib/rolldown-config/input.js +1 -1
- package/lib/rolldown-config/input.js.map +1 -1
- package/lib/rolldown-config/output.cjs.map +1 -1
- package/lib/rolldown-config/output.d.ts +1 -15
- package/lib/rolldown-config/output.js.map +1 -1
- package/lib/rolldown-config/plugins/circulars.cjs +6 -5
- package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
- package/lib/rolldown-config/plugins/circulars.d.ts +9 -7
- package/lib/rolldown-config/plugins/circulars.js +5 -3
- package/lib/rolldown-config/plugins/circulars.js.map +1 -1
- package/lib/rolldown-config/plugins/clean.cjs +4 -9
- package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
- package/lib/rolldown-config/plugins/clean.d.ts +4 -13
- package/lib/rolldown-config/plugins/clean.js +4 -7
- package/lib/rolldown-config/plugins/clean.js.map +1 -1
- package/lib/rolldown-config/plugins/externals.cjs +1 -1
- package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
- package/lib/rolldown-config/plugins/externals.d.ts +7 -6
- package/lib/rolldown-config/plugins/externals.js +1 -0
- package/lib/rolldown-config/plugins/externals.js.map +1 -1
- package/lib/rolldown-config/plugins/index.cjs +1 -8
- package/lib/rolldown-config/plugins/index.cjs.map +1 -1
- package/lib/rolldown-config/plugins/index.d.ts +2 -27
- package/lib/rolldown-config/plugins/index.js +0 -6
- package/lib/rolldown-config/plugins/index.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.cjs +45 -33
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs +39 -46
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.d.ts +4 -2
- package/lib/rolldown-config/plugins/typescript.config.js +41 -47
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.d.ts +6 -6
- package/lib/rolldown-config/plugins/typescript.js +44 -30
- package/lib/rolldown-config/plugins/typescript.js.map +1 -1
- package/lib/rolldown-config/types.d.ts +13 -13
- package/lib/{rolldown-config/utils.cjs → utils/array.cjs} +2 -2
- package/lib/utils/array.cjs.map +1 -0
- package/lib/utils/array.d.ts +2 -0
- package/lib/{rolldown-config/utils.js → utils/array.js} +2 -2
- package/lib/utils/array.js.map +1 -0
- package/lib/utils/identity.d.ts +1 -1
- package/lib/utils/index.cjs +2 -0
- package/lib/utils/index.d.ts +4 -3
- package/lib/utils/index.js +2 -1
- package/lib/utils/sleep.cjs.map +1 -1
- package/lib/utils/sleep.d.ts +1 -1
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/types.d.ts +5 -1
- package/lib/vitest-exclude/index.d.ts +1 -1
- package/lib/vitest-exclude/types.d.ts +8 -11
- package/lib/vitest-exclude/vitest.cjs +6 -9
- package/lib/vitest-exclude/vitest.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.d.ts +15 -30
- package/lib/vitest-exclude/vitest.js +6 -9
- package/lib/vitest-exclude/vitest.js.map +1 -1
- package/lib/vitest-exclude/vitest.utils.cjs +1 -2
- package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.utils.d.ts +2 -2
- package/lib/vitest-exclude/vitest.utils.js +1 -1
- package/lib/vitest-exclude/vitest.utils.js.map +1 -1
- package/lib/vitest-extended/acceptation.cjs +1 -5
- package/lib/vitest-extended/acceptation.cjs.map +1 -1
- package/lib/vitest-extended/acceptation.d.ts +3 -7
- package/lib/vitest-extended/acceptation.js +1 -4
- package/lib/vitest-extended/acceptation.js.map +1 -1
- package/lib/vitest-extended/bemedev/globals/types.d.ts +4 -1
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs +4 -3
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs.map +1 -1
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.d.ts +10 -9
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.js +4 -3
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.js.map +1 -1
- package/lib/vitest-extended/createTests.cjs +22 -24
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.d.ts +34 -56
- package/lib/vitest-extended/createTests.js +22 -23
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/lib/vitest-extended/createTests.types.d.ts +10 -6
- package/lib/vitest-extended/done.cjs +6 -4
- package/lib/vitest-extended/done.cjs.map +1 -1
- package/lib/vitest-extended/done.d.ts +8 -13
- package/lib/vitest-extended/done.js +6 -3
- package/lib/vitest-extended/done.js.map +1 -1
- package/lib/vitest-extended/each/error.cjs +0 -1
- package/lib/vitest-extended/each/error.cjs.map +1 -1
- package/lib/vitest-extended/each/error.d.ts +1 -1
- package/lib/vitest-extended/each/error.js.map +1 -1
- package/lib/vitest-extended/each/error.types.d.ts +10 -4
- package/lib/vitest-extended/each/index.d.ts +2 -2
- package/lib/vitest-extended/each/pass.cjs +13 -16
- package/lib/vitest-extended/each/pass.cjs.map +1 -1
- package/lib/vitest-extended/each/pass.d.ts +26 -28
- package/lib/vitest-extended/each/pass.js +13 -15
- package/lib/vitest-extended/each/pass.js.map +1 -1
- package/lib/vitest-extended/each/pass.types.d.ts +18 -6
- package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
- package/lib/vitest-extended/fakeWaiter.d.ts +3 -3
- package/lib/vitest-extended/fakeWaiter.js.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.cjs +2 -2
- package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.js +2 -2
- package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
- package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/zod.js.map +1 -1
- package/lib/vitest-extended/identity.cjs +0 -1
- package/lib/vitest-extended/identity.cjs.map +1 -1
- package/lib/vitest-extended/identity.d.ts +2 -2
- package/lib/vitest-extended/identity.js.map +1 -1
- package/lib/vitest-extended/index.d.ts +6 -6
- package/lib/vitest-extended/isDefined.cjs.map +1 -1
- package/lib/vitest-extended/isDefined.d.ts +1 -1
- package/lib/vitest-extended/isDefined.js.map +1 -1
- package/lib/vitest-extended/isFunction.cjs.map +1 -1
- package/lib/vitest-extended/isFunction.d.ts +1 -1
- package/lib/vitest-extended/isFunction.js.map +1 -1
- package/lib/vitest-extended/toArray.cjs.map +1 -1
- package/lib/vitest-extended/toArray.d.ts +1 -1
- package/lib/vitest-extended/toArray.js.map +1 -1
- package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
- package/lib/vitest-extended/toStringFlat.d.ts +1 -1
- package/lib/vitest-extended/toStringFlat.js.map +1 -1
- package/lib/vitest-extended/types.d.ts +40 -42
- package/package.json +14 -10
- package/lib/rolldown-config/plugins/alias.cjs +0 -17
- package/lib/rolldown-config/plugins/alias.cjs.map +0 -1
- package/lib/rolldown-config/plugins/alias.d.ts +0 -25
- package/lib/rolldown-config/plugins/alias.js +0 -14
- package/lib/rolldown-config/plugins/alias.js.map +0 -1
- package/lib/rolldown-config/plugins/tsPaths.cjs +0 -17
- package/lib/rolldown-config/plugins/tsPaths.cjs.map +0 -1
- package/lib/rolldown-config/plugins/tsPaths.d.ts +0 -9
- package/lib/rolldown-config/plugins/tsPaths.js +0 -14
- package/lib/rolldown-config/plugins/tsPaths.js.map +0 -1
- package/lib/rolldown-config/utils.cjs.map +0 -1
- package/lib/rolldown-config/utils.d.ts +0 -2
- package/lib/rolldown-config/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pass.cjs","names":["identity","toArrayVitest","defaultEquality"],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\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
|
|
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,32 +1,30 @@
|
|
|
1
|
-
import type { UseAsyncEach_F, UseEach_F } from
|
|
1
|
+
import type { UseAsyncEach_F, UseEach_F } from "./pass.types";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* */
|
|
3
|
+
* A better version of **test.each**
|
|
4
|
+
*
|
|
5
|
+
* Type parameters
|
|
6
|
+
*
|
|
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
|
|
23
|
+
*/
|
|
25
24
|
export declare const useEach: UseEach_F;
|
|
26
25
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* */
|
|
26
|
+
* Same as _**useEach**_
|
|
27
|
+
*
|
|
28
|
+
* But for async functions
|
|
29
|
+
*/
|
|
32
30
|
export declare const useEachAsync: UseAsyncEach_F;
|
|
@@ -14,22 +14,21 @@ const useEachCases = (func, transform = identity, ...cases) => {
|
|
|
14
14
|
*
|
|
15
15
|
* @type A Parameters of the function, extends Array type
|
|
16
16
|
* @type R ReturnType of the function
|
|
17
|
-
*
|
|
18
|
-
* @if R are not provided, the return is a function to test with TestArgs arguments
|
|
19
|
-
*
|
|
20
|
-
* @else It tests every cases provided
|
|
21
|
-
*
|
|
22
17
|
* @param func The function to test
|
|
23
|
-
* @param cases The cases to test, The invite is the first arguments.
|
|
24
|
-
*
|
|
25
|
-
* * #1 The first arg is the invite of the test
|
|
18
|
+
* @param cases The cases to test, The invite is the first arguments. It's
|
|
19
|
+
* an array of Array.
|
|
26
20
|
*
|
|
27
|
-
*
|
|
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
|
|
28
25
|
*
|
|
29
|
-
*
|
|
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
|
|
30
29
|
*
|
|
31
|
-
*
|
|
32
|
-
|
|
30
|
+
* @else It tests every cases provided
|
|
31
|
+
*/
|
|
33
32
|
const useEach = (func, transform) => {
|
|
34
33
|
return (...cases) => useEachCases(func, transform, ...cases);
|
|
35
34
|
};
|
|
@@ -39,11 +38,10 @@ const useEachAsyncCases = (f, transform = identity, ...cases) => {
|
|
|
39
38
|
});
|
|
40
39
|
};
|
|
41
40
|
/**
|
|
42
|
-
* Same as
|
|
41
|
+
* Same as _**useEach**_
|
|
43
42
|
*
|
|
44
43
|
* But for async functions
|
|
45
|
-
|
|
46
|
-
* */
|
|
44
|
+
*/
|
|
47
45
|
const useEachAsync = (func, transform) => {
|
|
48
46
|
return (...cases) => useEachAsyncCases(func, transform, ...cases);
|
|
49
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pass.js","names":[],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\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
|
|
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,6 +1,18 @@
|
|
|
1
|
-
import type { Fn } from
|
|
2
|
-
import type { ChainedFn, Identity, NextFn, TestArgs } from
|
|
3
|
-
export type _UseEach_F = <
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { Fn } from "../bemedev/globals/types";
|
|
2
|
+
import type { ChainedFn, Identity, NextFn, TestArgs } from "../types";
|
|
3
|
+
export type _UseEach_F = <
|
|
4
|
+
F extends Fn,
|
|
5
|
+
T extends NextFn<F> = Identity<F>
|
|
6
|
+
>(f: F, transform?: T, ...cases: TestArgs<ChainedFn<F, T>>) => void;
|
|
7
|
+
export type UseEach_F = <
|
|
8
|
+
F extends Fn,
|
|
9
|
+
T extends NextFn<F> = Identity<F>
|
|
10
|
+
>(f: F, transform?: T) => (...cases: TestArgs<ChainedFn<F, T>>) => void;
|
|
11
|
+
export type _UseAsyncEach_F = <
|
|
12
|
+
F extends Fn<any, Promise<any>>,
|
|
13
|
+
T extends NextFn<F> = Identity<F>
|
|
14
|
+
>(f: F, transform?: T, ...cases: TestArgs<ChainedFn<F, T>>) => void;
|
|
15
|
+
export type UseAsyncEach_F = <
|
|
16
|
+
F extends Fn<any, Promise<any>>,
|
|
17
|
+
T extends NextFn<F> = Identity<F>
|
|
18
|
+
>(f: F, transform?: T) => (...cases: TestArgs<ChainedFn<F, T>>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeWaiter.cjs","names":["sleep"],"sources":["../../src/vitest-extended/fakeWaiter.ts"],"sourcesContent":["import {
|
|
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,9 +1,9 @@
|
|
|
1
|
-
import type { VitestUtils } from
|
|
1
|
+
import type { VitestUtils } from "vitest";
|
|
2
2
|
export type FakeWaiter1_F = (vi: VitestUtils) => (ms?: number, times?: number) => Promise<void>;
|
|
3
3
|
export type FakeWaiter2_F = (vi: VitestUtils, ms?: number) => (index: number, times?: number) => [string, () => Promise<void>];
|
|
4
4
|
export type FakeWaiter3_F = (vi: VitestUtils) => (index: number, ms?: number, times?: number) => [string, () => Promise<void>];
|
|
5
5
|
export type FakeWaiter = FakeWaiter1_F & {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
withDefaultDelay: FakeWaiter2_F;
|
|
7
|
+
all: FakeWaiter3_F;
|
|
8
8
|
};
|
|
9
9
|
export declare const createFakeWaiter: FakeWaiter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeWaiter.js","names":[],"sources":["../../src/vitest-extended/fakeWaiter.ts"],"sourcesContent":["import {
|
|
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 +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,
|
|
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 +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,
|
|
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,11 +1,11 @@
|
|
|
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
|
|
4
|
+
* Reducer for function with _**one object**_ parameter which
|
|
5
5
|
*
|
|
6
6
|
* @param f The function to test
|
|
7
7
|
* @param headArgs First arguments for reducing
|
|
8
|
-
* @returns A new function without the
|
|
8
|
+
* @returns A new function without the **_headArgs**_ provided
|
|
9
9
|
*/
|
|
10
10
|
function partialCallO(f, headArgs) {
|
|
11
11
|
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
|
|
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,10 +1,10 @@
|
|
|
1
1
|
//#region src/vitest-extended/fixtures/partialCall.ts
|
|
2
2
|
/**
|
|
3
|
-
* Reducer for function with
|
|
3
|
+
* Reducer for function with _**one object**_ parameter which
|
|
4
4
|
*
|
|
5
5
|
* @param f The function to test
|
|
6
6
|
* @param headArgs First arguments for reducing
|
|
7
|
-
* @returns A new function without the
|
|
7
|
+
* @returns A new function without the **_headArgs**_ provided
|
|
8
8
|
*/
|
|
9
9
|
function partialCallO(f, headArgs) {
|
|
10
10
|
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
|
|
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 +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;
|
|
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 +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;
|
|
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 +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;
|
|
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 +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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.cjs","names":[],"sources":["../../src/vitest-extended/identity.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nexport const identity = <T>(value: T) => value;\n\nexport const defaultEquality = (value: any, expected: any) => {\n const checkArray = Array.isArray(value) && Array.isArray(expected);\n\n if (checkArray) {\n return expect(value.sort()).toStrictEqual(expected.sort());\n }\n return expect(value).toStrictEqual(expected);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"identity.cjs","names":[],"sources":["../../src/vitest-extended/identity.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nexport const identity = <T>(value: T) => value;\n\nexport const defaultEquality = (value: any, expected: any) => {\n const checkArray = Array.isArray(value) && Array.isArray(expected);\n\n if (checkArray) {\n return expect(value.sort()).toStrictEqual(expected.sort());\n }\n return expect(value).toStrictEqual(expected);\n};\n"],"mappings":";;;AAEA,MAAa,YAAe,UAAa;AAEzC,MAAa,mBAAmB,OAAY,aAAkB;CAG5D,IAFmB,MAAM,QAAQ,KAAK,KAAK,MAAM,QAAQ,QAAQ,GAG/D,QAAA,GAAA,OAAA,OAAA,CAAc,MAAM,KAAK,CAAC,CAAC,CAAC,cAAc,SAAS,KAAK,CAAC;CAE3D,QAAA,GAAA,OAAA,OAAA,CAAc,KAAK,CAAC,CAAC,cAAc,QAAQ;AAC7C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const identity:
|
|
2
|
-
export declare const defaultEquality:
|
|
1
|
+
export declare const identity: unknown;
|
|
2
|
+
export declare const defaultEquality: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","names":[],"sources":["../../src/vitest-extended/identity.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nexport const identity = <T>(value: T) => value;\n\nexport const defaultEquality = (value: any, expected: any) => {\n const checkArray = Array.isArray(value) && Array.isArray(expected);\n\n if (checkArray) {\n return expect(value.sort()).toStrictEqual(expected.sort());\n }\n return expect(value).toStrictEqual(expected);\n};\n"],"mappings":";;AAEA,MAAa,YAAe,UAAa;AAEzC,MAAa,mBAAmB,OAAY,aAAkB;
|
|
1
|
+
{"version":3,"file":"identity.js","names":[],"sources":["../../src/vitest-extended/identity.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nexport const identity = <T>(value: T) => value;\n\nexport const defaultEquality = (value: any, expected: any) => {\n const checkArray = Array.isArray(value) && Array.isArray(expected);\n\n if (checkArray) {\n return expect(value.sort()).toStrictEqual(expected.sort());\n }\n return expect(value).toStrictEqual(expected);\n};\n"],"mappings":";;AAEA,MAAa,YAAe,UAAa;AAEzC,MAAa,mBAAmB,OAAY,aAAkB;CAG5D,IAFmB,MAAM,QAAQ,KAAK,KAAK,MAAM,QAAQ,QAAQ,GAG/D,OAAO,OAAO,MAAM,KAAK,CAAC,CAAC,CAAC,cAAc,SAAS,KAAK,CAAC;CAE3D,OAAO,OAAO,KAAK,CAAC,CAAC,cAAc,QAAQ;AAC7C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
1
|
+
export * from "./acceptation";
|
|
2
|
+
export * from "./createTests";
|
|
3
|
+
export * from "./done";
|
|
4
|
+
export * from "./each";
|
|
5
|
+
export * from "./fakeWaiter";
|
|
6
|
+
export * from "./types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDefined.cjs","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from './bemedev/globals/types';\nexport type { Undefiny };\n\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";;AAGA,MAAa,aAAgB,UAAoC;
|
|
1
|
+
{"version":3,"file":"isDefined.cjs","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from './bemedev/globals/types';\nexport type { Undefiny };\n\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";;AAGA,MAAa,aAAgB,UAAoC;CAC/D,OAAO,UAAU,KAAA,KAAa,UAAU;AAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDefined.js","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from './bemedev/globals/types';\nexport type { Undefiny };\n\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";AAGA,MAAa,aAAgB,UAAoC;
|
|
1
|
+
{"version":3,"file":"isDefined.js","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from './bemedev/globals/types';\nexport type { Undefiny };\n\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";AAGA,MAAa,aAAgB,UAAoC;CAC/D,OAAO,UAAU,KAAA,KAAa,UAAU;AAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isFunction.cjs","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["export function isFunction(arg: any) {\n const isType = 'function' === typeof arg;\n const isInstance = arg instanceof Function;\n const isArrow =\n Object.prototype.toString.call(arg) === '[object Function]';\n\n return !!arg && (isType || isInstance || isArrow);\n}\n"],"mappings":";;AAAA,SAAgB,WAAW,KAAU;CACnC,MAAM,SAAS,eAAe,OAAO;CACrC,MAAM,aAAa,eAAe;CAClC,MAAM,UACJ,OAAO,UAAU,SAAS,KAAK,
|
|
1
|
+
{"version":3,"file":"isFunction.cjs","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["export function isFunction(arg: any) {\n const isType = 'function' === typeof arg;\n const isInstance = arg instanceof Function;\n const isArrow =\n Object.prototype.toString.call(arg) === '[object Function]';\n\n return !!arg && (isType || isInstance || isArrow);\n}\n"],"mappings":";;AAAA,SAAgB,WAAW,KAAU;CACnC,MAAM,SAAS,eAAe,OAAO;CACrC,MAAM,aAAa,eAAe;CAClC,MAAM,UACJ,OAAO,UAAU,SAAS,KAAK,GAAG,MAAM;CAE1C,OAAO,CAAC,CAAC,QAAQ,UAAU,cAAc;AAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isFunction(arg: any)
|
|
1
|
+
export declare function isFunction(arg: any);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isFunction.js","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["export function isFunction(arg: any) {\n const isType = 'function' === typeof arg;\n const isInstance = arg instanceof Function;\n const isArrow =\n Object.prototype.toString.call(arg) === '[object Function]';\n\n return !!arg && (isType || isInstance || isArrow);\n}\n"],"mappings":";AAAA,SAAgB,WAAW,KAAU;CACnC,MAAM,SAAS,eAAe,OAAO;CACrC,MAAM,aAAa,eAAe;CAClC,MAAM,UACJ,OAAO,UAAU,SAAS,KAAK,
|
|
1
|
+
{"version":3,"file":"isFunction.js","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["export function isFunction(arg: any) {\n const isType = 'function' === typeof arg;\n const isInstance = arg instanceof Function;\n const isArrow =\n Object.prototype.toString.call(arg) === '[object Function]';\n\n return !!arg && (isType || isInstance || isArrow);\n}\n"],"mappings":";AAAA,SAAgB,WAAW,KAAU;CACnC,MAAM,SAAS,eAAe,OAAO;CACrC,MAAM,aAAa,eAAe;CAClC,MAAM,UACJ,OAAO,UAAU,SAAS,KAAK,GAAG,MAAM;CAE1C,OAAO,CAAC,CAAC,QAAQ,UAAU,cAAc;AAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toArray.cjs","names":["isDefined"],"sources":["../../src/vitest-extended/toArray.ts"],"sourcesContent":["import { isDefined } from './isDefined';\nimport type { ToArrayVitest_F, ToArray_F } from './types';\n\nexport const toArrayVitest: ToArrayVitest_F = args => {\n return args.map(({ expected, invite, parameters: params, test }) => {\n const parameters = toArray(params);\n return [invite, parameters, expected, test] as any;\n });\n};\n\ntoArrayVitest.error = args => {\n return args.map(({ invite, parameters: params, error }) => {\n const parameters = toArray.generic(params);\n return [invite, parameters, error] as any;\n });\n};\n\nexport const toArray: ToArray_F = obj => {\n if (Array.isArray(obj)) {\n return obj;\n } else {\n const isNotDefined = !isDefined(obj);\n if (isNotDefined) return [];\n\n return [obj];\n }\n};\n\ntoArray.generic = obj => toArray(obj) as any;\n"],"mappings":";;;AAGA,MAAa,iBAAiC,SAAQ;
|
|
1
|
+
{"version":3,"file":"toArray.cjs","names":["isDefined"],"sources":["../../src/vitest-extended/toArray.ts"],"sourcesContent":["import { isDefined } from './isDefined';\nimport type { ToArrayVitest_F, ToArray_F } from './types';\n\nexport const toArrayVitest: ToArrayVitest_F = args => {\n return args.map(({ expected, invite, parameters: params, test }) => {\n const parameters = toArray(params);\n return [invite, parameters, expected, test] as any;\n });\n};\n\ntoArrayVitest.error = args => {\n return args.map(({ invite, parameters: params, error }) => {\n const parameters = toArray.generic(params);\n return [invite, parameters, error] as any;\n });\n};\n\nexport const toArray: ToArray_F = obj => {\n if (Array.isArray(obj)) {\n return obj;\n } else {\n const isNotDefined = !isDefined(obj);\n if (isNotDefined) return [];\n\n return [obj];\n }\n};\n\ntoArray.generic = obj => toArray(obj) as any;\n"],"mappings":";;;AAGA,MAAa,iBAAiC,SAAQ;CACpD,OAAO,KAAK,KAAK,EAAE,UAAU,QAAQ,YAAY,QAAQ,WAAW;EAElE,OAAO;GAAC;GADW,QAAQ,MACF;GAAG;GAAU;EAAI;CAC5C,CAAC;AACH;AAEA,cAAc,SAAQ,SAAQ;CAC5B,OAAO,KAAK,KAAK,EAAE,QAAQ,YAAY,QAAQ,YAAY;EAEzD,OAAO;GAAC;GADW,QAAQ,QAAQ,MACV;GAAG;EAAK;CACnC,CAAC;AACH;AAEA,MAAa,WAAqB,QAAO;CACvC,IAAI,MAAM,QAAQ,GAAG,GACnB,OAAO;MACF;EAEL,IAAI,CADkBA,kCAAAA,UAAU,GAAG,GACjB,OAAO,CAAC;EAE1B,OAAO,CAAC,GAAG;CACb;AACF;AAEA,QAAQ,WAAU,QAAO,QAAQ,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toArray.js","names":[],"sources":["../../src/vitest-extended/toArray.ts"],"sourcesContent":["import { isDefined } from './isDefined';\nimport type { ToArrayVitest_F, ToArray_F } from './types';\n\nexport const toArrayVitest: ToArrayVitest_F = args => {\n return args.map(({ expected, invite, parameters: params, test }) => {\n const parameters = toArray(params);\n return [invite, parameters, expected, test] as any;\n });\n};\n\ntoArrayVitest.error = args => {\n return args.map(({ invite, parameters: params, error }) => {\n const parameters = toArray.generic(params);\n return [invite, parameters, error] as any;\n });\n};\n\nexport const toArray: ToArray_F = obj => {\n if (Array.isArray(obj)) {\n return obj;\n } else {\n const isNotDefined = !isDefined(obj);\n if (isNotDefined) return [];\n\n return [obj];\n }\n};\n\ntoArray.generic = obj => toArray(obj) as any;\n"],"mappings":";;AAGA,MAAa,iBAAiC,SAAQ;
|
|
1
|
+
{"version":3,"file":"toArray.js","names":[],"sources":["../../src/vitest-extended/toArray.ts"],"sourcesContent":["import { isDefined } from './isDefined';\nimport type { ToArrayVitest_F, ToArray_F } from './types';\n\nexport const toArrayVitest: ToArrayVitest_F = args => {\n return args.map(({ expected, invite, parameters: params, test }) => {\n const parameters = toArray(params);\n return [invite, parameters, expected, test] as any;\n });\n};\n\ntoArrayVitest.error = args => {\n return args.map(({ invite, parameters: params, error }) => {\n const parameters = toArray.generic(params);\n return [invite, parameters, error] as any;\n });\n};\n\nexport const toArray: ToArray_F = obj => {\n if (Array.isArray(obj)) {\n return obj;\n } else {\n const isNotDefined = !isDefined(obj);\n if (isNotDefined) return [];\n\n return [obj];\n }\n};\n\ntoArray.generic = obj => toArray(obj) as any;\n"],"mappings":";;AAGA,MAAa,iBAAiC,SAAQ;CACpD,OAAO,KAAK,KAAK,EAAE,UAAU,QAAQ,YAAY,QAAQ,WAAW;EAElE,OAAO;GAAC;GADW,QAAQ,MACF;GAAG;GAAU;EAAI;CAC5C,CAAC;AACH;AAEA,cAAc,SAAQ,SAAQ;CAC5B,OAAO,KAAK,KAAK,EAAE,QAAQ,YAAY,QAAQ,YAAY;EAEzD,OAAO;GAAC;GADW,QAAQ,QAAQ,MACV;GAAG;EAAK;CACnC,CAAC;AACH;AAEA,MAAa,WAAqB,QAAO;CACvC,IAAI,MAAM,QAAQ,GAAG,GACnB,OAAO;MACF;EAEL,IAAI,CADkB,UAAU,GAAG,GACjB,OAAO,CAAC;EAE1B,OAAO,CAAC,GAAG;CACb;AACF;AAEA,QAAQ,WAAU,QAAO,QAAQ,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStringFlat.cjs","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from './bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\nexport const toStringFlat: Fn<[value: number, len: number], string> = (\n _value,\n _len,\n) => {\n const logLength = log10(_len);\n const logValue = log10(_value);\n const length = logLength - logValue;\n\n let out = '';\n Array.from({ length }).forEach(() => {\n out += '0';\n });\n\n out += _value;\n\n return out;\n};\n"],"mappings":";;AAEA,MAAM,SAAsC,UAAkB;
|
|
1
|
+
{"version":3,"file":"toStringFlat.cjs","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from './bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\nexport const toStringFlat: Fn<[value: number, len: number], string> = (\n _value,\n _len,\n) => {\n const logLength = log10(_len);\n const logValue = log10(_value);\n const length = logLength - logValue;\n\n let out = '';\n Array.from({ length }).forEach(() => {\n out += '0';\n });\n\n out += _value;\n\n return out;\n};\n"],"mappings":";;AAEA,MAAM,SAAsC,UAAkB;CAC5D,OAAO,KAAK,MAAM,KAAK,MAAM,KAAK,CAAC;AACrC;AAEA,MAAa,gBACX,QACA,SACG;CAGH,MAAM,SAFY,MAAM,IAED,IADN,MAAM,MACW;CAElC,IAAI,MAAM;CACV,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc;EACnC,OAAO;CACT,CAAC;CAED,OAAO;CAEP,OAAO;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type Fn } from
|
|
1
|
+
import { type Fn } from "./bemedev/globals/types";
|
|
2
2
|
export declare const toStringFlat: Fn<[value: number, len: number], string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStringFlat.js","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from './bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\nexport const toStringFlat: Fn<[value: number, len: number], string> = (\n _value,\n _len,\n) => {\n const logLength = log10(_len);\n const logValue = log10(_value);\n const length = logLength - logValue;\n\n let out = '';\n Array.from({ length }).forEach(() => {\n out += '0';\n });\n\n out += _value;\n\n return out;\n};\n"],"mappings":";AAEA,MAAM,SAAsC,UAAkB;
|
|
1
|
+
{"version":3,"file":"toStringFlat.js","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from './bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\nexport const toStringFlat: Fn<[value: number, len: number], string> = (\n _value,\n _len,\n) => {\n const logLength = log10(_len);\n const logValue = log10(_value);\n const length = logLength - logValue;\n\n let out = '';\n Array.from({ length }).forEach(() => {\n out += '0';\n });\n\n out += _value;\n\n return out;\n};\n"],"mappings":";AAEA,MAAM,SAAsC,UAAkB;CAC5D,OAAO,KAAK,MAAM,KAAK,MAAM,KAAK,CAAC;AACrC;AAEA,MAAa,gBACX,QACA,SACG;CAGH,MAAM,SAFY,MAAM,IAED,IADN,MAAM,MACW;CAElC,IAAI,MAAM;CACV,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc;EACnC,OAAO;CACT,CAAC;CAED,OAAO;CAEP,OAAO;AACT"}
|
|
@@ -1,64 +1,62 @@
|
|
|
1
|
-
import type { Fn, RuA } from
|
|
1
|
+
import type { Fn, RuA } from "./bemedev/globals/types";
|
|
2
2
|
export type { Fn, RuA };
|
|
3
3
|
type ReR<F extends Fn> = Awaited<ReturnType<F>>;
|
|
4
4
|
type TestFn<F extends Fn> = Fn<[ReR<F>, ReR<F>], void>;
|
|
5
|
-
type LengthOf<T> = T extends readonly any[] ? T[
|
|
6
|
-
export type SimpleParams<
|
|
7
|
-
|
|
5
|
+
type LengthOf<T> = T extends readonly any[] ? T["length"] : never;
|
|
6
|
+
export type SimpleParams<
|
|
7
|
+
F extends Fn,
|
|
8
|
+
P extends RuA = Parameters<F>
|
|
9
|
+
> = LengthOf<P> extends 0 ? {
|
|
10
|
+
parameters?: never;
|
|
8
11
|
} : 1 extends LengthOf<P> ? undefined extends P[0] ? {
|
|
9
|
-
|
|
12
|
+
parameters?: P | P[0];
|
|
10
13
|
} : 0 extends LengthOf<P> ? {
|
|
11
|
-
|
|
14
|
+
parameters?: P | P[0];
|
|
12
15
|
} : {
|
|
13
|
-
|
|
16
|
+
parameters: P | P[0];
|
|
14
17
|
} : {
|
|
15
|
-
|
|
18
|
+
parameters: P;
|
|
16
19
|
};
|
|
17
20
|
export type TestArgs<F extends Fn> = ({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
test?: TestFn<F>;
|
|
21
|
+
invite: string;
|
|
22
|
+
expected: ReR<F>;
|
|
23
|
+
/** Optional test function for specific cases */
|
|
24
|
+
test?: TestFn<F>;
|
|
24
25
|
} & SimpleParams<F>)[];
|
|
25
|
-
export type TestArgs2<F extends Fn> = [
|
|
26
|
-
invite: string,
|
|
27
|
-
parameters: Parameters<F>,
|
|
28
|
-
expected: ReR<F>,
|
|
29
|
-
/**
|
|
30
|
-
* Optional test function for specific cases
|
|
31
|
-
*/
|
|
32
|
-
test?: TestFn<F>
|
|
33
|
-
][];
|
|
26
|
+
export type TestArgs2<F extends Fn> = [invite: string, parameters: Parameters<F>, expected: ReR<F>, test?: TestFn<F>][];
|
|
34
27
|
export type TestErrors<F extends Fn> = ({
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
invite: string;
|
|
29
|
+
error?: string;
|
|
37
30
|
} & SimpleParams<F>)[];
|
|
38
|
-
export type TestErrors2<F extends Fn> = [
|
|
39
|
-
invite: string,
|
|
40
|
-
parameters: Parameters<F>,
|
|
41
|
-
error?: string
|
|
42
|
-
][];
|
|
31
|
+
export type TestErrors2<F extends Fn> = [invite: string, parameters: Parameters<F>, error?: string][];
|
|
43
32
|
export interface ToArray_F {
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
<T>(obj: any): T[];
|
|
34
|
+
generic: <T>(obj: T) => T[];
|
|
46
35
|
}
|
|
47
36
|
export interface ToArrayVitest_F {
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
<F extends Fn>(params: TestArgs<F>): TestArgs2<F>;
|
|
38
|
+
error: <F extends Fn>(params: TestErrors<F>) => TestErrors2<F>;
|
|
50
39
|
}
|
|
51
|
-
export type TestReturn<
|
|
40
|
+
export type TestReturn<
|
|
41
|
+
F extends Fn,
|
|
42
|
+
A extends TestArgs<F>
|
|
43
|
+
> = LengthOf<A> extends 0 ? Fn<TestArgs<F>, void> : void;
|
|
52
44
|
export type TestDoneFunction = Fn<[context: () => boolean], void>;
|
|
53
45
|
export type ToCreateTestsWithImplementation_F = <F extends Fn>(f: F, implementation: {
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
instanciation: () => Promise<F> | F;
|
|
47
|
+
name: string;
|
|
56
48
|
}) => (...cases: TestArgs<F>) => void;
|
|
57
49
|
export type FakeWaiter_F = (params: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
ms?: number;
|
|
51
|
+
times?: number;
|
|
52
|
+
fake: boolean;
|
|
61
53
|
}) => Promise<void>;
|
|
62
|
-
export type NextFn<
|
|
54
|
+
export type NextFn<
|
|
55
|
+
F extends Fn,
|
|
56
|
+
R = any
|
|
57
|
+
> = Fn<[ReturnType<F>], R>;
|
|
63
58
|
export type Identity<F extends Fn> = Fn<[ReturnType<F>], ReturnType<F>>;
|
|
64
|
-
export type ChainedFn<
|
|
59
|
+
export type ChainedFn<
|
|
60
|
+
F extends Fn,
|
|
61
|
+
T extends NextFn<F>
|
|
62
|
+
> = Fn<Parameters<F>, ReR<T>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/dev-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A collection of utilities for Node.js development, including build tools, testing utilities, and configuration management.",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "bri_lvi@icloud.com",
|
|
@@ -89,31 +89,35 @@
|
|
|
89
89
|
"cmd-ts": "^0.15.0",
|
|
90
90
|
"edit-json-file": "^1.8.1",
|
|
91
91
|
"glob": "^13.0.6",
|
|
92
|
+
"oxc-transform": "^0.139.0",
|
|
92
93
|
"rollup-plugin-circular-dependencies": "^2.0.1",
|
|
93
94
|
"rollup-plugin-node-externals": "^9.0.1",
|
|
94
95
|
"rollup-plugin-tsc-alias": "^1.1.4",
|
|
95
96
|
"rollup-plugin-tsconfig-paths": "^1.5.2",
|
|
96
97
|
"shelljs": "^0.10.0",
|
|
97
|
-
"sort-keys": "^6.0.
|
|
98
|
-
"tsc-alias": "^1.
|
|
98
|
+
"sort-keys": "^6.0.1",
|
|
99
|
+
"tsc-alias": "^1.9.1"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@bemedev/app-ts": "3.0.2",
|
|
102
103
|
"@bemedev/basifun": "0.5.3",
|
|
103
104
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
104
105
|
"@types/edit-json-file": "^1.7.4",
|
|
105
|
-
"@types/node": "^26.
|
|
106
|
+
"@types/node": "^26.1.1",
|
|
106
107
|
"@types/shelljs": "^0.10.0",
|
|
107
|
-
"
|
|
108
|
+
"@vitest/ui": "4.1.10",
|
|
109
|
+
"rolldown": "^1.1.5",
|
|
110
|
+
"typescript": "^7.0.2",
|
|
111
|
+
"vitest": "4.1.10",
|
|
108
112
|
"zod": "^4.4.3",
|
|
109
113
|
"zx": "^8.8.5"
|
|
110
114
|
},
|
|
111
115
|
"peerDependencies": {
|
|
112
|
-
"@vitest/coverage-v8": "4.1.
|
|
113
|
-
"@vitest/ui": "4.1.
|
|
114
|
-
"rolldown": "1.
|
|
115
|
-
"typescript": "^
|
|
116
|
-
"vitest": "4.1.
|
|
116
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
117
|
+
"@vitest/ui": "4.1.10",
|
|
118
|
+
"rolldown": "^1.1.5",
|
|
119
|
+
"typescript": "^7.0.2",
|
|
120
|
+
"vitest": "4.1.10"
|
|
117
121
|
},
|
|
118
122
|
"scripts": {
|
|
119
123
|
"build": "pnpm run rm:lib && pnpm run rolldown",
|