@hg-ts/tests 0.7.27 → 0.8.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/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@hg-ts/tests",
3
- "version": "0.7.27",
3
+ "version": "0.8.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "exports": {
7
- ".": "./dist/index.js",
7
+ ".": {
8
+ "browser": "./dist/browser.js",
9
+ "node": "./dist/index.js",
10
+ "default": "./dist/index.js"
11
+ },
8
12
  "./config": "./vitest.config.mjs",
9
- "./config-full-coverage": "./vitest.config-full-coverage.mjs",
10
- "./browser": "./dist/browser.js"
13
+ "./browser-config": "./vitest.browser.config.mjs"
11
14
  },
12
15
  "repository": "git@gitlab.com:hyper-graph/framework.git",
13
16
  "scripts": {
@@ -26,12 +29,14 @@
26
29
  "unplugin-swc": "1.5.9"
27
30
  },
28
31
  "devDependencies": {
29
- "@hg-ts-config/typescript": "0.7.27",
30
- "@hg-ts/linter": "0.7.27",
31
- "@hg-ts/types": "0.7.27",
32
+ "@hg-ts-config/typescript": "0.8.0",
33
+ "@hg-ts/linter": "0.8.0",
34
+ "@hg-ts/types": "0.8.0",
32
35
  "@types/node": "22.19.1",
36
+ "@vitest/browser-playwright": "4.0.14",
33
37
  "@vitest/coverage-v8": "4.0.14",
34
38
  "eslint": "9.18.0",
39
+ "playwright": "1.55.0",
35
40
  "reflect-metadata": "0.2.2",
36
41
  "ts-node": "10.9.2",
37
42
  "tsc-watch": "6.3.0",
@@ -41,9 +46,19 @@
41
46
  "vitest": "4.0.14"
42
47
  },
43
48
  "peerDependencies": {
49
+ "@vitest/browser-playwright": "*",
44
50
  "@vitest/coverage-v8": "*",
51
+ "playwright": "*",
45
52
  "reflect-metadata": "*",
46
53
  "tslib": "*",
47
54
  "vitest": "*"
55
+ },
56
+ "peerDependenciesMeta": {
57
+ "@vitest/browser-playwright": {
58
+ "optional": true
59
+ },
60
+ "playwright": {
61
+ "optional": true
62
+ }
48
63
  }
49
64
  }
