@yeger/vitest-utils 1.0.1 → 1.2.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.
@@ -0,0 +1,35 @@
1
+ import { TestUserConfig } from "vitest/config";
2
+ import { BrowserProviderOption } from "vitest/node";
3
+
4
+ //#region src/config.d.ts
5
+ declare const configuration: Record<string, TestUserConfig>;
6
+ interface ConfigurationOptions {
7
+ /**
8
+ * Enables common configuration options. Default: `true`
9
+ */
10
+ common?: boolean;
11
+ /**
12
+ * Enable coverage configuration. Default: `true`
13
+ */
14
+ coverage?: boolean;
15
+ /**
16
+ * Enable idempotent configuration. Default: `true`
17
+ */
18
+ idempotent?: boolean;
19
+ /**
20
+ * Specify the browser provider option. If defined, the browser mode will be auto-configured.
21
+ */
22
+ browser?: BrowserProviderOption;
23
+ }
24
+ /**
25
+ * Define a Vitest test configuration with coverage, idempotent settings, and browser support.
26
+ */
27
+ declare function defineTestConfig({
28
+ common,
29
+ coverage,
30
+ idempotent,
31
+ browser
32
+ }?: ConfigurationOptions, userConfig?: TestUserConfig): TestUserConfig;
33
+ //#endregion
34
+ export { ConfigurationOptions, configuration, defineTestConfig };
35
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;cAKa,aAAA,EAAe,MAAA,SAAe,cAAA;AAAA,UAqB1B,oBAAA;EArBjB;;;EAyBE,MAAA;EAzByC;AAqB3C;;EAQE,QAAA;EAQU;;;EAJV,UAAA;;;;EAIA,OAAA,GAAU,qBAAA;AAAA;;;;iBAMI,gBAAA,CAAA;EACZ,MAAA;EAAe,QAAA;EAAiB,UAAA;EAAmB;AAAA,IAAW,oBAAA,EAChE,UAAA,GAAY,cAAA,GACX,cAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,43 @@
1
+ import process from "node:process";
2
+ import deepmerge from "@yeger/deepmerge";
3
+
4
+ //#region src/config.ts
5
+ const configuration = {
6
+ common: { silent: "passed-only" },
7
+ coverage: { coverage: {
8
+ enabled: !!process.env.COVERAGE,
9
+ include: ["src/**/*.*"],
10
+ exclude: [
11
+ "*.d.ts",
12
+ "*.ohm",
13
+ ".gitignore"
14
+ ],
15
+ provider: "v8"
16
+ } },
17
+ idempotent: {
18
+ clearMocks: true,
19
+ mockReset: true,
20
+ restoreMocks: true,
21
+ unstubEnvs: true,
22
+ unstubGlobals: true
23
+ }
24
+ };
25
+ /**
26
+ * Define a Vitest test configuration with coverage, idempotent settings, and browser support.
27
+ */
28
+ function defineTestConfig({ common = true, coverage = true, idempotent = true, browser } = {}, userConfig = {}) {
29
+ const config = {};
30
+ if (common) Object.assign(config, configuration.common);
31
+ if (coverage) Object.assign(config, configuration.coverage);
32
+ if (idempotent) Object.assign(config, configuration.idempotent);
33
+ if (browser) config.browser = {
34
+ enabled: true,
35
+ provider: browser,
36
+ instances: [{ browser: "chromium" }]
37
+ };
38
+ return deepmerge(config, userConfig);
39
+ }
40
+
41
+ //#endregion
42
+ export { configuration, defineTestConfig };
43
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import process from 'node:process'\nimport type { TestUserConfig } from 'vitest/config'\nimport type { BrowserProviderOption } from 'vitest/node'\nimport deepmerge from '@yeger/deepmerge'\n\nexport const configuration: Record<string, TestUserConfig> = {\n common: {\n silent: 'passed-only',\n },\n coverage: {\n coverage: {\n enabled: !!process.env.COVERAGE,\n include: ['src/**/*.*'],\n exclude: ['*.d.ts', '*.ohm', '.gitignore'],\n provider: 'v8' as const,\n },\n },\n idempotent: {\n clearMocks: true,\n mockReset: true,\n restoreMocks: true,\n unstubEnvs: true,\n unstubGlobals: true,\n },\n}\n\nexport interface ConfigurationOptions {\n /**\n * Enables common configuration options. Default: `true`\n */\n common?: boolean\n /**\n * Enable coverage configuration. Default: `true`\n */\n coverage?: boolean\n /**\n * Enable idempotent configuration. Default: `true`\n */\n idempotent?: boolean\n /**\n * Specify the browser provider option. If defined, the browser mode will be auto-configured.\n */\n browser?: BrowserProviderOption\n}\n\n/**\n * Define a Vitest test configuration with coverage, idempotent settings, and browser support.\n */\nexport function defineTestConfig(\n { common = true, coverage = true, idempotent = true, browser }: ConfigurationOptions = {},\n userConfig: TestUserConfig = {},\n): TestUserConfig {\n const config: TestUserConfig = {}\n\n if (common) {\n Object.assign(config, configuration.common)\n }\n\n if (coverage) {\n Object.assign(config, configuration.coverage)\n }\n\n if (idempotent) {\n Object.assign(config, configuration.idempotent)\n }\n\n if (browser) {\n config.browser = {\n enabled: true,\n provider: browser,\n instances: [{ browser: 'chromium' }],\n }\n }\n\n return deepmerge(config, userConfig) as TestUserConfig\n}\n"],"mappings":";;;;AAKA,MAAa,gBAAgD;CAC3D,QAAQ,EACN,QAAQ,eACT;CACD,UAAU,EACR,UAAU;EACR,SAAS,CAAC,CAAC,QAAQ,IAAI;EACvB,SAAS,CAAC,aAAa;EACvB,SAAS;GAAC;GAAU;GAAS;GAAa;EAC1C,UAAU;EACX,EACF;CACD,YAAY;EACV,YAAY;EACZ,WAAW;EACX,cAAc;EACd,YAAY;EACZ,eAAe;EAChB;CACF;;;;AAwBD,SAAgB,iBACd,EAAE,SAAS,MAAM,WAAW,MAAM,aAAa,MAAM,YAAkC,EAAE,EACzF,aAA6B,EAAE,EACf;CAChB,MAAM,SAAyB,EAAE;AAEjC,KAAI,OACF,QAAO,OAAO,QAAQ,cAAc,OAAO;AAG7C,KAAI,SACF,QAAO,OAAO,QAAQ,cAAc,SAAS;AAG/C,KAAI,WACF,QAAO,OAAO,QAAQ,cAAc,WAAW;AAGjD,KAAI,QACF,QAAO,UAAU;EACf,SAAS;EACT,UAAU;EACV,WAAW,CAAC,EAAE,SAAS,YAAY,CAAC;EACrC;AAGH,QAAO,UAAU,QAAQ,WAAW"}
package/package.json CHANGED
@@ -1,49 +1,52 @@
1
1
  {
2
2
  "name": "@yeger/vitest-utils",
3
- "type": "module",
4
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
+ "bugs": {
5
+ "url": "https://github.com/DerYeger/yeger/issues"
6
+ },
7
+ "license": "MIT",
5
8
  "author": {
6
9
  "name": "Jan Müller",
7
10
  "url": "https://github.com/DerYeger"
8
11
  },
9
- "license": "MIT",
10
12
  "repository": {
11
13
  "type": "git",
12
14
  "url": "git+https://github.com/DerYeger/yeger.git",
13
15
  "directory": "packages/vitest-utils"
14
16
  },
15
- "bugs": {
16
- "url": "https://github.com/DerYeger/yeger/issues"
17
- },
17
+ "files": [
18
+ "dist/*"
19
+ ],
20
+ "type": "module",
18
21
  "sideEffects": false,
22
+ "types": "dist/index.d.mts",
19
23
  "exports": {
20
24
  ".": {
21
25
  "import": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
26
+ "types": "./dist/index.d.mts",
27
+ "default": "./dist/index.mjs"
24
28
  }
25
29
  }
26
30
  },
