@bemedev/dev-utils 1.1.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -0
- package/lib/_virtual/_rolldown/runtime.cjs +1 -1
- package/lib/build-tests/addTarball.cjs +5 -1
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/addTarball.d.ts +3 -0
- package/lib/build-tests/addTarball.js +5 -1
- package/lib/build-tests/addTarball.js.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs +17 -9
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.d.ts +5 -0
- package/lib/build-tests/buildPackageJson.js +17 -9
- package/lib/build-tests/buildPackageJson.js.map +1 -1
- package/lib/build-tests/cleanup.cjs +3 -0
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cleanup.d.ts +3 -0
- package/lib/build-tests/cleanup.js +3 -0
- package/lib/build-tests/cleanup.js.map +1 -1
- package/lib/build-tests/cli/cli.cjs +6 -0
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/cli.d.ts +6 -0
- package/lib/build-tests/cli/cli.js +6 -0
- package/lib/build-tests/cli/cli.js.map +1 -1
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/cli/post.cjs +3 -0
- package/lib/build-tests/cli/post.cjs.map +1 -1
- package/lib/build-tests/cli/post.d.ts +3 -0
- package/lib/build-tests/cli/post.js +3 -0
- package/lib/build-tests/cli/post.js.map +1 -1
- package/lib/build-tests/cli/pre.cjs +3 -0
- package/lib/build-tests/cli/pre.cjs.map +1 -1
- package/lib/build-tests/cli/pre.d.ts +3 -0
- package/lib/build-tests/cli/pre.js +3 -0
- package/lib/build-tests/cli/pre.js.map +1 -1
- package/lib/build-tests/cli/test.cjs +3 -0
- package/lib/build-tests/cli/test.cjs.map +1 -1
- package/lib/build-tests/cli/test.d.ts +3 -0
- package/lib/build-tests/cli/test.js +3 -0
- package/lib/build-tests/cli/test.js.map +1 -1
- package/lib/build-tests/constants.cjs +42 -0
- package/lib/build-tests/constants.cjs.map +1 -1
- package/lib/build-tests/constants.d.ts +42 -0
- package/lib/build-tests/constants.js +42 -0
- package/lib/build-tests/constants.js.map +1 -1
- package/lib/build-tests/getRelativePath.cjs +7 -0
- package/lib/build-tests/getRelativePath.cjs.map +1 -1
- package/lib/build-tests/getRelativePath.d.ts +7 -0
- package/lib/build-tests/getRelativePath.js +7 -0
- package/lib/build-tests/getRelativePath.js.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.cjs +5 -0
- package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.d.ts +5 -0
- package/lib/build-tests/getTypescriptOutdir.js +5 -0
- package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
- package/lib/build-tests/import.cjs +9 -0
- package/lib/build-tests/import.cjs.map +1 -1
- package/lib/build-tests/import.d.ts +9 -0
- package/lib/build-tests/import.js +9 -0
- package/lib/build-tests/import.js.map +1 -1
- package/lib/build-tests/imports/create.cjs +7 -0
- package/lib/build-tests/imports/create.cjs.map +1 -1
- package/lib/build-tests/imports/create.d.ts +13 -0
- package/lib/build-tests/imports/create.js +7 -0
- package/lib/build-tests/imports/create.js.map +1 -1
- package/lib/build-tests/imports/helper.cjs +9 -0
- package/lib/build-tests/imports/helper.cjs.map +1 -1
- package/lib/build-tests/imports/helper.d.ts +12 -0
- package/lib/build-tests/imports/helper.js +9 -0
- package/lib/build-tests/imports/helper.js.map +1 -1
- package/lib/build-tests/pack.cjs +7 -1
- package/lib/build-tests/pack.cjs.map +1 -1
- package/lib/build-tests/pack.d.ts +5 -0
- package/lib/build-tests/pack.js +7 -1
- package/lib/build-tests/pack.js.map +1 -1
- package/lib/plugins/hmr.cjs +72 -0
- package/lib/plugins/hmr.cjs.map +1 -0
- package/lib/plugins/hmr.d.ts +22 -0
- package/lib/plugins/hmr.js +71 -0
- package/lib/plugins/hmr.js.map +1 -0
- package/lib/plugins/index.cjs +5 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.js +3 -0
- package/lib/plugins/suppressWarnings.cjs +37 -0
- package/lib/plugins/suppressWarnings.cjs.map +1 -0
- package/lib/plugins/suppressWarnings.d.ts +12 -0
- package/lib/plugins/suppressWarnings.js +36 -0
- package/lib/plugins/suppressWarnings.js.map +1 -0
- package/lib/rolldown-config/config.cjs +13 -5
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.d.ts +7 -0
- package/lib/rolldown-config/config.js +13 -5
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.cjs +15 -0
- package/lib/rolldown-config/constants.cjs.map +1 -1
- package/lib/rolldown-config/constants.d.ts +15 -0
- package/lib/rolldown-config/constants.js +15 -0
- package/lib/rolldown-config/constants.js.map +1 -1
- package/lib/rolldown-config/helpers.cjs +16 -1
- package/lib/rolldown-config/helpers.cjs.map +1 -1
- package/lib/rolldown-config/helpers.d.ts +14 -0
- package/lib/rolldown-config/helpers.js +16 -1
- package/lib/rolldown-config/helpers.js.map +1 -1
- package/lib/rolldown-config/input.cjs +8 -0
- package/lib/rolldown-config/input.cjs.map +1 -1
- package/lib/rolldown-config/input.d.ts +8 -0
- package/lib/rolldown-config/input.js +8 -0
- package/lib/rolldown-config/input.js.map +1 -1
- package/lib/rolldown-config/output.cjs +8 -0
- package/lib/rolldown-config/output.cjs.map +1 -1
- package/lib/rolldown-config/output.d.ts +8 -0
- package/lib/rolldown-config/output.js +8 -0
- package/lib/rolldown-config/output.js.map +1 -1
- package/lib/rolldown-config/plugins/circulars.cjs +5 -5
- package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
- package/lib/rolldown-config/plugins/circulars.d.ts +10 -6
- package/lib/rolldown-config/plugins/circulars.js +5 -5
- package/lib/rolldown-config/plugins/circulars.js.map +1 -1
- package/lib/rolldown-config/plugins/clean.cjs +10 -1
- package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
- package/lib/rolldown-config/plugins/clean.d.ts +10 -0
- package/lib/rolldown-config/plugins/clean.js +10 -1
- package/lib/rolldown-config/plugins/clean.js.map +1 -1
- package/lib/rolldown-config/plugins/externals.cjs +4 -3
- package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
- package/lib/rolldown-config/plugins/externals.d.ts +7 -3
- package/lib/rolldown-config/plugins/externals.js +4 -3
- package/lib/rolldown-config/plugins/externals.js.map +1 -1
- package/lib/rolldown-config/plugins/index.cjs +6 -0
- package/lib/rolldown-config/plugins/index.cjs.map +1 -1
- package/lib/rolldown-config/plugins/index.d.ts +6 -0
- package/lib/rolldown-config/plugins/index.js +6 -0
- package/lib/rolldown-config/plugins/index.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.cjs +7 -0
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs +15 -0
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.d.ts +15 -0
- package/lib/rolldown-config/plugins/typescript.config.js +15 -0
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.d.ts +10 -0
- package/lib/rolldown-config/plugins/typescript.fast.cjs +9 -1
- package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.fast.d.ts +10 -0
- package/lib/rolldown-config/plugins/typescript.fast.js +9 -1
- package/lib/rolldown-config/plugins/typescript.fast.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.js +7 -0
- package/lib/rolldown-config/plugins/typescript.js.map +1 -1
- package/lib/rolldown-config/types.d.ts +18 -0
- package/lib/utils/array.cjs +7 -0
- package/lib/utils/array.cjs.map +1 -1
- package/lib/utils/array.d.ts +8 -0
- package/lib/utils/array.js +7 -0
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/bemedev/globals/types.d.ts +20 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs.map +1 -1
- package/lib/utils/bemedev/globals/utils/expandFn.d.ts +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js.map +1 -1
- package/lib/utils/clamp.cjs +18 -0
- package/lib/utils/clamp.cjs.map +1 -0
- package/lib/utils/clamp.d.ts +10 -0
- package/lib/utils/clamp.js +17 -0
- package/lib/utils/clamp.js.map +1 -0
- package/lib/utils/identity.cjs +9 -0
- package/lib/utils/identity.cjs.map +1 -1
- package/lib/utils/identity.d.ts +9 -0
- package/lib/utils/identity.js +9 -0
- package/lib/utils/identity.js.map +1 -1
- package/lib/utils/index.cjs +2 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -1
- package/lib/utils/sleep.cjs +7 -0
- package/lib/utils/sleep.cjs.map +1 -1
- package/lib/utils/sleep.d.ts +7 -0
- package/lib/utils/sleep.js +7 -0
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/types.d.ts +17 -1
- package/lib/vitest-exclude/constants.cjs +3 -0
- package/lib/vitest-exclude/constants.cjs.map +1 -1
- package/lib/vitest-exclude/constants.d.ts +3 -0
- package/lib/vitest-exclude/constants.js +3 -0
- package/lib/vitest-exclude/constants.js.map +1 -1
- package/lib/vitest-exclude/types.d.ts +11 -0
- package/lib/vitest-exclude/vitest.cjs +25 -12
- package/lib/vitest-exclude/vitest.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.d.ts +9 -8
- package/lib/vitest-exclude/vitest.js +25 -12
- package/lib/vitest-exclude/vitest.js.map +1 -1
- package/lib/vitest-exclude/vitest.utils.cjs +30 -0
- package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.utils.d.ts +30 -0
- package/lib/vitest-exclude/vitest.utils.js +30 -0
- package/lib/vitest-exclude/vitest.utils.js.map +1 -1
- package/lib/vitest-extended/acceptation.cjs +11 -2
- package/lib/vitest-extended/acceptation.cjs.map +1 -1
- package/lib/vitest-extended/acceptation.d.ts +9 -1
- package/lib/vitest-extended/acceptation.js +11 -2
- package/lib/vitest-extended/acceptation.js.map +1 -1
- package/lib/vitest-extended/createTests.cjs +34 -27
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.d.ts +20 -37
- package/lib/vitest-extended/createTests.js +34 -27
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/lib/vitest-extended/createTests.types.d.ts +13 -2
- package/lib/vitest-extended/done.cjs +18 -15
- package/lib/vitest-extended/done.cjs.map +1 -1
- package/lib/vitest-extended/done.d.ts +6 -5
- package/lib/vitest-extended/done.js +18 -15
- package/lib/vitest-extended/done.js.map +1 -1
- package/lib/vitest-extended/each/error.cjs +12 -0
- package/lib/vitest-extended/each/error.cjs.map +1 -1
- package/lib/vitest-extended/each/error.d.ts +12 -0
- package/lib/vitest-extended/each/error.js +12 -0
- package/lib/vitest-extended/each/error.js.map +1 -1
- package/lib/vitest-extended/each/error.types.d.ts +17 -0
- package/lib/vitest-extended/each/pass.cjs +9 -20
- package/lib/vitest-extended/each/pass.cjs.map +1 -1
- package/lib/vitest-extended/each/pass.d.ts +9 -20
- package/lib/vitest-extended/each/pass.js +9 -20
- package/lib/vitest-extended/each/pass.js.map +1 -1
- package/lib/vitest-extended/each/pass.types.d.ts +24 -0
- package/lib/vitest-extended/fakeWaiter.cjs +7 -0
- package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
- package/lib/vitest-extended/fakeWaiter.d.ts +32 -0
- package/lib/vitest-extended/fakeWaiter.js +7 -0
- package/lib/vitest-extended/fakeWaiter.js.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.cjs +11 -0
- package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.js +11 -0
- package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.cjs +9 -4
- package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.js +9 -4
- package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.cjs +18 -0
- package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.js +18 -0
- package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
- package/lib/vitest-extended/fixtures/vitest.cjs +3 -0
- package/lib/vitest-extended/fixtures/vitest.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/vitest.js +3 -0
- package/lib/vitest-extended/fixtures/vitest.js.map +1 -1
- package/lib/vitest-extended/fixtures/zod.cjs +22 -0
- package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/zod.js +22 -0
- package/lib/vitest-extended/fixtures/zod.js.map +1 -1
- package/lib/vitest-extended/identity.cjs +18 -0
- package/lib/vitest-extended/identity.cjs.map +1 -1
- package/lib/vitest-extended/identity.d.ts +18 -0
- package/lib/vitest-extended/identity.js +18 -0
- package/lib/vitest-extended/identity.js.map +1 -1
- package/lib/vitest-extended/isDefined.cjs +9 -0
- package/lib/vitest-extended/isDefined.cjs.map +1 -1
- package/lib/vitest-extended/isDefined.d.ts +9 -0
- package/lib/vitest-extended/isDefined.js +9 -0
- package/lib/vitest-extended/isDefined.js.map +1 -1
- package/lib/vitest-extended/isFunction.cjs +7 -0
- package/lib/vitest-extended/isFunction.cjs.map +1 -1
- package/lib/vitest-extended/isFunction.d.ts +7 -0
- package/lib/vitest-extended/isFunction.js +7 -0
- package/lib/vitest-extended/isFunction.js.map +1 -1
- package/lib/vitest-extended/project.cjs +7 -0
- package/lib/vitest-extended/project.cjs.map +1 -1
- package/lib/vitest-extended/project.d.ts +7 -0
- package/lib/vitest-extended/project.js +7 -0
- package/lib/vitest-extended/project.js.map +1 -1
- package/lib/vitest-extended/toArray.cjs +6 -0
- package/lib/vitest-extended/toArray.cjs.map +1 -1
- package/lib/vitest-extended/toArray.d.ts +6 -0
- package/lib/vitest-extended/toArray.js +6 -0
- package/lib/vitest-extended/toArray.js.map +1 -1
- package/lib/vitest-extended/toStringFlat.cjs +8 -0
- package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
- package/lib/vitest-extended/toStringFlat.d.ts +8 -0
- package/lib/vitest-extended/toStringFlat.js +8 -0
- package/lib/vitest-extended/toStringFlat.js.map +1 -1
- package/lib/vitest-extended/types.d.ts +64 -0
- package/package.json +14 -9
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let vitest = require("vitest");
|
|
3
3
|
//#region src/vitest-extended/identity.ts
|
|
4
|
+
/**
|
|
5
|
+
* Identity function returning its argument unmodified.
|
|
6
|
+
*
|
|
7
|
+
* @template `T` - Type of the input value.
|
|
8
|
+
*
|
|
9
|
+
* @param value - The input value.
|
|
10
|
+
*
|
|
11
|
+
* @returns The unchanged `value` of type `T`.
|
|
12
|
+
*/
|
|
4
13
|
const identity = (value) => value;
|
|
14
|
+
/**
|
|
15
|
+
* Default equality comparison using Vitest's `expect.toStrictEqual`. Sorts
|
|
16
|
+
* arrays prior to comparison.
|
|
17
|
+
*
|
|
18
|
+
* @param value - The actual received value.
|
|
19
|
+
* @param expected - The expected value.
|
|
20
|
+
*
|
|
21
|
+
* @returns The Vitest assertion result.
|
|
22
|
+
*/
|
|
5
23
|
const defaultEquality = (value, expected) => {
|
|
6
24
|
if (Array.isArray(value) && Array.isArray(expected)) return (0, vitest.expect)(value.sort()).toStrictEqual(expected.sort());
|
|
7
25
|
return (0, vitest.expect)(value).toStrictEqual(expected);
|
|
@@ -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":["expect"],"sources":["../../src/vitest-extended/identity.ts"],"sourcesContent":["import { expect } from 'vitest';\n\n/**\n * Identity function returning its argument unmodified.\n *\n * @template `T` - Type of the input value.\n *\n * @param value - The input value.\n *\n * @returns The unchanged `value` of type `T`.\n */\nexport const identity = <T>(value: T) => value;\n\n/**\n * Default equality comparison using Vitest's `expect.toStrictEqual`. Sorts\n * arrays prior to comparison.\n *\n * @param value - The actual received value.\n * @param expected - The expected value.\n *\n * @returns The Vitest assertion result.\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":";;;;;;;;;;;;AAWA,MAAa,YAAe,UAAa;;;;;;;;;;AAWzC,MAAa,mBAAmB,OAAY,aAAkB;CAG5D,IAFmB,MAAM,QAAQ,KAAK,KAAK,MAAM,QAAQ,QAAQ,GAG/D,QAAA,GAAOA,OAAAA,OAAAA,CAAO,MAAM,KAAK,CAAC,CAAC,CAAC,cAAc,SAAS,KAAK,CAAC;CAE3D,QAAA,GAAOA,OAAAA,OAAAA,CAAO,KAAK,CAAC,CAAC,cAAc,QAAQ;AAC7C"}
|
|
@@ -1,2 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity function returning its argument unmodified.
|
|
3
|
+
*
|
|
4
|
+
* @template `T` - Type of the input value.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The input value.
|
|
7
|
+
*
|
|
8
|
+
* @returns The unchanged `value` of type `T`.
|
|
9
|
+
*/
|
|
1
10
|
export declare const identity: <T>(value: T) => T;
|
|
11
|
+
/**
|
|
12
|
+
* Default equality comparison using Vitest's `expect.toStrictEqual`. Sorts
|
|
13
|
+
* arrays prior to comparison.
|
|
14
|
+
*
|
|
15
|
+
* @param value - The actual received value.
|
|
16
|
+
* @param expected - The expected value.
|
|
17
|
+
*
|
|
18
|
+
* @returns The Vitest assertion result.
|
|
19
|
+
*/
|
|
2
20
|
export declare const defaultEquality: (value: any, expected: any) => void;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { expect } from "vitest";
|
|
2
2
|
//#region src/vitest-extended/identity.ts
|
|
3
|
+
/**
|
|
4
|
+
* Identity function returning its argument unmodified.
|
|
5
|
+
*
|
|
6
|
+
* @template `T` - Type of the input value.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The input value.
|
|
9
|
+
*
|
|
10
|
+
* @returns The unchanged `value` of type `T`.
|
|
11
|
+
*/
|
|
3
12
|
const identity = (value) => value;
|
|
13
|
+
/**
|
|
14
|
+
* Default equality comparison using Vitest's `expect.toStrictEqual`. Sorts
|
|
15
|
+
* arrays prior to comparison.
|
|
16
|
+
*
|
|
17
|
+
* @param value - The actual received value.
|
|
18
|
+
* @param expected - The expected value.
|
|
19
|
+
*
|
|
20
|
+
* @returns The Vitest assertion result.
|
|
21
|
+
*/
|
|
4
22
|
const defaultEquality = (value, expected) => {
|
|
5
23
|
if (Array.isArray(value) && Array.isArray(expected)) return expect(value.sort()).toStrictEqual(expected.sort());
|
|
6
24
|
return expect(value).toStrictEqual(expected);
|
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"identity.js","names":[],"sources":["../../src/vitest-extended/identity.ts"],"sourcesContent":["import { expect } from 'vitest';\n\n/**\n * Identity function returning its argument unmodified.\n *\n * @template `T` - Type of the input value.\n *\n * @param value - The input value.\n *\n * @returns The unchanged `value` of type `T`.\n */\nexport const identity = <T>(value: T) => value;\n\n/**\n * Default equality comparison using Vitest's `expect.toStrictEqual`. Sorts\n * arrays prior to comparison.\n *\n * @param value - The actual received value.\n * @param expected - The expected value.\n *\n * @returns The Vitest assertion result.\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":";;;;;;;;;;;AAWA,MAAa,YAAe,UAAa;;;;;;;;;;AAWzC,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,5 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/vitest-extended/isDefined.ts
|
|
3
|
+
/**
|
|
4
|
+
* Type guard to check if a value is defined (not `null` and not `undefined`).
|
|
5
|
+
*
|
|
6
|
+
* @template `T` - Type of the value to test.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to check of type {@linkcode Undefiny}.
|
|
9
|
+
*
|
|
10
|
+
* @returns `true` if `value` is defined, otherwise `false`.
|
|
11
|
+
*/
|
|
3
12
|
const isDefined = (value) => {
|
|
4
13
|
return value !== void 0 && value !== null;
|
|
5
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDefined.cjs","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '../utils/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":"
|
|
1
|
+
{"version":3,"file":"isDefined.cjs","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '../utils/bemedev/globals/types';\nexport type { Undefiny };\n\n/**\n * Type guard to check if a value is defined (not `null` and not `undefined`).\n *\n * @template `T` - Type of the value to test.\n *\n * @param value - The value to check of type {@linkcode Undefiny}.\n *\n * @returns `true` if `value` is defined, otherwise `false`.\n */\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,aAAgB,UAAoC;CAC/D,OAAO,UAAU,KAAA,KAAa,UAAU;AAC1C"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import type { Undefiny } from '../utils/bemedev/globals/types';
|
|
2
2
|
export type { Undefiny };
|
|
3
|
+
/**
|
|
4
|
+
* Type guard to check if a value is defined (not `null` and not `undefined`).
|
|
5
|
+
*
|
|
6
|
+
* @template `T` - Type of the value to test.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to check of type {@linkcode Undefiny}.
|
|
9
|
+
*
|
|
10
|
+
* @returns `true` if `value` is defined, otherwise `false`.
|
|
11
|
+
*/
|
|
3
12
|
export declare const isDefined: <T>(value?: Undefiny<T>) => value is T;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
//#region src/vitest-extended/isDefined.ts
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if a value is defined (not `null` and not `undefined`).
|
|
4
|
+
*
|
|
5
|
+
* @template `T` - Type of the value to test.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to check of type {@linkcode Undefiny}.
|
|
8
|
+
*
|
|
9
|
+
* @returns `true` if `value` is defined, otherwise `false`.
|
|
10
|
+
*/
|
|
2
11
|
const isDefined = (value) => {
|
|
3
12
|
return value !== void 0 && value !== null;
|
|
4
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDefined.js","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '../utils/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":"
|
|
1
|
+
{"version":3,"file":"isDefined.js","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '../utils/bemedev/globals/types';\nexport type { Undefiny };\n\n/**\n * Type guard to check if a value is defined (not `null` and not `undefined`).\n *\n * @template `T` - Type of the value to test.\n *\n * @param value - The value to check of type {@linkcode Undefiny}.\n *\n * @returns `true` if `value` is defined, otherwise `false`.\n */\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";;;;;;;;;;AAYA,MAAa,aAAgB,UAAoC;CAC/D,OAAO,UAAU,KAAA,KAAa,UAAU;AAC1C"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/vitest-extended/isFunction.ts
|
|
3
|
+
/**
|
|
4
|
+
* Determines whether the given value is a function.
|
|
5
|
+
*
|
|
6
|
+
* @param arg - The value to check.
|
|
7
|
+
*
|
|
8
|
+
* @returns `true` if `arg` is a function, otherwise `false`.
|
|
9
|
+
*/
|
|
3
10
|
function isFunction(arg) {
|
|
4
11
|
const isType = "function" === typeof arg;
|
|
5
12
|
const isInstance = arg instanceof Function;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isFunction.cjs","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"isFunction.cjs","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["/**\n * Determines whether the given value is a function.\n *\n * @param arg - The value to check.\n *\n * @returns `true` if `arg` is a function, otherwise `false`.\n */\nexport 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":";;;;;;;;;AAOA,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,4 +1,11 @@
|
|
|
1
1
|
//#region src/vitest-extended/isFunction.ts
|
|
2
|
+
/**
|
|
3
|
+
* Determines whether the given value is a function.
|
|
4
|
+
*
|
|
5
|
+
* @param arg - The value to check.
|
|
6
|
+
*
|
|
7
|
+
* @returns `true` if `arg` is a function, otherwise `false`.
|
|
8
|
+
*/
|
|
2
9
|
function isFunction(arg) {
|
|
3
10
|
const isType = "function" === typeof arg;
|
|
4
11
|
const isInstance = arg instanceof Function;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isFunction.js","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"isFunction.js","names":[],"sources":["../../src/vitest-extended/isFunction.ts"],"sourcesContent":["/**\n * Determines whether the given value is a function.\n *\n * @param arg - The value to check.\n *\n * @returns `true` if `arg` is a function, otherwise `false`.\n */\nexport 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":";;;;;;;;AAOA,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,6 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let vitest_config = require("vitest/config");
|
|
3
3
|
//#region src/vitest-extended/project.ts
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to define a Vitest project configuration with defaults.
|
|
6
|
+
*
|
|
7
|
+
* @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.
|
|
8
|
+
*
|
|
9
|
+
* @returns Configured Vitest project configuration.
|
|
10
|
+
*/
|
|
4
11
|
const defineProject = (conf) => {
|
|
5
12
|
const _env = conf.test?.env ?? {};
|
|
6
13
|
return (0, vitest_config.defineConfig)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.cjs","names":[],"sources":["../../src/vitest-extended/project.ts"],"sourcesContent":["import { defineConfig, type UserWorkspaceConfig } from 'vitest/config';\n\nexport const defineProject = (conf: UserWorkspaceConfig) => {\n const _env = conf.test?.env ?? {};\n\n return defineConfig({\n resolve: { tsconfigPaths: true },\n ...conf,\n test: {\n globals: true,\n logHeapUsage: false,\n env: { NODE_ENV: 'test', ..._env },\n ...conf.test,\n },\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.cjs","names":["defineConfig"],"sources":["../../src/vitest-extended/project.ts"],"sourcesContent":["import { defineConfig, type UserWorkspaceConfig } from 'vitest/config';\n\n/**\n * Helper function to define a Vitest project configuration with defaults.\n *\n * @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.\n *\n * @returns Configured Vitest project configuration.\n */\nexport const defineProject = (conf: UserWorkspaceConfig) => {\n const _env = conf.test?.env ?? {};\n\n return defineConfig({\n resolve: { tsconfigPaths: true },\n ...conf,\n test: {\n globals: true,\n logHeapUsage: false,\n env: { NODE_ENV: 'test', ..._env },\n ...conf.test,\n },\n });\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,iBAAiB,SAA8B;CAC1D,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC;CAEhC,QAAA,GAAOA,cAAAA,aAAAA,CAAa;EAClB,SAAS,EAAE,eAAe,KAAK;EAC/B,GAAG;EACH,MAAM;GACJ,SAAS;GACT,cAAc;GACd,KAAK;IAAE,UAAU;IAAQ,GAAG;GAAK;GACjC,GAAG,KAAK;EACV;CACF,CAAC;AACH"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { type UserWorkspaceConfig } from 'vitest/config';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to define a Vitest project configuration with defaults.
|
|
4
|
+
*
|
|
5
|
+
* @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.
|
|
6
|
+
*
|
|
7
|
+
* @returns Configured Vitest project configuration.
|
|
8
|
+
*/
|
|
2
9
|
export declare const defineProject: (conf: UserWorkspaceConfig) => import("vite").UserConfig;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { defineConfig } from "vitest/config";
|
|
2
2
|
//#region src/vitest-extended/project.ts
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to define a Vitest project configuration with defaults.
|
|
5
|
+
*
|
|
6
|
+
* @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.
|
|
7
|
+
*
|
|
8
|
+
* @returns Configured Vitest project configuration.
|
|
9
|
+
*/
|
|
3
10
|
const defineProject = (conf) => {
|
|
4
11
|
const _env = conf.test?.env ?? {};
|
|
5
12
|
return defineConfig({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","names":[],"sources":["../../src/vitest-extended/project.ts"],"sourcesContent":["import { defineConfig, type UserWorkspaceConfig } from 'vitest/config';\n\nexport const defineProject = (conf: UserWorkspaceConfig) => {\n const _env = conf.test?.env ?? {};\n\n return defineConfig({\n resolve: { tsconfigPaths: true },\n ...conf,\n test: {\n globals: true,\n logHeapUsage: false,\n env: { NODE_ENV: 'test', ..._env },\n ...conf.test,\n },\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.js","names":[],"sources":["../../src/vitest-extended/project.ts"],"sourcesContent":["import { defineConfig, type UserWorkspaceConfig } from 'vitest/config';\n\n/**\n * Helper function to define a Vitest project configuration with defaults.\n *\n * @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.\n *\n * @returns Configured Vitest project configuration.\n */\nexport const defineProject = (conf: UserWorkspaceConfig) => {\n const _env = conf.test?.env ?? {};\n\n return defineConfig({\n resolve: { tsconfigPaths: true },\n ...conf,\n test: {\n globals: true,\n logHeapUsage: false,\n env: { NODE_ENV: 'test', ..._env },\n ...conf.test,\n },\n });\n};\n"],"mappings":";;;;;;;;;AASA,MAAa,iBAAiB,SAA8B;CAC1D,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC;CAEhC,OAAO,aAAa;EAClB,SAAS,EAAE,eAAe,KAAK;EAC/B,GAAG;EACH,MAAM;GACJ,SAAS;GACT,cAAc;GACd,KAAK;IAAE,UAAU;IAAQ,GAAG;GAAK;GACjC,GAAG,KAAK;EACV;CACF,CAAC;AACH"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_vitest_extended_isDefined = require("./isDefined.cjs");
|
|
3
3
|
//#region src/vitest-extended/toArray.ts
|
|
4
|
+
/**
|
|
5
|
+
* Transforms test case arguments into the tuple format expected by Vitest each runners.
|
|
6
|
+
*/
|
|
4
7
|
const toArrayVitest = (args) => {
|
|
5
8
|
return args.map(({ expected, invite, parameters: params, test }) => {
|
|
6
9
|
return [
|
|
@@ -20,6 +23,9 @@ toArrayVitest.error = (args) => {
|
|
|
20
23
|
];
|
|
21
24
|
});
|
|
22
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
28
|
+
*/
|
|
23
29
|
const toArray = (obj) => {
|
|
24
30
|
if (Array.isArray(obj)) return obj;
|
|
25
31
|
else {
|
|
@@ -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":"
|
|
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\n/**\n * Transforms test case arguments into the tuple format expected by Vitest each runners.\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\n/**\n * Normalizes a single value, array, null, or undefined into an array.\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":";;;;;;AAMA,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;;;;AAKA,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,3 +1,9 @@
|
|
|
1
1
|
import type { ToArrayVitest_F, ToArray_F } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms test case arguments into the tuple format expected by Vitest each runners.
|
|
4
|
+
*/
|
|
2
5
|
export declare const toArrayVitest: ToArrayVitest_F;
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
8
|
+
*/
|
|
3
9
|
export declare const toArray: ToArray_F;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { isDefined } from "./isDefined.js";
|
|
2
2
|
//#region src/vitest-extended/toArray.ts
|
|
3
|
+
/**
|
|
4
|
+
* Transforms test case arguments into the tuple format expected by Vitest each runners.
|
|
5
|
+
*/
|
|
3
6
|
const toArrayVitest = (args) => {
|
|
4
7
|
return args.map(({ expected, invite, parameters: params, test }) => {
|
|
5
8
|
return [
|
|
@@ -19,6 +22,9 @@ toArrayVitest.error = (args) => {
|
|
|
19
22
|
];
|
|
20
23
|
});
|
|
21
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
27
|
+
*/
|
|
22
28
|
const toArray = (obj) => {
|
|
23
29
|
if (Array.isArray(obj)) return obj;
|
|
24
30
|
else {
|
|
@@ -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":"
|
|
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\n/**\n * Transforms test case arguments into the tuple format expected by Vitest each runners.\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\n/**\n * Normalizes a single value, array, null, or undefined into an array.\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":";;;;;AAMA,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;;;;AAKA,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"}
|
|
@@ -3,6 +3,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const log10 = (value) => {
|
|
4
4
|
return Math.floor(Math.log10(value));
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Formats a number as a zero-padded string relative to the maximum length's magnitude.
|
|
8
|
+
*
|
|
9
|
+
* @param _value - Number value to format.
|
|
10
|
+
* @param _len - Maximum upper bound length for digit padding calculation.
|
|
11
|
+
*
|
|
12
|
+
* @returns Zero-padded string representation of `_value`.
|
|
13
|
+
*/
|
|
6
14
|
const toStringFlat = (_value, _len) => {
|
|
7
15
|
const length = log10(_len) - log10(_value);
|
|
8
16
|
let out = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStringFlat.cjs","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '../utils/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
|
|
1
|
+
{"version":3,"file":"toStringFlat.cjs","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '../utils/bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\n/**\n * Formats a number as a zero-padded string relative to the maximum length's magnitude.\n *\n * @param _value - Number value to format.\n * @param _len - Maximum upper bound length for digit padding calculation.\n *\n * @returns Zero-padded string representation of `_value`.\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;;;;;;;;;AAUA,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,10 @@
|
|
|
1
1
|
import { type Fn } from '../utils/bemedev/globals/types';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a number as a zero-padded string relative to the maximum length's magnitude.
|
|
4
|
+
*
|
|
5
|
+
* @param _value - Number value to format.
|
|
6
|
+
* @param _len - Maximum upper bound length for digit padding calculation.
|
|
7
|
+
*
|
|
8
|
+
* @returns Zero-padded string representation of `_value`.
|
|
9
|
+
*/
|
|
2
10
|
export declare const toStringFlat: Fn<[value: number, len: number], string>;
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
const log10 = (value) => {
|
|
3
3
|
return Math.floor(Math.log10(value));
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Formats a number as a zero-padded string relative to the maximum length's magnitude.
|
|
7
|
+
*
|
|
8
|
+
* @param _value - Number value to format.
|
|
9
|
+
* @param _len - Maximum upper bound length for digit padding calculation.
|
|
10
|
+
*
|
|
11
|
+
* @returns Zero-padded string representation of `_value`.
|
|
12
|
+
*/
|
|
5
13
|
const toStringFlat = (_value, _len) => {
|
|
6
14
|
const length = log10(_len) - log10(_value);
|
|
7
15
|
let out = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStringFlat.js","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '../utils/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
|
|
1
|
+
{"version":3,"file":"toStringFlat.js","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '../utils/bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\n/**\n * Formats a number as a zero-padded string relative to the maximum length's magnitude.\n *\n * @param _value - Number value to format.\n * @param _len - Maximum upper bound length for digit padding calculation.\n *\n * @returns Zero-padded string representation of `_value`.\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;;;;;;;;;AAUA,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"}
|
|
@@ -3,6 +3,12 @@ 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
5
|
type LengthOf<T> = T extends readonly any[] ? T['length'] : never;
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes function parameter types for test case options.
|
|
8
|
+
*
|
|
9
|
+
* @template | {@linkcode Fn} `F` - Target function type.
|
|
10
|
+
* @template | {@linkcode RuA} `P` - Parameters tuple type.
|
|
11
|
+
*/
|
|
6
12
|
export type SimpleParams<F extends Fn, P extends RuA = Parameters<F>> = LengthOf<P> extends 0 ? {
|
|
7
13
|
parameters?: never;
|
|
8
14
|
} : 1 extends LengthOf<P> ? undefined extends P[0] ? {
|
|
@@ -14,12 +20,22 @@ export type SimpleParams<F extends Fn, P extends RuA = Parameters<F>> = LengthOf
|
|
|
14
20
|
} : {
|
|
15
21
|
parameters: P;
|
|
16
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Array of test case definition objects for success assertions.
|
|
25
|
+
*
|
|
26
|
+
* @template | {@linkcode Fn} `F` - Target function type.
|
|
27
|
+
*/
|
|
17
28
|
export type TestArgs<F extends Fn> = ({
|
|
18
29
|
invite: string;
|
|
19
30
|
expected: ReR<F>;
|
|
20
31
|
/** Optional test function for specific cases */
|
|
21
32
|
test?: TestFn<F>;
|
|
22
33
|
} & SimpleParams<F>)[];
|
|
34
|
+
/**
|
|
35
|
+
* Tuple representation of test cases for Vitest each execution.
|
|
36
|
+
*
|
|
37
|
+
* @template | {@linkcode Fn} `F` - Target function type.
|
|
38
|
+
*/
|
|
23
39
|
export type TestArgs2<F extends Fn> = [
|
|
24
40
|
invite: string,
|
|
25
41
|
parameters: Parameters<F>,
|
|
@@ -27,34 +43,82 @@ export type TestArgs2<F extends Fn> = [
|
|
|
27
43
|
/** Optional test function for specific cases */
|
|
28
44
|
test?: TestFn<F>
|
|
29
45
|
][];
|
|
46
|
+
/**
|
|
47
|
+
* Array of test case definition objects for failure assertions.
|
|
48
|
+
*
|
|
49
|
+
* @template | {@linkcode Fn} `F` - Target function type.
|
|
50
|
+
*/
|
|
30
51
|
export type TestErrors<F extends Fn> = ({
|
|
31
52
|
invite: string;
|
|
32
53
|
error?: string;
|
|
33
54
|
} & SimpleParams<F>)[];
|
|
55
|
+
/**
|
|
56
|
+
* Tuple representation of error test cases for Vitest each execution.
|
|
57
|
+
*
|
|
58
|
+
* @template | {@linkcode Fn} `F` - Target function type.
|
|
59
|
+
*/
|
|
34
60
|
export type TestErrors2<F extends Fn> = [
|
|
35
61
|
invite: string,
|
|
36
62
|
parameters: Parameters<F>,
|
|
37
63
|
error?: string
|
|
38
64
|
][];
|
|
65
|
+
/**
|
|
66
|
+
* Interface for array conversion utilities.
|
|
67
|
+
*/
|
|
39
68
|
export interface ToArray_F {
|
|
40
69
|
<T>(obj: any): T[];
|
|
41
70
|
generic: <T>(obj: T) => T[];
|
|
42
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Interface for Vitest test argument conversion utilities.
|
|
74
|
+
*/
|
|
43
75
|
export interface ToArrayVitest_F {
|
|
44
76
|
<F extends Fn>(params: TestArgs<F>): TestArgs2<F>;
|
|
45
77
|
error: <F extends Fn>(params: TestErrors<F>) => TestErrors2<F>;
|
|
46
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Conditional return type for test definitions based on provided argument count.
|
|
81
|
+
*
|
|
82
|
+
* @template | {@linkcode Fn} `F` - Target function type.
|
|
83
|
+
* @template | {@linkcode TestArgs} `A` - Test arguments type.
|
|
84
|
+
*/
|
|
47
85
|
export type TestReturn<F extends Fn, A extends TestArgs<F>> = LengthOf<A> extends 0 ? Fn<TestArgs<F>, void> : void;
|
|
86
|
+
/**
|
|
87
|
+
* Callback function type for asynchronous done testing.
|
|
88
|
+
*/
|
|
48
89
|
export type TestDoneFunction = Fn<[context: () => boolean], void>;
|
|
90
|
+
/**
|
|
91
|
+
* Function type to construct test suites with custom implementation mocks.
|
|
92
|
+
*/
|
|
49
93
|
export type ToCreateTestsWithImplementation_F = <F extends Fn>(f: F, implementation: {
|
|
50
94
|
instanciation: () => Promise<F> | F;
|
|
51
95
|
name: string;
|
|
52
96
|
}) => (...cases: TestArgs<F>) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Function type for timer advancement utilities.
|
|
99
|
+
*/
|
|
53
100
|
export type FakeWaiter_F = (params: {
|
|
54
101
|
ms?: number;
|
|
55
102
|
times?: number;
|
|
56
103
|
fake: boolean;
|
|
57
104
|
}) => Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Transformer function type taking the return type of function `F`.
|
|
107
|
+
*
|
|
108
|
+
* @template | {@linkcode Fn} `F` - Function type.
|
|
109
|
+
* @template `R` - Output type.
|
|
110
|
+
*/
|
|
58
111
|
export type NextFn<F extends Fn, R = any> = Fn<[ReturnType<F>], R>;
|
|
112
|
+
/**
|
|
113
|
+
* Identity transform type for return value of function `F`.
|
|
114
|
+
*
|
|
115
|
+
* @template | {@linkcode Fn} `F` - Function type.
|
|
116
|
+
*/
|
|
59
117
|
export type Identity<F extends Fn> = Fn<[ReturnType<F>], ReturnType<F>>;
|
|
118
|
+
/**
|
|
119
|
+
* Chained function type combining parameters of `F` with return type of `T`.
|
|
120
|
+
*
|
|
121
|
+
* @template | {@linkcode Fn} `F` - Source function type.
|
|
122
|
+
* @template | {@linkcode NextFn} `T` - Transformer function type.
|
|
123
|
+
*/
|
|
60
124
|
export type ChainedFn<F extends Fn, T extends NextFn<F>> = Fn<Parameters<F>, ReR<T>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/dev-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"require": "./lib/rolldown-config/index.cjs",
|
|
25
25
|
"types": "./lib/rolldown-config/index.d.ts"
|
|
26
26
|
},
|
|
27
|
+
"./plugins": {
|
|
28
|
+
"import": "./lib/plugins/index.js",
|
|
29
|
+
"require": "./lib/plugins/index.cjs",
|
|
30
|
+
"types": "./lib/plugins/index.d.ts"
|
|
31
|
+
},
|
|
27
32
|
"./utils": {
|
|
28
33
|
"import": "./lib/utils/index.js",
|
|
29
34
|
"require": "./lib/utils/index.cjs",
|
|
@@ -90,30 +95,30 @@
|
|
|
90
95
|
"cmd-ts": "^0.15.0",
|
|
91
96
|
"edit-json-file": "^1.8.1",
|
|
92
97
|
"glob": "^13.0.6",
|
|
93
|
-
"oxc-transform": "^0.
|
|
98
|
+
"oxc-transform": "^0.147.0",
|
|
94
99
|
"rollup-plugin-circular-dependencies": "^2.0.1",
|
|
95
100
|
"rollup-plugin-node-externals": "^9.0.1",
|
|
96
101
|
"shelljs": "^0.10.0",
|
|
97
102
|
"sort-keys": "^6.0.1",
|
|
98
|
-
"tsc-alias": "^1.9.
|
|
103
|
+
"tsc-alias": "^1.9.2"
|
|
99
104
|
},
|
|
100
105
|
"devDependencies": {
|
|
101
106
|
"@bemedev/app-ts": "3.0.2",
|
|
102
107
|
"@bemedev/basifun": "0.5.3",
|
|
103
108
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
104
109
|
"@types/edit-json-file": "^1.7.4",
|
|
105
|
-
"@types/node": "^26.
|
|
110
|
+
"@types/node": "^26.4.0",
|
|
106
111
|
"@types/shelljs": "^0.10.0",
|
|
107
|
-
"@vitest/ui": "4.1.
|
|
108
|
-
"rolldown": "^1.2.
|
|
112
|
+
"@vitest/ui": "4.1.11",
|
|
113
|
+
"rolldown": "^1.2.6",
|
|
109
114
|
"unplugin-dts": "^1.0.3",
|
|
110
|
-
"vitest": "4.1.
|
|
115
|
+
"vitest": "4.1.11",
|
|
111
116
|
"zod": "^4.4.3",
|
|
112
117
|
"zx": "^8.8.5"
|
|
113
118
|
},
|
|
114
119
|
"peerDependencies": {
|
|
115
|
-
"rolldown": "^1.2.
|
|
116
|
-
"vitest": "4.1.
|
|
120
|
+
"rolldown": "^1.2.6",
|
|
121
|
+
"vitest": "4.1.11"
|
|
117
122
|
},
|
|
118
123
|
"scripts": {
|
|
119
124
|
"build": "pnpm run rm:lib && pnpm run rolldown",
|