@webpresso/agent-config 0.2.0 → 0.3.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/dist/esm/deploy/index.d.ts +1 -0
- package/dist/esm/deploy/index.js +3 -0
- package/dist/esm/dev/index.d.ts +1 -0
- package/dist/esm/dev/index.js +3 -0
- package/dist/esm/e2e/index.d.ts +1 -0
- package/dist/esm/e2e/index.js +3 -0
- package/dist/esm/process/index.d.ts +1 -0
- package/dist/esm/process/index.js +3 -0
- package/dist/esm/repo-root/index.d.ts +1 -0
- package/dist/esm/repo-root/index.js +3 -0
- package/dist/esm/stryker/index.js +47 -47
- package/dist/esm/tsconfig/base.json +3 -13
- package/dist/esm/vitest/bun-sqlite-shim.d.ts +1 -1
- package/dist/esm/vitest/bun-sqlite-shim.js +1 -1
- package/dist/esm/vitest/consumer-package.js +9 -9
- package/dist/esm/vitest/flakiness-reporter.d.ts +1 -1
- package/dist/esm/vitest/flakiness-reporter.js +5 -5
- package/dist/esm/vitest/node.d.ts +1 -1
- package/dist/esm/vitest/node.js +45 -45
- package/dist/esm/vitest/pool-defaults.js +5 -5
- package/dist/esm/vitest/react-router.d.ts +1 -1
- package/dist/esm/vitest/react-router.js +32 -32
- package/dist/esm/vitest/react-setup.js +0 -1
- package/dist/esm/vitest/react.d.ts +1 -1
- package/dist/esm/vitest/react.js +28 -28
- package/dist/esm/vitest/source-conditions.js +4 -4
- package/dist/esm/vitest/version-guard.js +9 -9
- package/dist/esm/vitest/workers.js +14 -14
- package/dist/esm/workers-test/durable-objects.d.ts +3 -3
- package/dist/esm/workers-test/durable-objects.js +5 -5
- package/dist/esm/workers-test/env.d.ts +1 -1
- package/dist/esm/workers-test/env.js +9 -9
- package/dist/esm/workers-test/execution-context.d.ts +2 -2
- package/dist/esm/workers-test/execution-context.js +1 -1
- package/dist/esm/workers-test/index.d.ts +8 -8
- package/dist/esm/workers-test/index.js +5 -5
- package/dist/esm/workers-test/requests.js +4 -4
- package/dist/esm/workers-test/setup.d.ts +5 -5
- package/dist/esm/workers-test/setup.js +8 -8
- package/package.json +66 -30
package/dist/esm/vitest/react.js
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
* }))
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
import react from
|
|
20
|
-
import { defineConfig } from
|
|
21
|
-
import { createFlakinessReporter } from
|
|
22
|
-
import { generatedRuntimeAliases, generatedRuntimeDedupe } from
|
|
23
|
-
import { resolvedExecArgv, resolvedMaxWorkers, resolvedMinWorkers, resolvedPool, } from
|
|
24
|
-
import { assertNonWorkersVitest4 } from
|
|
25
|
-
assertNonWorkersVitest4({ caller:
|
|
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
26
|
export const reactConfig = defineConfig({
|
|
27
27
|
plugins: [react()],
|
|
28
28
|
resolve: {
|
|
@@ -33,7 +33,7 @@ export const reactConfig = defineConfig({
|
|
|
33
33
|
test: {
|
|
34
34
|
globals: true,
|
|
35
35
|
restoreAllMocks: true,
|
|
36
|
-
environment:
|
|
36
|
+
environment: "happy-dom",
|
|
37
37
|
setupFiles: [],
|
|
38
38
|
onConsoleLog: () => false, // Suppress all console output
|
|
39
39
|
pool: resolvedPool,
|
|
@@ -41,28 +41,28 @@ export const reactConfig = defineConfig({
|
|
|
41
41
|
minWorkers: resolvedMinWorkers,
|
|
42
42
|
// Cap each fork worker's V8 heap to 2GB (Node 24 default is 4.2GB).
|
|
43
43
|
execArgv: resolvedExecArgv,
|
|
44
|
-
include: [
|
|
45
|
-
exclude: [
|
|
46
|
-
reporters: [
|
|
44
|
+
include: ["src/**/*.test.{ts,tsx}", "src/**/__tests__/**/*.{ts,tsx}"],
|
|
45
|
+
exclude: ["**/.stryker-tmp/**", "node_modules/**"],
|
|
46
|
+
reporters: ["default", createFlakinessReporter()],
|
|
47
47
|
retry: process.env.CI ? 2 : 0,
|
|
48
48
|
coverage: {
|
|
49
|
-
provider:
|
|
50
|
-
reporter: [
|
|
51
|
-
include: [
|
|
49
|
+
provider: "v8",
|
|
50
|
+
reporter: ["text", "json", "html", "lcov"],
|
|
51
|
+
include: ["src/**/*.{ts,tsx}"],
|
|
52
52
|
exclude: [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
66
|
],
|
|
67
67
|
// Industry-standard 80% coverage thresholds (Atlassian recommendation)
|
|
68
68
|
// 80% catches critical gaps without excessive build failures
|
|
@@ -78,7 +78,7 @@ export const reactConfig = defineConfig({
|
|
|
78
78
|
// Pre-optimize React dependencies to prevent first-run failures
|
|
79
79
|
// See: https://github.com/storybookjs/storybook/issues/32049
|
|
80
80
|
optimizeDeps: {
|
|
81
|
-
include: [
|
|
81
|
+
include: ["react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime"],
|
|
82
82
|
},
|
|
83
83
|
});
|
|
84
84
|
export default reactConfig;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* export default mergeConfig(nodeConfig, createWebpressoSourceResolveConfig({ tsconfigPaths: true }))
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export const webpressoSourceCondition =
|
|
19
|
+
export const webpressoSourceCondition = "@webpresso/source";
|
|
20
20
|
/**
|
|
21
21
|
* Vite client environments use top-level resolve conditions. Keep this list
|
|
22
22
|
* deliberately narrow: Vite still applies the built-in import/default matches
|
|
@@ -30,9 +30,9 @@ export const webpressoSourceResolveConditions = [webpressoSourceCondition];
|
|
|
30
30
|
*/
|
|
31
31
|
export const webpressoSourceSsrResolveConditions = [
|
|
32
32
|
webpressoSourceCondition,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
"module",
|
|
34
|
+
"node",
|
|
35
|
+
"development|production",
|
|
36
36
|
];
|
|
37
37
|
export function createWebpressoSourceResolveConfig(options = {}) {
|
|
38
38
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { readConsumerPackageJson, requireFromConsumer } from
|
|
1
|
+
import { readConsumerPackageJson, requireFromConsumer } from "./consumer-package.js";
|
|
2
2
|
const getVitestVersion = () => {
|
|
3
3
|
try {
|
|
4
|
-
return requireFromConsumer(
|
|
4
|
+
return requireFromConsumer("vitest/package.json").version;
|
|
5
5
|
}
|
|
6
6
|
catch (error) {
|
|
7
7
|
const wrapped = new Error(`[vitest] Unable to resolve local vitest version. ` +
|
|
@@ -13,17 +13,17 @@ const getVitestVersion = () => {
|
|
|
13
13
|
};
|
|
14
14
|
const getVitestMajor = () => {
|
|
15
15
|
const version = getVitestVersion();
|
|
16
|
-
const major = Number.parseInt(version.split(
|
|
16
|
+
const major = Number.parseInt(version.split(".")[0] ?? "0", 10);
|
|
17
17
|
return Number.isNaN(major) ? 0 : major;
|
|
18
18
|
};
|
|
19
19
|
const hasWorkersPool = () => {
|
|
20
20
|
const pkg = readConsumerPackageJson();
|
|
21
21
|
return (!!pkg &&
|
|
22
|
-
(
|
|
23
|
-
|
|
22
|
+
("@cloudflare/vitest-pool-workers" in (pkg.devDependencies ?? {}) ||
|
|
23
|
+
"@cloudflare/vitest-pool-workers" in (pkg.dependencies ?? {})));
|
|
24
24
|
};
|
|
25
25
|
const getPackageName = () => {
|
|
26
|
-
return readConsumerPackageJson()?.name ??
|
|
26
|
+
return readConsumerPackageJson()?.name ?? "this package";
|
|
27
27
|
};
|
|
28
28
|
export const assertVitest4 = ({ caller } = {}) => {
|
|
29
29
|
const major = getVitestMajor();
|
|
@@ -31,11 +31,11 @@ export const assertVitest4 = ({ caller } = {}) => {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
const packageName = getPackageName();
|
|
34
|
-
const catalogHint = hasWorkersPool() ?
|
|
35
|
-
throw new Error(`[vitest] ${caller ??
|
|
34
|
+
const catalogHint = hasWorkersPool() ? "catalog:workers" : "catalog:";
|
|
35
|
+
throw new Error(`[vitest] ${caller ?? "Vitest config"} requires vitest 4.x. ` +
|
|
36
36
|
`${packageName} appears to be using vitest ${getVitestVersion()}. ` +
|
|
37
37
|
`Use the Vitest 4.1 line from ${catalogHint}.`);
|
|
38
38
|
};
|
|
39
39
|
export const assertNonWorkersVitest4 = ({ caller } = {}) => {
|
|
40
|
-
assertVitest4({ caller: caller ??
|
|
40
|
+
assertVitest4({ caller: caller ?? "Non-workers config" });
|
|
41
41
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import { createFlakinessReporter } from
|
|
3
|
-
import { assertVitest4 } from
|
|
4
|
-
assertVitest4({ caller:
|
|
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
5
|
/**
|
|
6
6
|
* Shared Vitest configuration for Cloudflare Workers
|
|
7
7
|
*/
|
|
@@ -12,21 +12,21 @@ export const workersConfig = defineConfig({
|
|
|
12
12
|
test: {
|
|
13
13
|
globals: true,
|
|
14
14
|
restoreMocks: true,
|
|
15
|
-
reporters: [
|
|
15
|
+
reporters: ["default", createFlakinessReporter()],
|
|
16
16
|
retry: process.env.CI ? 2 : 0,
|
|
17
17
|
coverage: {
|
|
18
18
|
// Use istanbul provider for Edge Runtime compatibility
|
|
19
19
|
// v8 provider requires node:inspector which is not available in Edge Runtime
|
|
20
|
-
provider:
|
|
21
|
-
reporter: [
|
|
22
|
-
include: [
|
|
20
|
+
provider: "istanbul",
|
|
21
|
+
reporter: ["text", "json", "html", "lcov"],
|
|
22
|
+
include: ["src/**/*.ts"],
|
|
23
23
|
exclude: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
"node_modules/**",
|
|
25
|
+
"dist/**",
|
|
26
|
+
"**/.stryker-tmp/**",
|
|
27
|
+
"**/*.test.ts",
|
|
28
|
+
"**/*.spec.ts",
|
|
29
|
+
"**/*.d.ts",
|
|
30
30
|
],
|
|
31
31
|
// Industry-standard 80% coverage thresholds (Atlassian recommendation)
|
|
32
32
|
// 80% catches critical gaps without excessive build failures
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vi } from
|
|
1
|
+
import { vi } from "vitest";
|
|
2
2
|
/**
|
|
3
3
|
* Mock DurableObject class for unit tests.
|
|
4
4
|
* Use this when you need to mock a DurableObject class in your test setup.
|
|
@@ -52,10 +52,10 @@ export declare class MockContainer {
|
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
export declare function createCloudflareRuntimeMocks(): {
|
|
55
|
-
|
|
55
|
+
"cloudflare:workers": {
|
|
56
56
|
DurableObject: typeof MockDurableObject;
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
"@cloudflare/containers": {
|
|
59
59
|
Container: typeof MockContainer;
|
|
60
60
|
};
|
|
61
61
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vi } from
|
|
1
|
+
import { vi } from "vitest";
|
|
2
2
|
// ============================================================================
|
|
3
3
|
// Mock Classes
|
|
4
4
|
// ============================================================================
|
|
@@ -34,13 +34,13 @@ export class MockDurableObject {
|
|
|
34
34
|
*/
|
|
35
35
|
export class MockContainer {
|
|
36
36
|
defaultPort = 8080;
|
|
37
|
-
sleepAfter =
|
|
37
|
+
sleepAfter = "1m";
|
|
38
38
|
envVars = {};
|
|
39
39
|
enableInternet = false;
|
|
40
40
|
fetch = vi.fn();
|
|
41
41
|
destroy = vi.fn();
|
|
42
42
|
startAndWaitForPorts = vi.fn();
|
|
43
|
-
getState = vi.fn().mockResolvedValue({ status:
|
|
43
|
+
getState = vi.fn().mockResolvedValue({ status: "running" });
|
|
44
44
|
}
|
|
45
45
|
// ============================================================================
|
|
46
46
|
// Mock Factories
|
|
@@ -60,10 +60,10 @@ export class MockContainer {
|
|
|
60
60
|
*/
|
|
61
61
|
export function createCloudflareRuntimeMocks() {
|
|
62
62
|
return {
|
|
63
|
-
|
|
63
|
+
"cloudflare:workers": {
|
|
64
64
|
DurableObject: MockDurableObject,
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
"@cloudflare/containers": {
|
|
67
67
|
Container: MockContainer,
|
|
68
68
|
},
|
|
69
69
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vi } from
|
|
1
|
+
import { vi } from "vitest";
|
|
2
2
|
// ============================================================================
|
|
3
3
|
// Mock Factories
|
|
4
4
|
// ============================================================================
|
|
@@ -8,7 +8,7 @@ import { vi } from 'vitest';
|
|
|
8
8
|
export function createMockDurableObjectNamespace() {
|
|
9
9
|
return {
|
|
10
10
|
newUniqueId: vi.fn(() => ({
|
|
11
|
-
toString: () =>
|
|
11
|
+
toString: () => "test-do-id",
|
|
12
12
|
equals: () => false,
|
|
13
13
|
name: undefined,
|
|
14
14
|
})),
|
|
@@ -38,13 +38,13 @@ export function createMockDurableObjectNamespace() {
|
|
|
38
38
|
*/
|
|
39
39
|
export function createMockHyperdrive(overrides) {
|
|
40
40
|
return {
|
|
41
|
-
connectionString:
|
|
41
|
+
connectionString: "postgresql://localhost/test",
|
|
42
42
|
connect: vi.fn(() => ({})),
|
|
43
|
-
host:
|
|
43
|
+
host: "localhost",
|
|
44
44
|
port: 5432,
|
|
45
|
-
user:
|
|
46
|
-
password:
|
|
47
|
-
database:
|
|
45
|
+
user: "test",
|
|
46
|
+
password: "test",
|
|
47
|
+
database: "test",
|
|
48
48
|
...overrides,
|
|
49
49
|
};
|
|
50
50
|
}
|
|
@@ -62,8 +62,8 @@ export function createMockHyperdrive(overrides) {
|
|
|
62
62
|
*/
|
|
63
63
|
export function createMockEnv(overrides = {}) {
|
|
64
64
|
const defaultEnv = {
|
|
65
|
-
ENVIRONMENT:
|
|
66
|
-
DATABASE_URL:
|
|
65
|
+
ENVIRONMENT: "test",
|
|
66
|
+
DATABASE_URL: "postgresql://localhost/test",
|
|
67
67
|
HYPERDRIVE: createMockHyperdrive(),
|
|
68
68
|
};
|
|
69
69
|
return {
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* Drop in BaseWorkerEnv, ExecutionContext, Hyperdrive, and Durable Object mocks
|
|
6
6
|
* for any Cloudflare Workers project without recreating them per-app.
|
|
7
7
|
*/
|
|
8
|
-
export type { BaseWorkerEnv } from
|
|
9
|
-
export { createMockEnv, createMockHyperdrive, createMockDurableObjectNamespace } from
|
|
10
|
-
export type { MockExecutionContext } from
|
|
11
|
-
export { createMockExecutionContext } from
|
|
12
|
-
export { MockDurableObject, MockContainer, createCloudflareRuntimeMocks, } from
|
|
13
|
-
export { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest, } from
|
|
14
|
-
export type { WorkerTestOptions } from
|
|
15
|
-
export { setupWorkerTest, suppressConsole } from
|
|
8
|
+
export type { BaseWorkerEnv } from "./env.js";
|
|
9
|
+
export { createMockEnv, createMockHyperdrive, createMockDurableObjectNamespace } from "./env.js";
|
|
10
|
+
export type { MockExecutionContext } from "./execution-context.js";
|
|
11
|
+
export { createMockExecutionContext } from "./execution-context.js";
|
|
12
|
+
export { MockDurableObject, MockContainer, createCloudflareRuntimeMocks, } from "./durable-objects.js";
|
|
13
|
+
export { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest, } from "./requests.js";
|
|
14
|
+
export type { WorkerTestOptions } from "./setup.js";
|
|
15
|
+
export { setupWorkerTest, suppressConsole } from "./setup.js";
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* Drop in BaseWorkerEnv, ExecutionContext, Hyperdrive, and Durable Object mocks
|
|
6
6
|
* for any Cloudflare Workers project without recreating them per-app.
|
|
7
7
|
*/
|
|
8
|
-
export { createMockEnv, createMockHyperdrive, createMockDurableObjectNamespace } from
|
|
9
|
-
export { createMockExecutionContext } from
|
|
8
|
+
export { createMockEnv, createMockHyperdrive, createMockDurableObjectNamespace } from "./env.js";
|
|
9
|
+
export { createMockExecutionContext } from "./execution-context.js";
|
|
10
10
|
// Durable Objects and Containers
|
|
11
|
-
export { MockDurableObject, MockContainer, createCloudflareRuntimeMocks, } from
|
|
11
|
+
export { MockDurableObject, MockContainer, createCloudflareRuntimeMocks, } from "./durable-objects.js";
|
|
12
12
|
// Request helpers
|
|
13
|
-
export { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest, } from
|
|
14
|
-
export { setupWorkerTest, suppressConsole } from
|
|
13
|
+
export { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest, } from "./requests.js";
|
|
14
|
+
export { setupWorkerTest, suppressConsole } from "./setup.js";
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* const request = createAuthenticatedRequest('/api/users', { method: 'POST', body: JSON.stringify(data) })
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export function createAuthenticatedRequest(path, options = {}, baseUrl =
|
|
17
|
+
export function createAuthenticatedRequest(path, options = {}, baseUrl = "https://api.test") {
|
|
18
18
|
const { headers: optionHeaders, ...restOptions } = options;
|
|
19
19
|
return new Request(`${baseUrl}${path}`, {
|
|
20
20
|
...restOptions,
|
|
21
21
|
headers: {
|
|
22
|
-
Cookie:
|
|
22
|
+
Cookie: "session=mock-session-token",
|
|
23
23
|
...optionHeaders,
|
|
24
24
|
},
|
|
25
25
|
});
|
|
@@ -37,7 +37,7 @@ export function createAuthenticatedRequest(path, options = {}, baseUrl = 'https:
|
|
|
37
37
|
* const request = createUnauthenticatedRequest('/health')
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export function createUnauthenticatedRequest(path, options = {}, baseUrl =
|
|
40
|
+
export function createUnauthenticatedRequest(path, options = {}, baseUrl = "https://api.test") {
|
|
41
41
|
return new Request(`${baseUrl}${path}`, {
|
|
42
42
|
headers: {
|
|
43
43
|
...options.headers,
|
|
@@ -59,7 +59,7 @@ export function createUnauthenticatedRequest(path, options = {}, baseUrl = 'http
|
|
|
59
59
|
* const request = createCorsRequest('/api/data', 'https://example.com')
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
export function createCorsRequest(path, origin, options = {}, baseUrl =
|
|
62
|
+
export function createCorsRequest(path, origin, options = {}, baseUrl = "https://api.test") {
|
|
63
63
|
return new Request(`${baseUrl}${path}`, {
|
|
64
64
|
headers: {
|
|
65
65
|
Origin: origin,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { BaseWorkerEnv } from
|
|
2
|
-
import type { MockExecutionContext } from
|
|
3
|
-
import { createMockExecutionContext } from
|
|
4
|
-
import { createCloudflareRuntimeMocks } from
|
|
5
|
-
import { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest } from
|
|
1
|
+
import type { BaseWorkerEnv } from "./env.js";
|
|
2
|
+
import type { MockExecutionContext } from "./execution-context.js";
|
|
3
|
+
import { createMockExecutionContext } from "./execution-context.js";
|
|
4
|
+
import { createCloudflareRuntimeMocks } from "./durable-objects.js";
|
|
5
|
+
import { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest } from "./requests.js";
|
|
6
6
|
/**
|
|
7
7
|
* Options for configuring the worker test environment
|
|
8
8
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { vi } from
|
|
2
|
-
import { createMockEnv } from
|
|
3
|
-
import { createMockExecutionContext } from
|
|
4
|
-
import { createCloudflareRuntimeMocks } from
|
|
5
|
-
import { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest, } from
|
|
1
|
+
import { vi } from "vitest";
|
|
2
|
+
import { createMockEnv } from "./env.js";
|
|
3
|
+
import { createMockExecutionContext } from "./execution-context.js";
|
|
4
|
+
import { createCloudflareRuntimeMocks } from "./durable-objects.js";
|
|
5
|
+
import { createAuthenticatedRequest, createUnauthenticatedRequest, createCorsRequest, } from "./requests.js";
|
|
6
6
|
// ============================================================================
|
|
7
7
|
// Test Setup Function
|
|
8
8
|
// ============================================================================
|
|
@@ -66,13 +66,13 @@ export function suppressConsole() {
|
|
|
66
66
|
const originalLog = console.log;
|
|
67
67
|
const originalError = console.error;
|
|
68
68
|
const originalWarn = console.warn;
|
|
69
|
-
vi.spyOn(console,
|
|
69
|
+
vi.spyOn(console, "log").mockImplementation(() => {
|
|
70
70
|
// Intentionally empty - suppressing console output
|
|
71
71
|
});
|
|
72
|
-
vi.spyOn(console,
|
|
72
|
+
vi.spyOn(console, "error").mockImplementation(() => {
|
|
73
73
|
// Intentionally empty - suppressing console output
|
|
74
74
|
});
|
|
75
|
-
vi.spyOn(console,
|
|
75
|
+
vi.spyOn(console, "warn").mockImplementation(() => {
|
|
76
76
|
// Intentionally empty - suppressing console output
|
|
77
77
|
});
|
|
78
78
|
return {
|
package/package.json
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpresso/agent-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/webpresso/agent-kit.git"
|
|
8
|
-
},
|
|
5
|
+
"description": "Shared vitest, tsconfig, stryker, and workers-test config for webpresso consumers. Binary-free — pure test/config tooling.",
|
|
9
6
|
"homepage": "https://github.com/webpresso/agent-kit#readme",
|
|
10
7
|
"bugs": {
|
|
11
8
|
"url": "https://github.com/webpresso/agent-kit/issues"
|
|
12
9
|
},
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"registry": "https://registry.npmjs.org/",
|
|
15
|
-
"access": "public"
|
|
16
|
-
},
|
|
17
|
-
"description": "Shared vitest, tsconfig, stryker, and workers-test config for webpresso consumers. Binary-free — pure test/config tooling.",
|
|
18
10
|
"license": "Elastic-2.0",
|
|
19
|
-
"
|
|
20
|
-
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/webpresso/agent-kit.git"
|
|
14
|
+
},
|
|
21
15
|
"files": [
|
|
22
16
|
"dist/esm",
|
|
23
17
|
"!dist/**/*.map",
|
|
@@ -25,7 +19,45 @@
|
|
|
25
19
|
"LICENSE",
|
|
26
20
|
"README.md"
|
|
27
21
|
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": false,
|
|
28
24
|
"exports": {
|
|
25
|
+
"./repo-root": {
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/esm/repo-root/index.d.ts",
|
|
28
|
+
"default": "./dist/esm/repo-root/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"./process": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/esm/process/index.d.ts",
|
|
34
|
+
"default": "./dist/esm/process/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"./e2e": {
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./dist/esm/e2e/index.d.ts",
|
|
40
|
+
"default": "./dist/esm/e2e/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"./deploy": {
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./dist/esm/deploy/index.d.ts",
|
|
46
|
+
"default": "./dist/esm/deploy/index.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"./dev": {
|
|
50
|
+
"import": {
|
|
51
|
+
"types": "./dist/esm/dev/index.d.ts",
|
|
52
|
+
"default": "./dist/esm/dev/index.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"./stryker": {
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./dist/esm/stryker/index.d.ts",
|
|
58
|
+
"default": "./dist/esm/stryker/index.js"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
29
61
|
"./tsconfig/base.json": {
|
|
30
62
|
"import": {
|
|
31
63
|
"types": "./dist/esm/tsconfig/base.json",
|
|
@@ -56,6 +88,12 @@
|
|
|
56
88
|
"default": "./dist/esm/tsconfig/react-router.json"
|
|
57
89
|
}
|
|
58
90
|
},
|
|
91
|
+
"./vitest/flakiness-reporter": {
|
|
92
|
+
"import": {
|
|
93
|
+
"types": "./dist/esm/vitest/flakiness-reporter.d.ts",
|
|
94
|
+
"default": "./dist/esm/vitest/flakiness-reporter.js"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
59
97
|
"./vitest/node": {
|
|
60
98
|
"import": {
|
|
61
99
|
"types": "./dist/esm/vitest/node.d.ts",
|
|
@@ -74,12 +112,6 @@
|
|
|
74
112
|
"default": "./dist/esm/vitest/react-router.js"
|
|
75
113
|
}
|
|
76
114
|
},
|
|
77
|
-
"./vitest/workers": {
|
|
78
|
-
"import": {
|
|
79
|
-
"types": "./dist/esm/vitest/workers.d.ts",
|
|
80
|
-
"default": "./dist/esm/vitest/workers.js"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
115
|
"./vitest/react-setup": {
|
|
84
116
|
"import": {
|
|
85
117
|
"types": "./dist/esm/vitest/react-setup.d.ts",
|
|
@@ -92,22 +124,16 @@
|
|
|
92
124
|
"default": "./dist/esm/vitest/react-setup.js"
|
|
93
125
|
}
|
|
94
126
|
},
|
|
95
|
-
"./vitest/flakiness-reporter": {
|
|
96
|
-
"import": {
|
|
97
|
-
"types": "./dist/esm/vitest/flakiness-reporter.d.ts",
|
|
98
|
-
"default": "./dist/esm/vitest/flakiness-reporter.js"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
127
|
"./vitest/source-conditions": {
|
|
102
128
|
"import": {
|
|
103
129
|
"types": "./dist/esm/vitest/source-conditions.d.ts",
|
|
104
130
|
"default": "./dist/esm/vitest/source-conditions.js"
|
|
105
131
|
}
|
|
106
132
|
},
|
|
107
|
-
"./
|
|
133
|
+
"./vitest/workers": {
|
|
108
134
|
"import": {
|
|
109
|
-
"types": "./dist/esm/
|
|
110
|
-
"default": "./dist/esm/
|
|
135
|
+
"types": "./dist/esm/vitest/workers.d.ts",
|
|
136
|
+
"default": "./dist/esm/vitest/workers.js"
|
|
111
137
|
}
|
|
112
138
|
},
|
|
113
139
|
"./workers-test": {
|
|
@@ -117,6 +143,10 @@
|
|
|
117
143
|
}
|
|
118
144
|
}
|
|
119
145
|
},
|
|
146
|
+
"publishConfig": {
|
|
147
|
+
"access": "public",
|
|
148
|
+
"registry": "https://registry.npmjs.org/"
|
|
149
|
+
},
|
|
120
150
|
"scripts": {
|
|
121
151
|
"build": "tshy",
|
|
122
152
|
"prepublishOnly": "vp run build",
|
|
@@ -124,6 +154,7 @@
|
|
|
124
154
|
"lint:pkg": "publint && attw --pack . --profile esm-only"
|
|
125
155
|
},
|
|
126
156
|
"dependencies": {
|
|
157
|
+
"@webpresso/agent-core": "0.1.0",
|
|
127
158
|
"@vitejs/plugin-react": "^6.0.2",
|
|
128
159
|
"vite": "^8.0.14",
|
|
129
160
|
"vite-plus": "^0.1.22",
|
|
@@ -170,20 +201,25 @@
|
|
|
170
201
|
"src/**/__fixtures__/**"
|
|
171
202
|
],
|
|
172
203
|
"exports": {
|
|
204
|
+
"./repo-root": "./src/repo-root/index.ts",
|
|
205
|
+
"./process": "./src/process/index.ts",
|
|
206
|
+
"./e2e": "./src/e2e/index.ts",
|
|
207
|
+
"./deploy": "./src/deploy/index.ts",
|
|
208
|
+
"./dev": "./src/dev/index.ts",
|
|
209
|
+
"./stryker": "./src/stryker/index.ts",
|
|
173
210
|
"./tsconfig/base.json": "./src/tsconfig/base.json",
|
|
174
211
|
"./tsconfig/cloudflare.json": "./src/tsconfig/cloudflare.json",
|
|
175
212
|
"./tsconfig/library.json": "./src/tsconfig/library.json",
|
|
176
213
|
"./tsconfig/react-library.json": "./src/tsconfig/react-library.json",
|
|
177
214
|
"./tsconfig/react-router.json": "./src/tsconfig/react-router.json",
|
|
215
|
+
"./vitest/flakiness-reporter": "./src/vitest/flakiness-reporter.ts",
|
|
178
216
|
"./vitest/node": "./src/vitest/node.ts",
|
|
179
217
|
"./vitest/react": "./src/vitest/react.ts",
|
|
180
218
|
"./vitest/react-router": "./src/vitest/react-router.ts",
|
|
181
|
-
"./vitest/workers": "./src/vitest/workers.ts",
|
|
182
219
|
"./vitest/react-setup": "./src/vitest/react-setup.ts",
|
|
183
220
|
"./vitest/react-setup.ts": "./src/vitest/react-setup.ts",
|
|
184
|
-
"./vitest/flakiness-reporter": "./src/vitest/flakiness-reporter.ts",
|
|
185
221
|
"./vitest/source-conditions": "./src/vitest/source-conditions.ts",
|
|
186
|
-
"./
|
|
222
|
+
"./vitest/workers": "./src/vitest/workers.ts",
|
|
187
223
|
"./workers-test": "./src/workers-test/index.ts"
|
|
188
224
|
},
|
|
189
225
|
"selfLink": false
|