27
- "types": "dist/index.d.ts",
28
- "files": [
29
- "dist/*"
30
- ],
31
- "peerDependencies": {
32
- "vitest": "^4.0.0"
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "dependencies": {
35
+ "@yeger/deepmerge": "2.0.17"
33
36
  },
34
37
  "devDependencies": {
35
- "tsdown": "0.15.11",
38
+ "publint": "0.3.17",
39
+ "tsdown": "0.20.3",
36
40
  "typescript": "5.9.3",
37
41
  "@yeger/tsconfig": "2.1.2"
38
42
  },
39
- "publishConfig": {
40
- "access": "public"
43
+ "peerDependencies": {
44
+ "vitest": "^4.0.0"
41
45
  },
42
46
  "scripts": {
43
47
  "build": "tsdown",
44
48
  "check:publish": "publint run --strict",
45
49
  "check:tsc": "tsc",
46
- "dev": "tsdown --watch",
47
- "lint": "yeger-lint"
50
+ "dev": "tsdown --watch"
48
51
  }
49
52
  }
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { TestUserConfig } from "vitest/config";
2
-
3
- //#region src/config.d.ts
4
- declare const configuration: Record<string, TestUserConfig>;
5
- //#endregion
6
- export { configuration };
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":["configuration: Record<string, TestUserConfig>"],"sources":["../src/config.ts"],"sourcesContent":[],"mappings":";;;cAGaA,eAAe,eAAe"}
package/dist/index.js DELETED
@@ -1,27 +0,0 @@
1
- import process from "node:process";
2
-
3
- //#region src/config.ts
4
- const configuration = {
5
- coverage: { coverage: {
6
- enabled: !!process.env.COVERAGE,
7
- include: ["src/**/*.*"],
8
- exclude: [
9
- "*.d.ts",
10
- "*.ohm",
11
- ".gitignore"
12
- ],
13
- provider: "v8"
14
- } },
15
- idempotent: {
16
- clearMocks: true,
17
- mockReset: true,
18
- restoreMocks: true,
19
- sequence: { shuffle: true },
20
- unstubEnvs: true,
21
- unstubGlobals: true
22
- }
23
- };
24
-
25
- //#endregion
26
- export { configuration };
27
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["configuration: Record<string, TestUserConfig>"],"sources":["../src/config.ts"],"sourcesContent":["import process from 'node:process'\nimport type { TestUserConfig } from 'vitest/config'\n\nexport const configuration: Record<string, TestUserConfig> = {\n coverage: {\n coverage: {\n enabled: !!process.env.COVERAGE,\n include: ['src/**/*.*'],\n exclude: ['*.d.ts', '*.ohm', '.gitignore'],\n provider: 'v8' as const,\n },\n },\n idempotent: {\n clearMocks: true,\n mockReset: true,\n restoreMocks: true,\n sequence: {\n shuffle: true,\n },\n unstubEnvs: true,\n unstubGlobals: true,\n },\n}\n"],"mappings":";;;AAGA,MAAaA,gBAAgD;CAC3D,UAAU,EACR,UAAU;EACR,SAAS,CAAC,CAAC,QAAQ,IAAI;EACvB,SAAS,CAAC,aAAa;EACvB,SAAS;GAAC;GAAU;GAAS;GAAa;EAC1C,UAAU;EACX,EACF;CACD,YAAY;EACV,YAAY;EACZ,WAAW;EACX,cAAc;EACd,UAAU,EACR,SAAS,MACV;EACD,YAAY;EACZ,eAAe;EAChB;CACF"}