@elench/testkit 0.1.134 → 0.1.136

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 (40) hide show
  1. package/README.md +38 -0
  2. package/lib/cli/commands/local/down.mjs +37 -0
  3. package/lib/cli/commands/local/env.mjs +31 -0
  4. package/lib/cli/commands/local/logs.mjs +35 -0
  5. package/lib/cli/commands/local/shell.mjs +49 -0
  6. package/lib/cli/commands/local/status.mjs +34 -0
  7. package/lib/cli/commands/local/up.mjs +39 -0
  8. package/lib/cli/entrypoint.mjs +12 -4
  9. package/lib/cli/renderers/status/text.mjs +14 -0
  10. package/lib/config/index.mjs +117 -0
  11. package/lib/config/validation.mjs +9 -0
  12. package/lib/config-api/database-steps.mjs +1 -1
  13. package/lib/config-api/index.d.ts +22 -0
  14. package/lib/config-api/index.mjs +14 -0
  15. package/lib/database/fingerprint.mjs +13 -33
  16. package/lib/database/index.mjs +27 -12
  17. package/lib/database/schema-source.mjs +61 -6
  18. package/lib/env/index.d.ts +1 -0
  19. package/lib/env/index.mjs +5 -1
  20. package/lib/local/lifecycle.mjs +287 -0
  21. package/lib/local/orchestrator.mjs +314 -0
  22. package/lib/repo/fingerprint-policy.mjs +145 -0
  23. package/lib/repo/state.mjs +46 -44
  24. package/lib/runner/maintenance.mjs +23 -0
  25. package/lib/runner/processes.mjs +45 -6
  26. package/lib/runner/readiness.mjs +12 -1
  27. package/lib/runner/runtime-preparation.mjs +10 -5
  28. package/lib/runner/services.mjs +24 -18
  29. package/lib/runner/status-model.mjs +27 -0
  30. package/lib/runner/template.mjs +6 -1
  31. package/node_modules/@elench/next-analysis/package.json +1 -1
  32. package/node_modules/@elench/testkit-bridge/package.json +2 -2
  33. package/node_modules/@elench/testkit-protocol/package.json +1 -1
  34. package/node_modules/@elench/ts-analysis/package.json +1 -1
  35. package/package.json +6 -5
  36. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +0 -188
  37. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +0 -1
  38. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +0 -293
  39. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +0 -1
  40. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +0 -25
@@ -1,3 +1,5 @@
1
+ import fs from "fs";
2
+ import path from "path";
1
3
  import { execFileSync, spawn } from "child_process";
2
4
 
3
5
  export function normalizeServiceStartCommand(command) {
@@ -10,28 +12,65 @@ export function normalizeServiceStartCommand(command) {
10
12
  throw new Error("Service start command must not be empty");
11
13
  }
12
14
 
13
- return trimmed.replace(/^exec\s+/u, "");
15
+ return trimmed;
14
16
  }
15
17
 
