@webpresso/agent-config 0.1.4 → 0.1.5

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.
Files changed (51) hide show
  1. package/package.json +36 -12
  2. package/dist/esm/stryker/index.d.ts +0 -135
  3. package/dist/esm/stryker/index.js +0 -128
  4. package/dist/esm/tsconfig/base.json +0 -37
  5. package/dist/esm/tsconfig/cloudflare.json +0 -10
  6. package/dist/esm/tsconfig/library.json +0 -16
  7. package/dist/esm/tsconfig/react-library.json +0 -10
  8. package/dist/esm/tsconfig/react-router.json +0 -10
  9. package/dist/esm/vitest/bun-sqlite-shim.d.ts +0 -14
  10. package/dist/esm/vitest/bun-sqlite-shim.js +0 -14
  11. package/dist/esm/vitest/consumer-package.d.ts +0 -4
  12. package/dist/esm/vitest/consumer-package.js +0 -63
  13. package/dist/esm/vitest/flakiness-reporter.d.ts +0 -7
  14. package/dist/esm/vitest/flakiness-reporter.js +0 -53
  15. package/dist/esm/vitest/generated-runtime-aliases.d.ts +0 -6
  16. package/dist/esm/vitest/generated-runtime-aliases.js +0 -3
  17. package/dist/esm/vitest/node-setup.d.ts +0 -6
  18. package/dist/esm/vitest/node-setup.js +0 -16
  19. package/dist/esm/vitest/node.d.ts +0 -43
  20. package/dist/esm/vitest/node.js +0 -180
  21. package/dist/esm/vitest/pool-defaults.d.ts +0 -11
  22. package/dist/esm/vitest/pool-defaults.js +0 -43
  23. package/dist/esm/vitest/react-router.d.ts +0 -22
  24. package/dist/esm/vitest/react-router.js +0 -83
  25. package/dist/esm/vitest/react-setup.d.ts +0 -13
  26. package/dist/esm/vitest/react-setup.js +0 -27
  27. package/dist/esm/vitest/react.d.ts +0 -22
  28. package/dist/esm/vitest/react.js +0 -85
  29. package/dist/esm/vitest/version-guard.d.ts +0 -7
  30. package/dist/esm/vitest/version-guard.js +0 -42
  31. package/dist/esm/vitest/workers.d.ts +0 -28
  32. package/dist/esm/vitest/workers.js +0 -44
  33. package/dist/esm/workers-test/cloudflare-types.d.ts +0 -30
  34. package/dist/esm/workers-test/cloudflare-types.js +0 -2
  35. package/dist/esm/workers-test/durable-objects.d.ts +0 -60
  36. package/dist/esm/workers-test/durable-objects.js +0 -73
  37. package/dist/esm/workers-test/env.d.ts +0 -58
  38. package/dist/esm/workers-test/env.js +0 -74
  39. package/dist/esm/workers-test/execution-context.d.ts +0 -21
  40. package/dist/esm/workers-test/execution-context.js +0 -22
  41. package/dist/esm/workers-test/index.d.ts +0 -16
  42. package/dist/esm/workers-test/index.js +0 -15
  43. package/dist/esm/workers-test/requests.d.ts +0 -44
  44. package/dist/esm/workers-test/requests.js +0 -71
  45. package/dist/esm/workers-test/setup.d.ts +0 -63
  46. package/dist/esm/workers-test/setup.js +0 -86
  47. package/tsconfig/base.json +0 -37
  48. package/tsconfig/cloudflare.json +0 -10
  49. package/tsconfig/library.json +0 -16
  50. package/tsconfig/react-library.json +0 -10
  51. package/tsconfig/react-router.json +0 -10
