@yeger/vitest-utils 1.0.0 → 1.1.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,30 @@
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
+ * Enable coverage configuration. Default: true
9
+ */
10
+ coverage?: boolean;
11
+ /**
12
+ * Enable idempotent configuration. Default: true
13
+ */
14
+ idempotent?: boolean;
15
+ /**
16
+ * Specify the browser provider option. If defined, the browser mode will be auto-configured.
17
+ */
18
+ browser?: BrowserProviderOption;
19
+ }
20
+ /**
21
+ * Define a Vitest test configuration with coverage, idempotent settings, and browser support.
22
+ */
23
+ declare function defineTestConfig({
24
+ coverage,
25
+ idempotent,
26
+ browser
27
+ }?: ConfigurationOptions): TestUserConfig;
28
+ //#endregion
29
+ export { ConfigurationOptions, configuration, defineTestConfig };
30
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":["configuration: Record<string, TestUserConfig>"],"sources":["../src/config.ts"],"sourcesContent":[],"mappings":";;;;cAIaA,eAAe,eAAe;UAqB1B,oBAAA;EArBjB;AAqBA;AAkBA;EAAmC,QAAA,CAAA,EAAA,OAAA;EAAiB;;;EAA0D,UAAA,CAAA,EAAA,OAAA;EAAA;;;YANlG;;;;;iBAMI,gBAAA;;;;IAAkE,uBAA4B"}
package/dist/index.mjs ADDED
@@ -0,0 +1,41 @@
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
+ * Define a Vitest test configuration with coverage, idempotent settings, and browser support.
26
+ */
27
+ function defineTestConfig({ coverage = true, idempotent = true, browser } = {}) {
28
+ const config = {};
29
+ if (coverage) Object.assign(config, configuration.coverage);
30
+ if (idempotent) Object.assign(config, configuration.idempotent);
31
+ if (browser) config.browser = {
32
+ enabled: true,
33
+ provider: browser,
34
+ instances: [{ browser: "chromium" }]
35
+ };
36
+ return config;
37
+ }
38
+
39
+ //#endregion
40
+ export { configuration, defineTestConfig };
41
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["configuration: Record<string, TestUserConfig>","config: TestUserConfig"],"sources":["../src/config.ts"],"sourcesContent":["import process from 'node:process'\nimport type { TestUserConfig } from 'vitest/config'\nimport type { BrowserProviderOption } from 'vitest/node'\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\nexport interface ConfigurationOptions {\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({ coverage = true, idempotent = true, browser }: ConfigurationOptions = {}): TestUserConfig {\n const config: TestUserConfig = {}\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 config\n}\n"],"mappings":";;;AAIA,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;;;;AAoBD,SAAgB,iBAAiB,EAAE,WAAW,MAAM,aAAa,MAAM,YAAkC,EAAE,EAAkB;CAC3H,MAAMC,SAAyB,EAAE;AAEjC,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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yeger/vitest-utils",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "author": {
6
6
  "name": "Jan Müller",
7
7
  "url": "https://github.com/DerYeger"
@@ -19,12 +19,12 @@
19
19
  "exports": {
20
20
  ".": {
21
21
  "import": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
22
+ "types": "./dist/index.d.mts",
23
+ "default": "./dist/index.mjs"
24
24
  }
25
25
  }
26
26
  },
27
- "types": "dist/index.d.ts",
27
+ "types": "dist/index.d.mts",
28
28
  "files": [
29
29
  "dist/*"
30
30
  ],
@@ -32,9 +32,10 @@
32
32
  "vitest": "^4.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "tsdown": "0.15.11",
35
+ "publint": "0.3.15",
36
+ "tsdown": "0.16.1",
36
37
  "typescript": "5.9.3",
37
- "@yeger/tsconfig": "2.1.1"
38
+ "@yeger/tsconfig": "2.1.2"
38
39
  },
39
40
  "publishConfig": {
40
41
  "access": "public"
package/dist/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- //#region src/config.d.ts
2
- declare const configuration: {
3
- coverage: {
4
- coverage: {
5
- enabled: boolean;
6
- include: string[];
7
- exclude: string[];
8
- provider: "v8";
9
- };
10
- };
11
- idempotent: {
12
- clearMocks: true;
13
- mockReset: true;
14
- restoreMocks: true;
15
- sequence: {
16
- shuffle: true;
17
- };
18
- unstubEnvs: true;
19
- unstubGlobals: true;
20
- };
21
- };
22
- //#endregion
23
- export { configuration };
package/dist/index.js DELETED
@@ -1,26 +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 };