16
- export function startDetachedCommand(command, cwd, env) {
18
+ export function startDetachedCommand(command, cwd, env, options = {}) {
17
19
  const normalizedCommand = normalizeServiceStartCommand(command);
20
+ const { stdio, close } = resolveDetachedStdio(options);
21
+ let child;
18
22
  if (process.platform === "win32") {
19
- return spawn(normalizedCommand, {
23
+ child = spawn(normalizedCommand, {
20
24
  cwd,
21
25
  env,
22
26
  detached: true,
23
27
  shell: true,
24
- stdio: ["ignore", "pipe", "pipe"],
28
+ stdio,
25
29
  });
30
+ close();
31
+ if (options.unref) child.unref();
32
+ return child;
26
33
  }
27
34
 
28
35
  const shell = process.env.SHELL || "/bin/sh";
29
- return spawn(shell, ["-lc", `exec ${normalizedCommand}`], {
36
+ child = spawn(shell, ["-lc", `exec ${normalizedCommand}`], {
30
37
  cwd,
31
38
  env,
32
39
  detached: true,
33
- stdio: ["ignore", "pipe", "pipe"],
40
+ stdio,
34
41
  });
42
+ close();
43
+ if (options.unref) child.unref();
44
+ return child;
45
+ }
46
+
47
+ function resolveDetachedStdio(options = {}) {
48
+ if (!options.stdoutPath && !options.stderrPath) {
49
+ return { stdio: ["ignore", "pipe", "pipe"], close() {} };
50
+ }
51
+ const fds = [];
52
+ const openLog = (filePath) => {
53
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
54
+ const fd = fs.openSync(filePath, "a");
55
+ fds.push(fd);
56
+ return fd;
57
+ };
58
+ return {
59
+ stdio: [
60
+ "ignore",
61
+ options.stdoutPath ? openLog(options.stdoutPath) : "ignore",
62
+ options.stderrPath ? openLog(options.stderrPath) : "ignore",
63
+ ],
64
+ close() {
65
+ for (const fd of fds) {
66
+ try {
67
+ fs.closeSync(fd);
68
+ } catch {
69
+ // Best-effort descriptor cleanup.
70
+ }
71
+ }
72
+ },
73
+ };
35
74
  }
36
75
 
37
76
  export function killChildProcess(child, signal) {
@@ -6,6 +6,11 @@ import {
6
6
  isPidRunning,
7
7
  listRunManifests,
8
8
  } from "./lifecycle.mjs";
9
+ import {
10
+ cleanupStaleLocalEnvironments,
11
+ findLocalPortOwner,
12
+ formatLocalEnvironmentSummary,
13
+ } from "../local/lifecycle.mjs";
9
14
  import { socketFromUrl } from "./template.mjs";
10
15
 
11
16
  export const DEFAULT_READY_TIMEOUT_MS = 120_000;
@@ -48,15 +53,21 @@ export async function assertLocalServicePortsAvailable(config, isPortInUse) {
48
53
 
49
54
  if (await isPortInUse(socket)) {
50
55
  await cleanupStaleRuns(config.productDir);
56
+ await cleanupStaleLocalEnvironments(config.productDir);
51
57
  }
52
58
 
53
59
  if (await isPortInUse(socket)) {
54
60
  const owner = findPortOwner(config.productDir, socket);
61
+ const localOwner = owner ? null : findLocalPortOwner(config.productDir, socket);
55
62
  const ownerDetail = owner
56
63
  ? owner.active
57
64
  ? ` Active testkit run ${formatRunSummary(owner.manifest)} owns ${key} via ${owner.service.runtimeLabel}:${owner.service.serviceName}.`
58
65
  : ` Stale testkit run ${formatRunSummary(owner.manifest)} owns ${key}.`
59
- : "";
66
+ : localOwner
67
+ ? localOwner.active
68
+ ? ` Active testkit local environment ${formatLocalEnvironmentSummary(localOwner.manifest)} owns ${key} via ${localOwner.service.serviceName}.`
69
+ : ` Stale testkit local environment ${formatLocalEnvironmentSummary(localOwner.manifest)} owns ${key}.`
70
+ : "";
60
71
  throw new Error(
61
72
  `Cannot start "${config.runtimeLabel}:${config.name}" because ${key} is already in use. ` +
62
73
  `Stop the existing process and rerun testkit.${ownerDetail}`
@@ -41,7 +41,11 @@ export async function prepareRuntimeService(config, options = {}) {
41
41
  fs.mkdirSync(prepareDir, { recursive: true });
42
42
 
43
43
  const env = {
44
- ...buildExecutionEnv(config, config.testkit.local?.env || {}, process.env),
44
+ ...buildExecutionEnv(
45
+ config,
46
+ { ...(config.testkit.local?.env || {}), ...(options.extraEnv || {}) },
47
+ process.env
48
+ ),
45
49
  };
46
50
  const databaseUrl = readDatabaseUrl(config.stateDir);
47
51
  if (databaseUrl) {
@@ -128,12 +132,13 @@ export async function computeRuntimePrepareFingerprint(config) {
128
132
  })
129
133
  );
130
134
  hash.update(JSON.stringify(collectRuntimeDatabaseFingerprintInputs(config)));
135
+ const fingerprints = config.testkit.fingerprints || {};
131
136
 
132
137
  for (const envFile of config.testkit.envFiles || []) {
133
- appendFileToHash(hash, config.productDir, resolveServiceCwd(config.productDir, envFile));
138
+ appendFileToHash(hash, config.productDir, resolveServiceCwd(config.productDir, envFile), fingerprints);
134
139
  }
135
140
  for (const input of collectConfiguredInputs(config.productDir, config.testkit.runtime.prepare)) {
136
- appendResolvedInputToHash(hash, config.productDir, input);
141
+ appendResolvedInputToHash(hash, config.productDir, input, fingerprints);
137
142
  }
138
143
 
139
144
  return hash.digest("hex");
@@ -174,9 +179,9 @@ function collectDatabasePlaceholderServices(value, out, defaultServiceName) {
174
179
  }
175
180
  }
176
181
 
177
- function appendResolvedInputToHash(hash, productDir, absPath) {
182
+ function appendResolvedInputToHash(hash, productDir, absPath, fingerprints) {
178
183
  const relative = path.relative(productDir, absPath);
179
- appendInputToHash(hash, productDir, relative);
184
+ appendInputToHash(hash, productDir, relative, fingerprints);
180
185
  }
181
186
 
182
187
  function readPrepareManifest(manifestPath) {
@@ -32,7 +32,7 @@ export async function startLocalService(config, lifecycle, options = {}) {
32
32
  const resolvedToolchain = await resolveConfiguredToolchain(config);
33
33
  await announceResolvedToolchain(config, resolvedToolchain, options.reporter);
34
34
  const env = applyToolchainEnv(
35
- buildExecutionEnv(config, config.testkit.local.env, process.env),
35
+ buildExecutionEnv(config, { ...(config.testkit.local.env || {}), ...(options.extraEnv || {}) }, process.env),
36
36
  resolvedToolchain
37
37
  );
38
38
  const port = config.testkit.local.port || numericPortFromUrl(config.testkit.local.baseUrl);
@@ -48,29 +48,35 @@ export async function startLocalService(config, lifecycle, options = {}) {
48
48
  await assertLocalServicePortsAvailable(config, isPortInUse);
49
49
 
50
50
  options.reporter?.localServiceStarting?.(config, config.testkit.local.start);
51
- const child = startDetachedCommand(config.testkit.local.start, cwd, env);
51
+ const serviceLogFiles = options.serviceLogFiles?.(config) || null;
52
+ const child = startDetachedCommand(config.testkit.local.start, cwd, env, {
53
+ ...(serviceLogFiles || {}),
54
+ unref: Boolean(serviceLogFiles),
55
+ });
52
56
  const logRecord = options.logRegistry?.ensureServiceLogRecord(config);
53
57
  const liveWriter =
54
58
  options.reporter?.outputMode === "debug"
55
59
  ? (line) => options.reporter.writeDebugLine?.(line)
56
60
  : null;
57
61
 
58
- const outputDrains = [
59
- captureOutput(child.stdout, {
60
- livePrefix: `[${config.runtimeLabel}:${config.name}]`,
61
- liveWriter,
62
- onLine(line) {
63
- if (logRecord) options.logRegistry.append(logRecord, "stdout", line);
64
- },
65
- }),
66
- captureOutput(child.stderr, {
67
- livePrefix: `[${config.runtimeLabel}:${config.name}]`,
68
- liveWriter,
69
- onLine(line) {
70
- if (logRecord) options.logRegistry.append(logRecord, "stderr", line);
71
- },
72
- }),
73
- ];
62
+ const outputDrains = serviceLogFiles
63
+ ? []
64
+ : [
65
+ captureOutput(child.stdout, {
66
+ livePrefix: `[${config.runtimeLabel}:${config.name}]`,
67
+ liveWriter,
68
+ onLine(line) {
69
+ if (logRecord) options.logRegistry.append(logRecord, "stdout", line);
70
+ },
71
+ }),
72
+ captureOutput(child.stderr, {
73
+ livePrefix: `[${config.runtimeLabel}:${config.name}]`,
74
+ liveWriter,
75
+ onLine(line) {
76
+ if (logRecord) options.logRegistry.append(logRecord, "stderr", line);
77
+ },
78
+ }),
79
+ ];
74
80
  registerManagedService(lifecycle, config, child, cwd, "SIGTERM");
75
81
 
76
82
  const readyTimeoutMs = config.testkit.local.readyTimeoutMs || DEFAULT_READY_TIMEOUT_MS;
@@ -3,6 +3,7 @@ import path from "path";
3
3
  import { buildRuntimeIds } from "./execution-config.mjs";
4
4
  import { buildGraphDirName, resolveRuntimeConfigs } from "./planning.mjs";
5
5
  import { isPidRunning, listRunManifests } from "./lifecycle.mjs";
6
+ import { isLocalEnvironmentActive, listLocalEnvironmentManifests } from "../local/lifecycle.mjs";
6
7
  import { readGraphMetadata } from "./state.mjs";
7
8
 
8
9
  const BUNDLE_MANIFEST = "manifest.json";
@@ -18,6 +19,7 @@ export function collectStatusModel(config, { allConfigs = [config] } = {}) {
18
19
  });
19
20
  const serviceState = collectDirectorySummary(config.stateDir);
20
21
  const runs = collectRunStatus(productDir);
22
+ const localEnvironments = collectLocalEnvironmentStatus(productDir);
21
23
  const bundles = collectBundleCacheStatus(productDir, config.name);
22
24
  const assistant = collectAssistantResultStatus(productDir);
23
25
  const warnings = collectWarnings({ runtimeGraphs, bundles, assistant });
@@ -25,6 +27,7 @@ export function collectStatusModel(config, { allConfigs = [config] } = {}) {
25
27
  serviceState.exists ||
26
28
  runtimeGraphs.some((graph) => graph.exists) ||
27
29
  runs.total > 0 ||
30
+ localEnvironments.total > 0 ||
28
31
  bundles.exists ||
29
32
  assistant.exists;
30
33
 
@@ -40,6 +43,7 @@ export function collectStatusModel(config, { allConfigs = [config] } = {}) {
40
43
  },
41
44
  hasState,
42
45
  runs,
46
+ localEnvironments,
43
47
  serviceState,
44
48
  runtimeGraphs,
45
49
  caches: {
@@ -50,6 +54,29 @@ export function collectStatusModel(config, { allConfigs = [config] } = {}) {
50
54
  };
51
55
  }
52
56
 
57
+ function collectLocalEnvironmentStatus(productDir) {
58
+ const environments = listLocalEnvironmentManifests(productDir).map((manifest) => {
59
+ const active = isLocalEnvironmentActive(manifest);
60
+ return {
61
+ name: manifest.name,
62
+ status: active ? "running" : manifest.status || "stopped",
63
+ target: manifest.target || null,
64
+ ports: [
65
+ ...new Set(
66
+ (manifest.services || []).flatMap((service) =>
67
+ (service.ports || []).map((socket) => `${socket.host}:${socket.port}`)
68
+ )
69
+ ),
70
+ ].sort(),
71
+ };
72
+ });
73
+ return {
74
+ total: environments.length,
75
+ active: environments.filter((environment) => environment.status === "running").length,
76
+ environments,
77
+ };
78
+ }
79
+
53
80
  export function collectCleanupTargets(productDir, { allConfigs = [], serviceName = null, cache = [] } = {}) {
54
81
  const desiredGraphs = collectDesiredRuntimeGraphs(allConfigs);
55
82
  const runtimeGraphs = collectRuntimeGraphStatus(productDir, { desiredGraphs, serviceName });
@@ -12,6 +12,7 @@ export function resolveRuntimeInstanceConfigs(runtimeConfigs, runtimeId, runtime
12
12
  const portMap = buildPortMap(runtimeConfigs, runtimeId, {
13
13
  index: options.portNamespaceIndex || 0,
14
14
  stride: options.portNamespaceStride || 1,
15
+ portOffset: options.portOffset || 0,
15
16
  });
16
17
  const baseUrlByService = new Map();
17
18
  const readyUrlByService = new Map();
@@ -76,7 +77,7 @@ export function resolveRuntimeInstanceConfigs(runtimeConfigs, runtimeId, runtime
76
77
  export function buildPortMap(runtimeConfigs, runtimeId, namespace = {}) {
77
78
  const portMap = new Map();
78
79
  const seen = new Map();
79
- const offset = runtimePortOffset(runtimeId, namespace);
80
+ const offset = runtimePortOffset(runtimeId, namespace) + Number(namespace.portOffset || 0);
80
81
 
81
82
  for (const config of runtimeConfigs) {
82
83
  if (!config.testkit.local) continue;
@@ -242,7 +243,11 @@ function buildExecutionEnvWithContext(config, lease, extraEnv, processEnv, optio
242
243
  ...resolveEnvTemplates(localEnv, templateContext),
243
244
  ...resolveEnvTemplates(extraEnv, templateContext),
244
245
  TESTKIT_ACTIVE: "1",
246
+ TESTKIT_MODE: options.mode || config.testkit?.mode || "test",
245
247
  ...(config.runtimeId ? { TESTKIT_RUNTIME_ID: String(config.runtimeId) } : {}),
248
+ ...(config.testkit?.localEnvironmentName
249
+ ? { TESTKIT_LOCAL_ENV: String(config.testkit.localEnvironmentName) }
250
+ : {}),
246
251
  ...(lease?.leaseId ? { TESTKIT_LEASE_ID: String(lease.leaseId) } : {}),
247
252
  ...(lease?.leaseDir ? { TESTKIT_LEASE_DIR: lease.leaseDir } : {}),
248
253
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/next-analysis",
3
- "version": "0.1.134",
3
+ "version": "0.1.136",
4
4
  "description": "SWC-backed Next.js source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-bridge",
3
- "version": "0.1.134",
3
+ "version": "0.1.136",
4
4
  "description": "Browser bridge helpers for testkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "typecheck": "tsc -p tsconfig.json --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@elench/testkit-protocol": "0.1.134"
25
+ "@elench/testkit-protocol": "0.1.136"
26
26
  },
27
27
  "private": false
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-protocol",
3
- "version": "0.1.134",
3
+ "version": "0.1.136",
4
4
  "description": "Shared browser protocol for testkit bridge and extension consumers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/ts-analysis",
3
- "version": "0.1.134",
3
+ "version": "0.1.136",
4
4
  "description": "TypeScript compiler-backed source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit",
3
- "version": "0.1.134",
3
+ "version": "0.1.136",
4
4
  "description": "Assistant-first CLI for running, inspecting, and debugging local testkit suites",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -66,6 +66,7 @@
66
66
  "test:engine-version:compat": "node scripts/test-engine-version-compat.mjs",
67
67
  "test:live": "node scripts/live-sandbox/harness.mjs",
68
68
  "test:live:github": "node scripts/test-live-github-fixture.mjs",
69
+ "test:live:local-prod-launcher": "node scripts/test-live-local-prod-launcher-fixture.mjs",
69
70
  "test:live:neon": "node scripts/test-database-version-compat.mjs --neon-only",
70
71
  "test:unit": "npm run build:assistant && npm run build:packages && npm run test:audit && vitest run --config vitest.unit.config.mjs",
71
72
  "test:integration": "npm run build:assistant && npm run build:packages && vitest run test/integration",
@@ -95,10 +96,10 @@
95
96
  },
96
97
  "dependencies": {
97
98
  "@babel/code-frame": "^7.29.0",
98
- "@elench/next-analysis": "0.1.134",
99
- "@elench/testkit-bridge": "0.1.134",
100
- "@elench/testkit-protocol": "0.1.134",
101
- "@elench/ts-analysis": "0.1.134",
99
+ "@elench/next-analysis": "0.1.136",
100
+ "@elench/testkit-bridge": "0.1.136",
101
+ "@elench/testkit-protocol": "0.1.136",
102
+ "@elench/ts-analysis": "0.1.136",
102
103
  "@oclif/core": "^4.10.6",
103
104
  "@playwright/test": "^1.52.0",
104
105
  "esbuild": "^0.25.11",
@@ -1,188 +0,0 @@
1
- export declare const TESTKIT_BROWSER_PROTOCOL_VERSION = 1;
2
- export declare const TESTKIT_COVERAGE_GRAPH_VERSION = 1;
3
- export type BrowserTargetKind = "testId" | "role" | "text" | "css" | "xpath" | "component";
4
- export type BrowserConfidence = "low" | "medium" | "high";
5
- export type BrowserFailureState = "failing" | "healthy" | "unavailable";
6
- export type BrowserCoverageState = "covered" | "missing" | "unavailable";
7
- export type BridgeSurfaceImportance = "critical" | "high" | "medium" | "low";
8
- export type BridgeCoverageSupportKind = "direct" | "indirect" | "mixed";
9
- export type CoverageNodeKind = "page_view" | "ui_surface" | "ui_action" | "client_request" | "api_route" | "server_action" | "server_capability" | "data_capability" | "test_file";
10
- export type CoverageEdgeKind = "contains" | "renders" | "triggers" | "requests" | "handles" | "delegates_to" | "covers";
11
- export type CoverageEvidenceSource = "convention" | "static" | "runtime";
12
- export type CoverageGraphDiagnosticLevel = "info" | "warn";
13
- export interface BrowserTarget {
14
- kind: BrowserTargetKind;
15
- value: string;
16
- label?: string;
17
- confidence?: BrowserConfidence;
18
- }
19
- export interface BrowserMetadata {
20
- label?: string;
21
- origins?: string[];
22
- routes?: string[];
23
- targets?: BrowserTarget[];
24
- }
25
- export interface BrowserMetadataDocument {
26
- schemaVersion: number;
27
- browser: BrowserMetadata;
28
- }
29
- export interface CoverageGraphNode {
30
- id: string;
31
- kind: CoverageNodeKind;
32
- service: string;
33
- label: string;
34
- filePath?: string;
35
- route?: string;
36
- method?: string;
37
- path?: string;
38
- target?: BrowserTarget | null;
39
- metadata?: Record<string, string | number | boolean | null>;
40
- }
41
- export interface CoverageGraphEdge {
42
- id: string;
43
- kind: CoverageEdgeKind;
44
- from: string;
45
- to: string;
46
- confidence?: BrowserConfidence;
47
- metadata?: Record<string, string | number | boolean | null>;
48
- }
49
- export interface CoverageEvidenceDetails {
50
- requestPaths?: string[];
51
- route?: string;
52
- targets?: BrowserTarget[];
53
- }
54
- export interface CoverageEvidence {
55
- id: string;
56
- source: CoverageEvidenceSource;
57
- confidence?: BrowserConfidence;
58
- service: string;
59
- suiteName: string;
60
- type: string;
61
- testFilePath: string;
62
- coveredNodeIds: string[];
63
- details?: CoverageEvidenceDetails;
64
- }
65
- export interface CoverageGraphDiagnostic {
66
- level: CoverageGraphDiagnosticLevel;
67
- code: string;
68
- filePath: string;
69
- service: string;
70
- message: string;
71
- }
72
- export interface CoverageGraph {
73
- schemaVersion: number;
74
- nodes: CoverageGraphNode[];
75
- edges: CoverageGraphEdge[];
76
- evidence: CoverageEvidence[];
77
- diagnostics: CoverageGraphDiagnostic[];
78
- }
79
- export interface BridgeProductRef {
80
- name: string;
81
- directory: string;
82
- }
83
- export interface BridgeServiceRef {
84
- name: string;
85
- baseUrl: string;
86
- origin: string;
87
- }
88
- export interface BrowserMatchResponse {
89
- protocolVersion: number;
90
- url: string;
91
- origin: string;
92
- route: string;
93
- matched: boolean;
94
- product: BridgeProductRef;
95
- service: BridgeServiceRef | null;
96
- }
97
- export interface BridgeRunSummary {
98
- artifactAvailable: boolean;
99
- generatedAt: string | null;
100
- status: string | null;
101
- }
102
- export interface BridgeSupportingTestRef {
103
- service: string;
104
- suite: string;
105
- type: string;
106
- filePath: string;
107
- label: string;
108
- status?: "passed" | "failed" | "skipped" | "not_run";
109
- error?: string | null;
110
- }
111
- export interface BridgeCoverageViaNodeRef {
112
- id: string;
113
- kind: CoverageNodeKind;
114
- label: string;
115
- route?: string;
116
- method?: string;
117
- path?: string;
118
- }
119
- export interface FailureOverlayEntry {
120
- id: string;
121
- kind: CoverageNodeKind;
122
- label: string;
123
- service: string;
124
- route?: string | null;
125
- targets: BrowserTarget[];
126
- failedTests: BridgeSupportingTestRef[];
127
- viaNodes: BridgeCoverageViaNodeRef[];
128
- importance?: BridgeSurfaceImportance;
129
- surfaceKind?: string | null;
130
- reason?: string | null;
131
- }
132
- export interface CoverageOverlayEntry {
133
- id: string;
134
- kind: CoverageNodeKind;
135
- label: string;
136
- service: string;
137
- route?: string | null;
138
- targets: BrowserTarget[];
139
- supportingTests: BridgeSupportingTestRef[];
140
- viaNodes: BridgeCoverageViaNodeRef[];
141
- confidence: BrowserConfidence;
142
- importance?: BridgeSurfaceImportance;
143
- surfaceKind?: string | null;
144
- supportKind?: BridgeCoverageSupportKind;
145
- reason?: string | null;
146
- }
147
- export interface PageOverlayResponse {
148
- protocolVersion: number;
149
- page: {
150
- url: string;
151
- origin: string;
152
- route: string;
153
- };
154
- match: BrowserMatchResponse;
155
- run: BridgeRunSummary;
156
- summary: {
157
- failureState: BrowserFailureState;
158
- coverageState: BrowserCoverageState;
159
- relatedFailureCount: number;
160
- relatedCoverageCount: number;
161
- coverageBreakdown?: {
162
- direct: number;
163
- indirect: number;
164
- mixed: number;
165
- };
166
- };
167
- failures: FailureOverlayEntry[];
168
- coverage: CoverageOverlayEntry[];
169
- }
170
- export interface BridgeErrorResponse {
171
- protocolVersion: number;
172
- error: {
173
- code: string;
174
- message: string;
175
- };
176
- }
177
- export declare function normalizeBrowserTarget(value: unknown): BrowserTarget | null;
178
- export declare function normalizeBrowserMetadata(value: unknown): BrowserMetadata | null;
179
- export declare function normalizeBrowserMetadataDocument(value: unknown): BrowserMetadataDocument | null;
180
- export declare function normalizeCoverageGraphNode(value: unknown): CoverageGraphNode | null;
181
- export declare function normalizeCoverageGraphEdge(value: unknown): CoverageGraphEdge | null;
182
- export declare function normalizeCoverageEvidence(value: unknown): CoverageEvidence | null;
183
- export declare function normalizeCoverageGraphDiagnostic(value: unknown): CoverageGraphDiagnostic | null;
184
- export declare function normalizeCoverageGraph(value: unknown): CoverageGraph | null;
185
- export declare function isPageOverlayResponse(value: unknown): value is PageOverlayResponse;
186
- export declare function normalizePageOverlayResponse(value: unknown): PageOverlayResponse | null;
187
- export declare function createBridgeErrorResponse(code: string, message: string): BridgeErrorResponse;
188
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC;AAC3F,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC1D,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AACxE,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AACzE,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,M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