@@ -1,180 +0,0 @@
1
- /**
2
- * Shared Vitest configuration for Node.js packages
3
- *
4
- * Usage in vitest.config.ts:
5
- * ```ts
6
- * import { nodeConfig } from '@webpresso/agent-config/vitest/node'
7
- * import { defineConfig, mergeConfig } from 'vite-plus/test/config'
8
- *
9
- * export default mergeConfig(nodeConfig, defineConfig({
10
- * // Your overrides here
11
- * }))
12
- * ```
13
- */
14
- import { dirname, join } from 'node:path';
15
- import { fileURLToPath } from 'node:url';
16
- import { defineConfig } from 'vite-plus/test/config';
17
- import { createFlakinessReporter } from './flakiness-reporter.js';
18
- import { generatedRuntimeAliases } from './generated-runtime-aliases.js';
19
- import { resolvedExecArgv, resolvedMaxWorkers, resolvedPool } from './pool-defaults.js';
20
- import { assertNonWorkersVitest4 } from './version-guard.js';
21
- const __dirname = dirname(fileURLToPath(import.meta.url));
22
- const configDir = __dirname;
23
- assertNonWorkersVitest4({ caller: 'nodeConfig' });
24
- // Route bun:sqlite → better-sqlite3 shim so Node-based vitest can load `@webpresso/agent-kit/blueprint`.
25
- const bunSqliteAlias = [
26
- {
27
- find: /^bun:sqlite$/,
28
- replacement: join(configDir, 'bun-sqlite-shim.js'),
29
- },
30
- ];
31
- // Force @webpresso/* packages through Vite's transform so the bun:sqlite alias applies even when imported from node_modules.
32
- const webpressoInline = {
33
- deps: { inline: [/webpresso/] },
34
- };
35
- /**
36
- * Create vitest projects for unit/integration test split.
37
- *
38
- * Usage in vitest.config.ts:
39
- * ```ts
40
- * import { nodeConfig, createNodeProjects } from '@webpresso/agent-config/vitest/node'
41
- * import { mergeConfig } from 'vite-plus/test/config'
42
- *
43
- * export default mergeConfig(nodeConfig, {
44
- * test: { projects: createNodeProjects('my-package') },
45
- * })
46
- * ```
47
- *
48
- * @param name - Package name used as vitest project name prefix (e.g. 'deploy' → 'deploy/unit', 'deploy/integration')
49
- * @param options - Optional overrides for unit/integration include patterns
50
- */
51
- export function createNodeProjects(name, options = {}) {
52
- const unitInclude = options.unitInclude ?? [
53
- 'src/**/*.test.ts',
54
- 'src/**/__tests__/**/*.test.{ts,tsx}',
55
- 'src/**/__tests__/**/*.spec.{ts,tsx}',
56
- ];
57
- const extraUnitExclude = options.unitExclude ?? [];
58
- const integrationInclude = options.integrationInclude ?? ['src/**/*.integration.test.ts'];
59
- const projectMaxWorkers = options.maxWorkers ?? resolvedMaxWorkers;
60
- const projectFileParallelism = options.fileParallelism;
61
- const projectIsolate = options.isolate;
62
- const projectTestTimeout = options.testTimeout;
63
- const sharedResolve = {
64
- alias: [...generatedRuntimeAliases, ...bunSqliteAlias],
65
- tsconfigPaths: true,
66
- };
67
- return [
68
- {
69
- resolve: sharedResolve,
70
- server: webpressoInline,
71
- test: {
72
- server: webpressoInline,
73
- name: `${name}/unit`,
74
- globals: true,
75
- restoreMocks: true,
76
- environment: 'node',
77
- pool: resolvedPool,
78
- maxWorkers: projectMaxWorkers,
79
- fileParallelism: projectFileParallelism,
80
- isolate: projectIsolate,
81
- ...(projectTestTimeout !== undefined && { testTimeout: projectTestTimeout }),
82
- include: unitInclude,
83
- exclude: [
84
- '**/*.integration.test.ts',
85
- '**/.stryker-tmp/**',
86
- 'node_modules/**',
87
- ...extraUnitExclude,
88
- ],
89
- },
90
- },
91
- {
92
- resolve: sharedResolve,
93
- server: webpressoInline,
94
- test: {
95
- name: `${name}/integration`,
96
- globals: true,
97
- restoreMocks: true,
98
- environment: 'node',
99
- pool: resolvedPool,
100
- maxWorkers: projectMaxWorkers,
101
- fileParallelism: projectFileParallelism,
102
- isolate: projectIsolate,
103
- ...(projectTestTimeout !== undefined && { testTimeout: projectTestTimeout }),
104
- execArgv: resolvedExecArgv,
105
- onConsoleLog: () => false,
106
- silent: process.env.VITEST_CONSOLE === '1' ? false : 'passed-only',
107
- setupFiles: [join(configDir, 'node-setup.js')],
108
- include: integrationInclude,
109
- exclude: ['**/.stryker-tmp/**', 'node_modules/**'],
110
- reporters: ['default', createFlakinessReporter()],
111
- retry: process.env.CI ? 2 : 0,
112
- },
113
- },
114
- ];
115
- }
116
- export const nodeConfig = defineConfig({
117
- resolve: {
118
- alias: [...generatedRuntimeAliases, ...bunSqliteAlias],
119
- tsconfigPaths: true,
120
- },
121
- server: webpressoInline,
122
- test: {
123
- globals: true,
124
- restoreMocks: true,
125
- environment: 'node',
126
- setupFiles: [join(configDir, 'node-setup.js')],
127
- onConsoleLog: () => false, // Suppress all console output
128
- pool: resolvedPool,
129
- // Suppress console output in tests by default.
130
- // Tests should assert behavior, not log to stdout.
131
- // To see console output, run with VITEST_CONSOLE=1.
132
- silent: process.env.VITEST_CONSOLE === '1' ? false : 'passed-only',
133
- // Note: Vitest v4 removed poolOptions - maxWorkers are now top-level
134
- maxWorkers: resolvedMaxWorkers,
135
- // Cap each fork worker's V8 heap to 2GB (Node 24 default is 4.2GB).
136
- // Measured worker RSS is ~100-200MB; the cap just prevents runaway GC laziness.
137
- // OOM prevention relies on the shared workspace scheduler and capped workers,
138
- // not heap limits — process count is the dominant memory factor.
139
- execArgv: resolvedExecArgv,
140
- teardownTimeout: 10000,
141
- include: [
142
- 'src/**/*.test.ts',
143
- 'src/**/__tests__/**/*.test.{ts,tsx}',
144
- 'src/**/__tests__/**/*.spec.{ts,tsx}',
145
- ],
146
- exclude: ['**/.stryker-tmp/**', 'node_modules/**'],
147
- reporters: ['default', createFlakinessReporter()],
148
- retry: process.env.CI ? 2 : 0,
149
- coverage: {
150
- provider: 'istanbul',
151
- reporter: ['text', 'json', 'html', 'lcov'],
152
- include: ['src/**/*.ts'],
153
- exclude: [
154
- 'node_modules/',
155
- 'dist/',
156
- '**/*.d.ts',
157
- '**/*.config.*',
158
- '**/tests/**',
159
- '**/__tests__/**',
160
- '**/__test-utils__/**',
161
- '**/*.test.ts',
162
- '**/*.spec.ts',
163
- '**/index.ts', // Common exclusion for barrel exports
164
- '**/types.ts',
165
- '**/types/**',
166
- ],
167
- // Industry-standard 80% coverage thresholds (Atlassian recommendation)
168
- // 80% catches critical gaps without excessive build failures
169
- // Branches at 75% as they're harder to cover comprehensively
170
- thresholds: {
171
- lines: 80,
172
- branches: 75,
173
- functions: 80,
174
- statements: 80,
175
- },
176
- },
177
- },
178
- });
179
- export default nodeConfig;
180
- //# sourceMappingURL=node.js.map
@@ -1,11 +0,0 @@
1
- /**
2
- * Shared pool/worker configuration defaults.
3
- *
4
- * Centralizes shared-runner detection, env var overrides, Stryker compatibility,
5
- * and execArgv logic used by node.ts, react.ts, and react-router.ts.
6
- */
7
- export declare const resolvedPool: string;
8
- export declare const resolvedMaxWorkers: number;
9
- export declare const resolvedMinWorkers: number;
10
- export declare const resolvedExecArgv: string[];
11
- //# sourceMappingURL=pool-defaults.d.ts.map
@@ -1,43 +0,0 @@
1
- /**
2
- * Shared pool/worker configuration defaults.
3
- *
4
- * Centralizes shared-runner detection, env var overrides, Stryker compatibility,
5
- * and execArgv logic used by node.ts, react.ts, and react-router.ts.
6
- */
7
- import { cpus } from 'node:os';
8
- // Shared workspace runners need tighter worker caps to avoid oversubscription.
9
- // `VP_RUN_CONCURRENCY_LIMIT` is the native Vite+ knob for shared task scheduling.
10
- const underSharedWorkspaceRunner = !!process.env.VP_RUN_CONCURRENCY_LIMIT;
11
- // Under a shared runner, default to a single Vitest worker per package.
12
- // The workspace runner already provides outer parallelism, and allowing many
13
- // inner fork workers causes frequent shutdown timeouts and EPIPE crashes on
14
- // large happy-dom / integration suites.
15
- const MAX_WORKERS = underSharedWorkspaceRunner ? 1 : Math.max(1, Math.floor(cpus().length * 0.75));
16
- const parsePositiveInt = (value) => {
17
- if (!value)
18
- return;
19
- const parsed = Number.parseInt(value, 10);
20
- return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
21
- };
22
- const requestedPool = process.env.VITEST_POOL;
23
- const disableExecArgv = process.env.VITEST_DISABLE_EXEC_ARGV === '1';
24
- const forcedMaxWorkers = parsePositiveInt(process.env.VITEST_MAX_WORKERS);
25
- const forcedMinWorkers = parsePositiveInt(process.env.VITEST_MIN_WORKERS);
26
- const isStryker = process.env.STRYKER_MUTATOR_WORKER !== undefined;
27
- // Stryker's Vitest runner forces pool: 'threads' which rejects Node execArgv flags.
28
- // Auto-clear execArgv to prevent ERR_WORKER_INVALID_EXEC_ARGV crashes.
29
- // See: https://vitest.dev/config/pool.html#threads
30
- export const resolvedPool = requestedPool === 'threads' ? 'threads' : 'forks';
31
- export const resolvedMaxWorkers = forcedMaxWorkers ?? MAX_WORKERS;
32
- export const resolvedMinWorkers = forcedMinWorkers ?? 1;
33
- // --max-old-space-size=1536: Cap V8 heap to 1.5GB (Node 24 default is 4.2GB).
34
- // Actual worker RSS is 100-230MB; 1.5GB is 6× headroom while reducing phys_footprint
35
- // (macOS jetsam counts 2-3× RSS). Prevents runaway heap growth from keeping GC lazy.
36
- // --no-experimental-webstorage: Node 24+ enables Web Storage API by default, which emits
37
- // "Warning: `--localstorage-file` was provided without a valid path" in fork workers.
38
- // Tests mock localStorage themselves; the built-in implementation is not needed.
39
- // See: https://github.com/nodejs/node/issues/60303
40
- export const resolvedExecArgv = disableExecArgv || resolvedPool === 'threads' || isStryker
41
- ? []
42
- : ['--max-old-space-size=1536', '--no-experimental-webstorage'];
43
- //# sourceMappingURL=pool-defaults.js.map
@@ -1,22 +0,0 @@
1
- /**
2
- * Shared Vitest configuration for React Router apps (pages)
3
- *
4
- * Usage in vitest.config.ts:
5
- * ```ts
6
- * import { reactRouterConfig } from '@webpresso/agent-config/vitest/react-router'
7
- * import { defineConfig, mergeConfig } from 'vite-plus/test/config'
8
- *
9
- * export default mergeConfig(reactRouterConfig, defineConfig({
10
- * test: {
11
- * setupFiles: ['./test/setup.ts'],
12
- * env: {
13
- * VITE_PUBLIC_APP_URL: 'http://localhost:3001',
14
- * },
15
- * },
16
- * }))
17
- * ```
18
- */
19
- import type { ViteUserConfigExport } from 'vite-plus/test/config';
20
- export declare const reactRouterConfig: ViteUserConfigExport;
21
- export default reactRouterConfig;
22
- //# sourceMappingURL=react-router.d.ts.map
@@ -1,83 +0,0 @@
1
- /**
2
- * Shared Vitest configuration for React Router apps (pages)
3
- *
4
- * Usage in vitest.config.ts:
5
- * ```ts
6
- * import { reactRouterConfig } from '@webpresso/agent-config/vitest/react-router'
7
- * import { defineConfig, mergeConfig } from 'vite-plus/test/config'
8
- *
9
- * export default mergeConfig(reactRouterConfig, defineConfig({
10
- * test: {
11
- * setupFiles: ['./test/setup.ts'],
12
- * env: {
13
- * VITE_PUBLIC_APP_URL: 'http://localhost:3001',
14
- * },
15
- * },
16
- * }))
17
- * ```
18
- */
19
- import react from '@vitejs/plugin-react';
20
- import { defineConfig } from 'vite-plus/test/config';
21
- import { createFlakinessReporter } from './flakiness-reporter.js';
22
- import { generatedRuntimeAliases, generatedRuntimeDedupe } from './generated-runtime-aliases.js';
23
- import { resolvedExecArgv, resolvedMaxWorkers, resolvedMinWorkers, resolvedPool, } from './pool-defaults.js';
24
- import { assertNonWorkersVitest4 } from './version-guard.js';
25
- assertNonWorkersVitest4({ caller: 'reactRouterConfig' });
26
- export const reactRouterConfig = defineConfig({
27
- plugins: [react()],
28
- resolve: {
29
- alias: [...generatedRuntimeAliases],
30
- dedupe: generatedRuntimeDedupe,
31
- tsconfigPaths: true,
32
- },
33
- test: {
34
- globals: true,
35
- // happy-dom is ~40% faster than jsdom
36
- environment: 'happy-dom',
37
- pool: resolvedPool,
38
- maxWorkers: resolvedMaxWorkers,
39
- minWorkers: resolvedMinWorkers,
40
- execArgv: resolvedExecArgv,
41
- // React Router apps use app/ directory
42
- include: ['app/**/*.test.{ts,tsx}'],
43
- exclude: ['**/.stryker-tmp/**', 'node_modules/**'],
44
- reporters: ['default', createFlakinessReporter()],
45
- retry: process.env.CI ? 2 : 0,
46
- coverage: {
47
- provider: 'v8',
48
- reporter: ['text', 'json', 'html', 'lcov'],
49
- include: ['app/**/*.{ts,tsx}'],
50
- exclude: [
51
- 'node_modules/',
52
- 'test/',
53
- '**/*.d.ts',
54
- '**/*.config.*',
55
- '**/mockData',
56
- 'build/',
57
- 'dist/',
58
- '.react-router/',
59
- '**/*.test.{ts,tsx}',
60
- '**/*.spec.{ts,tsx}',
61
- '**/index.{ts,tsx}',
62
- '**/types.ts',
63
- '**/types.tsx',
64
- '**/types/**',
65
- // React Router specific
66
- 'app/routes.ts',
67
- 'app/entry.*.tsx',
68
- 'app/root.tsx',
69
- ],
70
- thresholds: {
71
- lines: 95,
72
- branches: 90,
73
- functions: 95,
74
- statements: 95,
75
- },
76
- },
77
- },
78
- optimizeDeps: {
79
- include: ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
80
- },
81
- });
82
- export default reactRouterConfig;
83
- //# sourceMappingURL=react-router.js.map
@@ -1,13 +0,0 @@
1
- /**
2
- * Global Vitest setup for React tests
3
- * Configures React act() environment for React 19
4
- *
5
- * React 18+ checks globalThis.IS_REACT_ACT_ENVIRONMENT to detect test environment.
6
- * @testing-library/react sets it, but React may check before it's set.
7
- * This explicitly enables it for all React tests.
8
- *
9
- * React version: 19.2.1
10
- * See: https://react.dev/blog/2022/03/08/react-18-upgrade-guide
11
- */
12
- export declare const __reactSetupModule = true;
13
- //# sourceMappingURL=react-setup.d.ts.map
@@ -1,27 +0,0 @@
1
- /**
2
- * Global Vitest setup for React tests
3
- * Configures React act() environment for React 19
4
- *
5
- * React 18+ checks globalThis.IS_REACT_ACT_ENVIRONMENT to detect test environment.
6
- * @testing-library/react sets it, but React may check before it's set.
7
- * This explicitly enables it for all React tests.
8
- *
9
- * React version: 19.2.1
10
- * See: https://react.dev/blog/2022/03/08/react-18-upgrade-guide
11
- */
12
- // Set IS_REACT_ACT_ENVIRONMENT to true for test environment
13
- // This tells React 18+ that we're in a test environment and act() warnings should work correctly
14
- ;
15
- globalThis.IS_REACT_ACT_ENVIRONMENT = true;
16
- /**
17
- * Suppress console output globally for clean test output
18
- * This prevents stderr/stdout noise from error handling tests
19
- */
20
- const noop = () => {
21
- // Intentionally empty - suppresses console output
22
- };
23
- global.console.error = noop;
24
- global.console.warn = noop;
25
- global.console.log = noop;
26
- export const __reactSetupModule = true;
27
- //# sourceMappingURL=react-setup.js.map
@@ -1,22 +0,0 @@
1
- /**
2
- * Shared Vitest configuration for React packages
3
- *
4
- * Usage in vitest.config.ts:
5
- * ```ts
6
- * import { reactConfig } from '@webpresso/agent-config/vitest/react'
7
- * import { defineConfig, mergeConfig } from 'vite-plus/test/config'
8
- *
9
- * export default mergeConfig(reactConfig, defineConfig({
10
- * test: {
11
- * setupFiles: ['./test/setup.ts'],
12
- * env: {
13
- * VITE_PUBLIC_APP_URL: 'http://localhost:3001',
14
- * },
15
- * },
16
- * }))
17
- * ```
18
- */
19
- import type { ViteUserConfigExport } from 'vite-plus/test/config';
20
- export declare const reactConfig: ViteUserConfigExport;
21
- export default reactConfig;
22
- //# sourceMappingURL=react.d.ts.map
@@ -1,85 +0,0 @@
1
- /**
2
- * Shared Vitest configuration for React packages
3
- *
4
- * Usage in vitest.config.ts:
5
- * ```ts
6
- * import { reactConfig } from '@webpresso/agent-config/vitest/react'
7
- * import { defineConfig, mergeConfig } from 'vite-plus/test/config'
8
- *
9
- * export default mergeConfig(reactConfig, defineConfig({
10
- * test: {
11
- * setupFiles: ['./test/setup.ts'],
12
- * env: {
13
- * VITE_PUBLIC_APP_URL: 'http://localhost:3001',
14
- * },
15
- * },
16
- * }))
17
- * ```
18
- */
19
- import react from '@vitejs/plugin-react';
20
- import { defineConfig } from 'vite-plus/test/config';
21
- import { createFlakinessReporter } from './flakiness-reporter.js';
22
- import { generatedRuntimeAliases, generatedRuntimeDedupe } from './generated-runtime-aliases.js';
23
- import { resolvedExecArgv, resolvedMaxWorkers, resolvedMinWorkers, resolvedPool, } from './pool-defaults.js';
24
- import { assertNonWorkersVitest4 } from './version-guard.js';
25
- assertNonWorkersVitest4({ caller: 'reactConfig' });
26
- export const reactConfig = defineConfig({
27
- plugins: [react()],
28
- resolve: {
29
- alias: [...generatedRuntimeAliases],
30
- dedupe: generatedRuntimeDedupe,
31
- tsconfigPaths: true,
32
- },
33
- test: {
34
- globals: true,
35
- restoreAllMocks: true,
36
- environment: 'happy-dom',
37
- setupFiles: [],
38
- onConsoleLog: () => false, // Suppress all console output
39
- pool: resolvedPool,
40
- maxWorkers: resolvedMaxWorkers,
41
- minWorkers: resolvedMinWorkers,
42
- // Cap each fork worker's V8 heap to 2GB (Node 24 default is 4.2GB).
43
- execArgv: resolvedExecArgv,
44
- include: ['src/**/*.test.{ts,tsx}', 'src/**/__tests__/**/*.{ts,tsx}'],
45
- exclude: ['**/.stryker-tmp/**', 'node_modules/**'],
46
- reporters: ['default', createFlakinessReporter()],
47
- retry: process.env.CI ? 2 : 0,
48
- coverage: {
49
- provider: 'v8',
50
- reporter: ['text', 'json', 'html', 'lcov'],
51
- include: ['src/**/*.{ts,tsx}'],
52
- exclude: [
53
- 'node_modules/',
54
- 'test/',
55
- '**/*.d.ts',
56
- '**/*.config.*',
57
- '**/mockData',
58
- 'build/',
59
- 'dist/',
60
- '**/*.test.{ts,tsx}',
61
- '**/*.spec.{ts,tsx}',
62
- '**/index.{ts,tsx}', // Common exclusion for barrel exports
63
- '**/types.ts',
64
- '**/types.tsx',
65
- '**/types/**',
66
- ],
67
- // Industry-standard 80% coverage thresholds (Atlassian recommendation)
68
- // 80% catches critical gaps without excessive build failures
69
- // Branches at 75% as they're harder to cover comprehensively
70
- thresholds: {
71
- lines: 80,
72
- branches: 75,
73
- functions: 80,
74
- statements: 80,
75
- },
76
- },
77
- },
78
- // Pre-optimize React dependencies to prevent first-run failures
79
- // See: https://github.com/storybookjs/storybook/issues/32049
80
- optimizeDeps: {
81
- include: ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
82
- },
83
- });
84
- export default reactConfig;
85
- //# sourceMappingURL=react.js.map
@@ -1,7 +0,0 @@
1
- export declare const assertVitest4: ({ caller }?: {
2
- caller?: string;
3
- }) => void;
4
- export declare const assertNonWorkersVitest4: ({ caller }?: {
5
- caller?: string;
6
- }) => void;
7
- //# sourceMappingURL=version-guard.d.ts.map
@@ -1,42 +0,0 @@
1
- import { readConsumerPackageJson, requireFromConsumer } from './consumer-package.js';
2
- const getVitestVersion = () => {
3
- try {
4
- return requireFromConsumer('vitest/package.json').version;
5
- }
6
- catch (error) {
7
- const wrapped = new Error(`[vitest] Unable to resolve local vitest version. ` +
8
- `Install vitest in the package and use the correct catalog. ` +
9
- `Original error: ${error instanceof Error ? error.message : String(error)}`);
10
- wrapped.cause = error;
11
- throw wrapped;
12
- }
13
- };
14
- const getVitestMajor = () => {
15
- const version = getVitestVersion();
16
- const major = Number.parseInt(version.split('.')[0] ?? '0', 10);
17
- return Number.isNaN(major) ? 0 : major;
18
- };
19
- const hasWorkersPool = () => {
20
- const pkg = readConsumerPackageJson();
21
- return (!!pkg &&
22
- ('@cloudflare/vitest-pool-workers' in (pkg.devDependencies ?? {}) ||
23
- '@cloudflare/vitest-pool-workers' in (pkg.dependencies ?? {})));
24
- };
25
- const getPackageName = () => {
26
- return readConsumerPackageJson()?.name ?? 'this package';
27
- };
28
- export const assertVitest4 = ({ caller } = {}) => {
29
- const major = getVitestMajor();
30
- if (major >= 4) {
31
- return;
32
- }
33
- const packageName = getPackageName();
34
- const catalogHint = hasWorkersPool() ? 'catalog:workers' : 'catalog:';
35
- throw new Error(`[vitest] ${caller ?? 'Vitest config'} requires vitest 4.x. ` +
36
- `${packageName} appears to be using vitest ${getVitestVersion()}. ` +
37
- `Use the Vitest 4.1 line from ${catalogHint}.`);
38
- };
39
- export const assertNonWorkersVitest4 = ({ caller } = {}) => {
40
- assertVitest4({ caller: caller ?? 'Non-workers config' });
41
- };
42
- //# sourceMappingURL=version-guard.js.map
@@ -1,28 +0,0 @@
1
- /**
2
- * Shared Vitest configuration for Cloudflare Workers
3
- */
4
- export declare const workersConfig: {
5
- resolve: {
6
- tsconfigPaths: boolean;
7
- };
8
- test: {
9
- globals: boolean;
10
- restoreMocks: boolean;
11
- reporters: string[];
12
- retry: number;
13
- coverage: {
14
- provider: string;
15
- reporter: string[];
16
- include: string[];
17
- exclude: string[];
18
- thresholds: {
19
- lines: number;
20
- branches: number;
21
- functions: number;
22
- statements: number;
23
- };
24
- };
25
- };
26
- };
27
- export default workersConfig;
28
- //# sourceMappingURL=workers.d.ts.map
@@ -1,44 +0,0 @@
1
- import { defineConfig } from 'vite-plus/test/config';
2
- import { createFlakinessReporter } from './flakiness-reporter.js';
3
- import { assertVitest4 } from './version-guard.js';
4
- assertVitest4({ caller: 'workersConfig' });
5
- /**
6
- * Shared Vitest configuration for Cloudflare Workers
7
- */
8
- export const workersConfig = defineConfig({
9
- resolve: {
10
- tsconfigPaths: true,
11
- },
12
- test: {
13
- globals: true,
14
- restoreMocks: true,
15
- reporters: ['default', createFlakinessReporter()],
16
- retry: process.env.CI ? 2 : 0,
17
- coverage: {
18
- // Use istanbul provider for Edge Runtime compatibility
19
- // v8 provider requires node:inspector which is not available in Edge Runtime
20
- provider: 'istanbul',
21
- reporter: ['text', 'json', 'html', 'lcov'],
22
- include: ['src/**/*.ts'],
23
- exclude: [
24
- 'node_modules/**',
25
- 'dist/**',
26
- '**/.stryker-tmp/**',
27
- '**/*.test.ts',
28
- '**/*.spec.ts',
29
- '**/*.d.ts',
30
- ],
31
- // Industry-standard 80% coverage thresholds (Atlassian recommendation)
32
- // 80% catches critical gaps without excessive build failures
33
- // Branches at 75% as they're harder to cover comprehensively
34
- thresholds: {
35
- lines: 80,
36
- branches: 75,
37
- functions: 80,
38
- statements: 80,
39
- },
40
- },
41
- },
42
- });
43
- export default workersConfig;
44
- //# sourceMappingURL=workers.js.map
@@ -1,30 +0,0 @@
1
- export interface DurableObjectId {
2
- toString(): string;
3
- equals(other: DurableObjectId): boolean;
4
- name?: string;
5
- }
6
- export interface DurableObjectStub {
7
- fetch(request: Request | string, init?: RequestInit): Promise<Response>;
8
- }
9
- export interface DurableObjectNamespace {
10
- newUniqueId(options?: unknown): DurableObjectId;
11
- idFromName(name: string): DurableObjectId;
12
- idFromString(id: string): DurableObjectId;
13
- get(id: DurableObjectId, options?: unknown): DurableObjectStub;
14
- getByName(name: string, options?: unknown): DurableObjectStub;
15
- }
16
- export interface Hyperdrive {
17
- connectionString: string;
18
- connect(): unknown;
19
- host: string;
20
- port: number;
21
- user: string;
22
- password: string;
23
- database: string;
24
- }
25
- export interface ExecutionContext<Props = unknown> {
26
- waitUntil(promise: Promise<unknown>): void;
27
- passThroughOnException(): void;
28
- props: Props;
29
- }
30
- //# sourceMappingURL=cloudflare-types.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cloudflare-types.js.map