@@ -0,0 +1,29 @@
1
+ import { playwright } from '@vitest/browser-playwright';
2
+ import { defineConfig, defineProject } from 'vitest/config';
3
+ import { BASE_CONFIG, mergeConfig } from './vitest.common.config.mjs';
4
+
5
+ export const CHROMIUM_TEST_PROJECT = defineProject({
6
+ test: {
7
+ name: 'chromium',
8
+ browser: {
9
+ enabled: true,
10
+ headless: true,
11
+ instances: [ { browser: 'chromium' } ],
12
+ screenshotFailures: false,
13
+ ui: false,
14
+ provider: playwright({
15
+ launchOptions: {
16
+ headless: true,
17
+ },
18
+ }),
19
+ },
20
+ include: [ 'src/**/*.test.ts' ],
21
+ exclude: [ 'src/**/*.node.test.ts' ],
22
+ },
23
+ });
24
+
25
+ export const CHROMIUM_TEST_CONFIG = defineConfig({
26
+ test: {
27
+ projects: [mergeConfig(BASE_CONFIG, CHROMIUM_TEST_PROJECT)],
28
+ },
29
+ });
@@ -0,0 +1,119 @@
1
+ import swc from 'unplugin-swc';
2
+ import { defineConfig, defineProject, mergeConfig as viMergeConfig } from 'vitest/config';
3
+
4
+ export function mergeConfig(base, ...configs) {
5
+ return configs.reduce((acc, config) => viMergeConfig(acc, config), base);
6
+ }
7
+
8
+ export const BASE_CONFIG = defineConfig({
9
+ plugins: [
10
+ swc.vite({
11
+ module: { type: 'es6' },
12
+ }),
13
+ ],
14
+ });
15
+
16
+
17
+ export const NODE_TEST_PROJECT = defineProject({
18
+ test: {
19
+ name: 'node',
20
+ include: [ 'src/**/*.test.ts' ],
21
+ exclude: [ 'src/**/*.browser.test.ts' ],
22
+ },
23
+ });
24
+
25
+ export const NODE_TEST_CONFIG = defineConfig({
26
+ test: {
27
+ projects: [mergeConfig(BASE_CONFIG, NODE_TEST_PROJECT)],
28
+ },
29
+ });
30
+
31
+ export const TEST_CONFIG = defineConfig({
32
+ test: {
33
+ globals: false,
34
+ passWithNoTests: true,
35
+ exclude: [ 'dist' ],
36
+ slowTestThreshold: 100,
37
+ silent: 'passed-only',
38
+ env: {
39
+ HG_ENV: 'test',
40
+ },
41
+ coverage: {
42
+ enabled: true,
43
+ reporter: [
44
+ 'text-summary',
45
+ 'text',
46
+ ],
47
+ provider: 'v8',
48
+ clean: true,
49
+ cleanOnRerun: true,
50
+ skipFull: true,
51
+ exclude: [
52
+ '*/migrations/*',
53
+ '*/tests/*',
54
+ 'main.ts',
55
+ 'create-container.ts',
56
+ ],
57
+ include: [ 'src/**/*.{ts,tsx}' ],
58
+ },
59
+ },
60
+ });
61
+
62
+ export const FULL_COVERAGE_OVERRIDES = defineConfig({
63
+ test: {
64
+ coverage: {
65
+ thresholds: {
66
+ statements: 100,
67
+ branches: 100,
68
+ functions: 100,
69
+ lines: 100,
70
+ },
71
+ watermarks: {
72
+ statements: [100, 100],
73
+ branches: [100, 100],
74
+ functions: [100, 100],
75
+ lines: [100, 100],
76
+ },
77
+ },
78
+ },
79
+ });
80
+
81
+ export const BASE_COVERAGE_OVERRIDES = defineConfig({
82
+ test: {
83
+ coverage: {
84
+ thresholds: {
85
+ statements: 80,
86
+ branches: 80,
87
+ functions: 80,
88
+ lines: 80,
89
+ },
90
+ watermarks: {
91
+ statements: [80, 95],
92
+ branches: [80, 95],
93
+ functions: [80, 95],
94
+ lines: [80, 95],
95
+ },
96
+ },
97
+ },
98
+ });
99
+
100
+ export const LOW_COVERAGE_OVERRIDES = defineConfig({
101
+ test: {
102
+ coverage: {
103
+ thresholds: {
104
+ statements: 50,
105
+ branches: 50,
106
+ functions: 50,
107
+ lines: 50,
108
+ },
109
+ watermarks: {
110
+ statements: [70, 90],
111
+ branches: [70, 90],
112
+ functions: [70, 90],
113
+ lines: [70, 90],
114
+ },
115
+ },
116
+ },
117
+ });
118
+
119
+ export { defineConfig, defineProject };
package/vitest.config.mjs CHANGED
@@ -1,46 +1,5 @@
1
- import swc from 'unplugin-swc';
2
- import { defineConfig } from 'vitest/config';
1
+ import { BASE_CONFIG, mergeConfig, TEST_CONFIG } from './vitest.common.config.mjs';
3
2
 
4
- export default defineConfig({
5
- test: {
6
- globals: false,
7
- exclude: ['dist'],
8
- slowTestThreshold: 100,
9
- silent: 'passed-only',
10
- env: {
11
- HG_ENV: 'test',
12
- },
13
- coverage: {
14
- enabled: true,
15
- reporter: ['text-summary', 'text'],
16
- provider: 'v8',
17
- thresholds: {
18
- statements: 80,
19
- branches: 80,
20
- functions: 80,
21
- lines: 80,
22
- },
23
- clean: true,
24
- cleanOnRerun: true,
25
- skipFull: true,
26
- watermarks: {
27
- statements: [80, 95],
28
- branches: [80, 95],
29
- functions: [80, 95],
30
- lines: [80, 95],
31
- },
32
- exclude: [
33
- '*/migrations/*',
34
- '*/tests/*',
35
- 'main.ts',
36
- 'create-container.ts',
37
- ],
38
- include: ['src/**/*.{ts,tsx}'],
39
- }
40
- },
41
- plugins: [
42
- swc.vite({
43
- module: { type: 'es6' },
44
- }),
45
- ],
46
- });
3
+ export * from './vitest.common.config.mjs';
4
+
5
+ export default mergeConfig(BASE_CONFIG, TEST_CONFIG);
@@ -1,23 +0,0 @@
1
- import baseConfig from './vitest.config.mjs';
2
-
3
- export default {
4
- ...baseConfig,
5
- test: {
6
- ...baseConfig.test,
7
- coverage: {
8
- ...baseConfig.test.coverage,
9
- thresholds: {
10
- statements: 100,
11
- branches: 100,
12
- functions: 100,
13
- lines: 100,
14
- },
15
- watermarks: {
16
- statements: [100, 100],
17
- branches: [100, 100],
18
- functions: [100, 100],
19
- lines: [100, 100],
20
- },
21
- },
22
- },
23
- };