@yeger/vitest-utils 1.1.0 → 1.2.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/dist/index.d.mts CHANGED
@@ -5,11 +5,15 @@ import { BrowserProviderOption } from "vitest/node";
5
5
  declare const configuration: Record<string, TestUserConfig>;
6
6
  interface ConfigurationOptions {
7
7
  /**
8
- * Enable coverage configuration. Default: true
8
+ * Enables common configuration options. Default: `true`
9
+ */
10
+ common?: boolean;
11
+ /**
12
+ * Enable coverage configuration. Default: `true`
9
13
  */
10
14
  coverage?: boolean;
11
15
  /**
12
- * Enable idempotent configuration. Default: true
16
+ * Enable idempotent configuration. Default: `true`
13
17
  */
14
18
  idempotent?: boolean;
15
19
  /**
@@ -21,10 +25,11 @@ interface ConfigurationOptions {
21
25
  * Define a Vitest test configuration with coverage, idempotent settings, and browser support.
22
26
  */
23
27
  declare function defineTestConfig({
28
+ common,
24
29
  coverage,
25
30
  idempotent,
26
31
  browser
27
- }?: ConfigurationOptions): TestUserConfig;
32
+ }?: ConfigurationOptions, userConfig?: TestUserConfig): TestUserConfig;
28
33
  //#endregion
29
34
  export { ConfigurationOptions, configuration, defineTestConfig };
30
35
  //# sourceMappingURL=index.d.mts.map
@@ -1 +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"}
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 CHANGED
@@ -1,7 +1,9 @@
1
1
  import process from "node:process";
2
+ import deepmerge from "deepmerge";
2
3
 
3
4
  //#region src/config.ts
4
5
  const configuration = {
6
+ common: { silent: "passed-only" },
5
7
  coverage: { coverage: {
6
8
  enabled: !!process.env.COVERAGE,
7
9
  include: ["src/**/*.*"],
@@ -16,7 +18,6 @@ const configuration = {
16
18
  clearMocks: true,
17
19
  mockReset: true,
18
20
  restoreMocks: true,
19
- sequence: { shuffle: true },
20
21
  unstubEnvs: true,
21
22
  unstubGlobals: true
22
23
  }
@@ -24,8 +25,9 @@ const configuration = {
24
25
  /**
25
26
  * Define a Vitest test configuration with coverage, idempotent settings, and browser support.
26
27
  */
27
- function defineTestConfig({ coverage = true, idempotent = true, browser } = {}) {
28
+ function defineTestConfig({ common = true, coverage = true, idempotent = true, browser } = {}, userConfig = {}) {
28
29
  const config = {};
30
+ if (common) Object.assign(config, configuration.common);
29
31
  if (coverage) Object.assign(config, configuration.coverage);
30
32
  if (idempotent) Object.assign(config, configuration.idempotent);
31
33
  if (browser) config.browser = {
@@ -33,7 +35,7 @@ function defineTestConfig({ coverage = true, idempotent = true, browser } = {})
33
35
  provider: browser,
34
36
  instances: [{ browser: "chromium" }]
35
37
  };
36
- return config;
38
+ return deepmerge(config, userConfig);
37
39
  }
38
40
 
39
41
  //#endregion
@@ -1 +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"}
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 '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,21 +1,25 @@
1
1
  {
2
2
  "name": "@yeger/vitest-utils",
3
- "type": "module",
4
- "version": "1.1.0",
3
+ "version": "1.2.1",
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": {
@@ -24,27 +28,25 @@
24
28
  }
25
29
  }
26
30
  },
27
- "types": "dist/index.d.mts",
28
- "files": [
29
- "dist/*"
30
- ],
31
- "peerDependencies": {
32
- "vitest": "^4.0.0"
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "dependencies": {
35
+ "deepmerge": "4.3.1"
33
36
  },
34
37
  "devDependencies": {
35
- "publint": "0.3.15",
36
- "tsdown": "0.16.1",
38
+ "publint": "0.3.17",
39
+ "tsdown": "0.20.3",
37
40
  "typescript": "5.9.3",
38
41
  "@yeger/tsconfig": "2.1.2"
39
42
  },
40
- "publishConfig": {
41
- "access": "public"
43
+ "peerDependencies": {
44
+ "vitest": "^4.0.0"
42
45
  },
43
46
  "scripts": {
44
47
  "build": "tsdown",
45
48
  "check:publish": "publint run --strict",
46
49
  "check:tsc": "tsc",
47
- "dev": "tsdown --watch",
48
- "lint": "yeger-lint"
50
+ "dev": "tsdown --watch"
49
51
  }
50
52
  }