@elench/testkit 0.1.136 → 0.1.138
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/lib/config/index.mjs +81 -2
- package/lib/config-api/index.d.ts +77 -0
- package/lib/config-api/index.mjs +78 -1
- package/lib/docker-compat/matrix.mjs +135 -0
- package/lib/kiln/client.mjs +120 -0
- package/lib/local/kiln-driver.mjs +640 -0
- package/lib/local/lifecycle.mjs +2 -0
- package/lib/local/orchestrator.mjs +36 -5
- package/lib/runner/template.mjs +70 -5
- package/node_modules/@elench/next-analysis/package.json +1 -1
- package/node_modules/@elench/testkit-bridge/package.json +2 -2
- package/node_modules/@elench/testkit-protocol/package.json +1 -1
- package/node_modules/@elench/ts-analysis/package.json +1 -1
- package/package.json +7 -5
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +188 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +293 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +25 -0
|
@@ -8,6 +8,14 @@ import { resolveRuntimeConfigs } from "../runner/planning.mjs";
|
|
|
8
8
|
import { startLocalServices } from "../runner/services.mjs";
|
|
9
9
|
import { buildExecutionEnv, resolveRuntimeInstanceConfigs } from "../runner/template.mjs";
|
|
10
10
|
import { readDatabaseUrl } from "../runner/state-io.mjs";
|
|
11
|
+
import {
|
|
12
|
+
buildKilnLocalStatus,
|
|
13
|
+
kilnLocalDown,
|
|
14
|
+
kilnLocalEnv,
|
|
15
|
+
kilnLocalLogs,
|
|
16
|
+
kilnLocalShell,
|
|
17
|
+
kilnLocalUp,
|
|
18
|
+
} from "./kiln-driver.mjs";
|
|
11
19
|
import {
|
|
12
20
|
cleanupStaleLocalEnvironments,
|
|
13
21
|
createLocalEnvironmentLifecycle,
|
|
@@ -21,6 +29,9 @@ import {
|
|
|
21
29
|
export async function localUp(options = {}) {
|
|
22
30
|
const context = await loadConfigContext({ dir: options.dir });
|
|
23
31
|
const environment = resolveEnvironment(context, options);
|
|
32
|
+
if (environment.driver === "kiln") {
|
|
33
|
+
return kilnLocalUp(context, environment, options);
|
|
34
|
+
}
|
|
24
35
|
const existing = readLocalEnvironmentManifest(context.productDir, environment.name);
|
|
25
36
|
if (existing && isLocalEnvironmentActive(existing)) {
|
|
26
37
|
throw new Error(`Local environment "${environment.name}" is already running. Stop it with testkit local down ${environment.name}.`);
|
|
@@ -77,21 +88,30 @@ export async function localUp(options = {}) {
|
|
|
77
88
|
export async function localDown(options = {}) {
|
|
78
89
|
const context = await loadConfigContext({ dir: options.dir });
|
|
79
90
|
const name = normalizeEnvironmentName(options.name || "local");
|
|
80
|
-
const manifest =
|
|
91
|
+
const manifest = readLocalEnvironmentManifest(context.productDir, name);
|
|
92
|
+
if (manifest?.driver === "kiln") {
|
|
93
|
+
await kilnLocalDown(context, name, { destroyState: Boolean(options.destroyState) });
|
|
94
|
+
return buildKilnLocalStatus(context.productDir, name);
|
|
95
|
+
}
|
|
96
|
+
const stopped = await stopLocalEnvironment(context.productDir, name, {
|
|
81
97
|
removeRuntimeState: Boolean(options.destroyState),
|
|
82
98
|
});
|
|
83
|
-
return
|
|
99
|
+
return stopped
|
|
84
100
|
? buildLocalStatus(context.productDir, name)
|
|
85
101
|
: { name, exists: false, lines: [`Local Environment: ${name}`, " not found"] };
|
|
86
102
|
}
|
|
87
103
|
|
|
88
104
|
export async function localStatus(options = {}) {
|
|
89
105
|
const context = await loadConfigContext({ dir: options.dir });
|
|
90
|
-
if (options.name)
|
|
106
|
+
if (options.name) {
|
|
107
|
+
const name = normalizeEnvironmentName(options.name);
|
|
108
|
+
const manifest = readLocalEnvironmentManifest(context.productDir, name);
|
|
109
|
+
return manifest?.driver === "kiln" ? buildKilnLocalStatus(context.productDir, name) : buildLocalStatus(context.productDir, name);
|
|
110
|
+
}
|
|
91
111
|
return {
|
|
92
112
|
productDir: context.productDir,
|
|
93
113
|
environments: listLocalEnvironmentManifests(context.productDir).map((manifest) =>
|
|
94
|
-
buildLocalStatus(context.productDir, manifest.name)
|
|
114
|
+
manifest.driver === "kiln" ? buildKilnLocalStatus(context.productDir, manifest.name) : buildLocalStatus(context.productDir, manifest.name)
|
|
95
115
|
),
|
|
96
116
|
};
|
|
97
117
|
}
|
|
@@ -101,6 +121,7 @@ export async function localEnv(options = {}) {
|
|
|
101
121
|
const environment = resolveEnvironment(context, options);
|
|
102
122
|
const manifest = readLocalEnvironmentManifest(context.productDir, environment.name);
|
|
103
123
|
if (!manifest) throw new Error(`Local environment "${environment.name}" has not been started.`);
|
|
124
|
+
if (manifest.driver === "kiln") return kilnLocalEnv(context, environment.name, options);
|
|
104
125
|
const runtimeConfigs = buildLocalRuntimeConfigs(context.configs, environment, manifest.runtimeDir);
|
|
105
126
|
const serviceConfig = resolveService(runtimeConfigs, options.service || environment.target);
|
|
106
127
|
const env = buildServiceEnv(serviceConfig, environment.env);
|
|
@@ -119,6 +140,7 @@ export async function localLogs(options = {}) {
|
|
|
119
140
|
const name = normalizeEnvironmentName(options.name || "local");
|
|
120
141
|
const manifest = readLocalEnvironmentManifest(context.productDir, name);
|
|
121
142
|
if (!manifest) throw new Error(`Local environment "${name}" has not been started.`);
|
|
143
|
+
if (manifest.driver === "kiln") return kilnLocalLogs(context, name, options);
|
|
122
144
|
const logsDir = path.join(getEnvironmentDir(context.productDir, name), "logs");
|
|
123
145
|
const serviceNames = options.service
|
|
124
146
|
? [options.service]
|
|
@@ -140,6 +162,7 @@ export async function localShell(options = {}) {
|
|
|
140
162
|
const environment = resolveEnvironment(context, options);
|
|
141
163
|
const manifest = readLocalEnvironmentManifest(context.productDir, environment.name);
|
|
142
164
|
if (!manifest) throw new Error(`Local environment "${environment.name}" has not been started.`);
|
|
165
|
+
if (manifest.driver === "kiln") return kilnLocalShell(context, environment.name, options);
|
|
143
166
|
const runtimeConfigs = buildLocalRuntimeConfigs(context.configs, environment, manifest.runtimeDir);
|
|
144
167
|
const serviceConfig = resolveService(runtimeConfigs, options.service || environment.target);
|
|
145
168
|
const env = buildServiceEnv(serviceConfig, environment.env);
|
|
@@ -162,6 +185,7 @@ export function buildLocalRuntimeConfigs(allConfigs, environment, runtimeDir) {
|
|
|
162
185
|
return resolveRuntimeInstanceConfigs(runtimeConfigs, "local", runtimeDir, {
|
|
163
186
|
graphDirName: runtimeConfigs.map((config) => config.name).sort().join("__"),
|
|
164
187
|
portOffset: environment.portOffset || 0,
|
|
188
|
+
publicHost: environment.publicHost || null,
|
|
165
189
|
}).map((config) => applyLocalEnvironmentConfig(config, environment));
|
|
166
190
|
}
|
|
167
191
|
|
|
@@ -202,17 +226,24 @@ export function buildLocalStatus(productDir, name) {
|
|
|
202
226
|
};
|
|
203
227
|
}
|
|
204
228
|
|
|
205
|
-
function resolveEnvironment(context, options = {}) {
|
|
229
|
+
export function resolveEnvironment(context, options = {}) {
|
|
206
230
|
const name = normalizeEnvironmentName(options.name || "local");
|
|
207
231
|
const configured = context.environments[name] || null;
|
|
208
232
|
const target = options.service || configured?.target || inferDefaultTarget(context.configs);
|
|
233
|
+
const requestedDriver = process.env.TESTKIT_LOCAL_DRIVER || options.driver || configured?.driver || "host";
|
|
234
|
+
const driver = process.env.TESTKIT_KILN_INNER === "1" ? "host" : requestedDriver;
|
|
209
235
|
return {
|
|
210
236
|
name,
|
|
211
237
|
kind: "local",
|
|
238
|
+
driver,
|
|
212
239
|
target,
|
|
213
240
|
data: options.rebuild ? "rebuild" : options.reset ? "reset" : configured?.data || "reuse",
|
|
214
241
|
portOffset: Number(options.portOffset ?? configured?.portOffset ?? 0),
|
|
215
242
|
env: { ...(configured?.env || {}) },
|
|
243
|
+
kiln: configured?.kiln || null,
|
|
244
|
+
publicHost: process.env.TESTKIT_PUBLIC_HOST || configured?.publicHost || null,
|
|
245
|
+
resources: configured?.resources || {},
|
|
246
|
+
productionLike: Boolean(configured?.productionLike),
|
|
216
247
|
};
|
|
217
248
|
}
|
|
218
249
|
|
package/lib/runner/template.mjs
CHANGED
|
@@ -16,6 +16,7 @@ export function resolveRuntimeInstanceConfigs(runtimeConfigs, runtimeId, runtime
|
|
|
16
16
|
});
|
|
17
17
|
const baseUrlByService = new Map();
|
|
18
18
|
const readyUrlByService = new Map();
|
|
19
|
+
const publicBaseUrlByService = new Map();
|
|
19
20
|
const stateDirByService = new Map();
|
|
20
21
|
|
|
21
22
|
for (const config of runtimeConfigs) {
|
|
@@ -49,6 +50,9 @@ export function resolveRuntimeInstanceConfigs(runtimeConfigs, runtimeId, runtime
|
|
|
49
50
|
})
|
|
50
51
|
);
|
|
51
52
|
}
|
|
53
|
+
for (const [serviceName, baseUrl] of baseUrlByService.entries()) {
|
|
54
|
+
publicBaseUrlByService.set(serviceName, publicUrl(baseUrl, options.publicHost || null));
|
|
55
|
+
}
|
|
52
56
|
|
|
53
57
|
const urlMappings = [];
|
|
54
58
|
for (const config of runtimeConfigs) {
|
|
@@ -68,6 +72,8 @@ export function resolveRuntimeInstanceConfigs(runtimeConfigs, runtimeId, runtime
|
|
|
68
72
|
portMap,
|
|
69
73
|
baseUrlByService,
|
|
70
74
|
readyUrlByService,
|
|
75
|
+
publicBaseUrlByService,
|
|
76
|
+
options.publicHost || null,
|
|
71
77
|
stateDirByService,
|
|
72
78
|
urlMappings
|
|
73
79
|
)
|
|
@@ -114,6 +120,8 @@ export function resolveRuntimeConfig(
|
|
|
114
120
|
portMap,
|
|
115
121
|
baseUrlByService,
|
|
116
122
|
readyUrlByService,
|
|
123
|
+
publicBaseUrlByService,
|
|
124
|
+
publicHost,
|
|
117
125
|
stateDirByService,
|
|
118
126
|
urlMappings
|
|
119
127
|
) {
|
|
@@ -130,6 +138,8 @@ export function resolveRuntimeConfig(
|
|
|
130
138
|
portMap,
|
|
131
139
|
baseUrlByService,
|
|
132
140
|
readyUrlByService,
|
|
141
|
+
publicBaseUrlByService,
|
|
142
|
+
publicHost,
|
|
133
143
|
stateDirByService,
|
|
134
144
|
urlMappings,
|
|
135
145
|
leaseId: null,
|
|
@@ -230,7 +240,9 @@ export function buildTaskExecutionEnv(config, lease, extraEnv = {}, processEnv =
|
|
|
230
240
|
|
|
231
241
|
function buildExecutionEnvWithContext(config, lease, extraEnv, processEnv, options = {}) {
|
|
232
242
|
const inheritedEnv = { ...processEnv };
|
|
233
|
-
|
|
243
|
+
delete inheritedEnv.DATABASE_URL;
|
|
244
|
+
delete inheritedEnv.TESTKIT_RESOURCE_CONNECTIONS_JSON;
|
|
245
|
+
const templateContext = buildTemplateContext(config, lease, processEnv);
|
|
234
246
|
const serviceEnv = options.omitRuntimeDatabaseBindings
|
|
235
247
|
? omitRuntimeDatabaseBindings(config.testkit.serviceEnv || {})
|
|
236
248
|
: config.testkit.serviceEnv || {};
|
|
@@ -251,7 +263,6 @@ function buildExecutionEnvWithContext(config, lease, extraEnv, processEnv, optio
|
|
|
251
263
|
...(lease?.leaseId ? { TESTKIT_LEASE_ID: String(lease.leaseId) } : {}),
|
|
252
264
|
...(lease?.leaseDir ? { TESTKIT_LEASE_DIR: lease.leaseDir } : {}),
|
|
253
265
|
};
|
|
254
|
-
delete env.DATABASE_URL;
|
|
255
266
|
return env;
|
|
256
267
|
}
|
|
257
268
|
|
|
@@ -274,7 +285,7 @@ export function buildPlaywrightEnv(config, baseUrl, lease, processEnv = process.
|
|
|
274
285
|
);
|
|
275
286
|
}
|
|
276
287
|
|
|
277
|
-
function buildTemplateContext(config, lease) {
|
|
288
|
+
function buildTemplateContext(config, lease, processEnv = process.env) {
|
|
278
289
|
const baseContext = config.testkit?.templateContext || {};
|
|
279
290
|
return {
|
|
280
291
|
...baseContext,
|
|
@@ -286,6 +297,7 @@ function buildTemplateContext(config, lease) {
|
|
|
286
297
|
prepareDir: config.testkit?.prepareDir || baseContext.prepareDir || null,
|
|
287
298
|
leaseId: lease?.leaseId || null,
|
|
288
299
|
leaseDir: lease?.leaseDir || null,
|
|
300
|
+
resourceConnectionByName: parseResourceConnections(processEnv.TESTKIT_RESOURCE_CONNECTIONS_JSON),
|
|
289
301
|
};
|
|
290
302
|
}
|
|
291
303
|
|
|
@@ -321,7 +333,7 @@ function finalizeSerializable(value, context) {
|
|
|
321
333
|
export function resolveTemplateString(value, context) {
|
|
322
334
|
if (typeof value !== "string") return value;
|
|
323
335
|
|
|
324
|
-
return value.replace(/\{([a-zA-Z]+)(?::([
|
|
336
|
+
return value.replace(/\{([a-zA-Z]+)(?::([^}]+))?\}/g, (_match, token, arg) => {
|
|
325
337
|
switch (token) {
|
|
326
338
|
case "runtime":
|
|
327
339
|
case "runtimeId":
|
|
@@ -362,6 +374,16 @@ export function resolveTemplateString(value, context) {
|
|
|
362
374
|
}
|
|
363
375
|
return readyUrl;
|
|
364
376
|
}
|
|
377
|
+
case "publicHost":
|
|
378
|
+
return context.publicHost || "127.0.0.1";
|
|
379
|
+
case "publicBaseUrl": {
|
|
380
|
+
const serviceName = arg || context.serviceName;
|
|
381
|
+
const publicBaseUrl = context.publicBaseUrlByService?.get(serviceName) || context.baseUrlByService.get(serviceName);
|
|
382
|
+
if (!publicBaseUrl) {
|
|
383
|
+
throw new Error(`Unknown publicBaseUrl placeholder for service "${serviceName}"`);
|
|
384
|
+
}
|
|
385
|
+
return publicBaseUrl;
|
|
386
|
+
}
|
|
365
387
|
case "dbUrl":
|
|
366
388
|
case "dbHost":
|
|
367
389
|
case "dbPort":
|
|
@@ -371,12 +393,29 @@ export function resolveTemplateString(value, context) {
|
|
|
371
393
|
const serviceName = arg || context.serviceName;
|
|
372
394
|
return resolveDatabaseTemplateValue(token, serviceName, context);
|
|
373
395
|
}
|
|
396
|
+
case "resource": {
|
|
397
|
+
const [resourceName, field = "url"] = String(arg || "").split(":");
|
|
398
|
+
return resolveResourceTemplateValue(resourceName, field, context);
|
|
399
|
+
}
|
|
374
400
|
default:
|
|
375
401
|
throw new Error(`Unsupported template token "{${token}${arg ? `:${arg}` : ""}}"`);
|
|
376
402
|
}
|
|
377
403
|
});
|
|
378
404
|
}
|
|
379
405
|
|
|
406
|
+
function publicUrl(rawUrl, publicHost) {
|
|
407
|
+
if (!publicHost) return rawUrl;
|
|
408
|
+
try {
|
|
409
|
+
const url = new URL(rawUrl);
|
|
410
|
+
url.hostname = publicHost;
|
|
411
|
+
let next = url.toString();
|
|
412
|
+
if (!rawUrl.endsWith("/") && url.pathname === "/" && next.endsWith("/")) next = next.slice(0, -1);
|
|
413
|
+
return next;
|
|
414
|
+
} catch {
|
|
415
|
+
return rawUrl;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
380
419
|
function resolveEnvTemplates(values, templateContext) {
|
|
381
420
|
return Object.fromEntries(
|
|
382
421
|
Object.entries(values || {}).map(([key, value]) => [
|
|
@@ -390,7 +429,7 @@ function omitRuntimeDatabaseBindings(values = {}) {
|
|
|
390
429
|
return Object.fromEntries(
|
|
391
430
|
Object.entries(values).filter(([_key, value]) => {
|
|
392
431
|
if (typeof value !== "string") return true;
|
|
393
|
-
return !/\{db(?:Url|Host|Port|Name|User|Password)(?::[
|
|
432
|
+
return !/\{(?:db(?:Url|Host|Port|Name|User|Password)(?::[^}]+)?|resource:[^}]+)\}/.test(value);
|
|
394
433
|
})
|
|
395
434
|
);
|
|
396
435
|
}
|
|
@@ -440,6 +479,32 @@ function resolveDatabaseTemplateValue(token, serviceName, context) {
|
|
|
440
479
|
}
|
|
441
480
|
}
|
|
442
481
|
|
|
482
|
+
function resolveResourceTemplateValue(resourceName, field, context) {
|
|
483
|
+
if (!resourceName) {
|
|
484
|
+
throw new Error("Resource placeholder requires a resource name");
|
|
485
|
+
}
|
|
486
|
+
const connections = context.resourceConnectionByName || {};
|
|
487
|
+
const resource = connections[resourceName];
|
|
488
|
+
if (!resource) {
|
|
489
|
+
throw new Error(`Unknown resource placeholder for resource "${resourceName}"`);
|
|
490
|
+
}
|
|
491
|
+
const value = resource[field];
|
|
492
|
+
if (value == null) {
|
|
493
|
+
throw new Error(`Unknown resource field "${field}" for resource "${resourceName}"`);
|
|
494
|
+
}
|
|
495
|
+
return String(value);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function parseResourceConnections(raw) {
|
|
499
|
+
if (!raw) return {};
|
|
500
|
+
try {
|
|
501
|
+
const parsed = JSON.parse(raw);
|
|
502
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
503
|
+
} catch {
|
|
504
|
+
return {};
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
443
508
|
export function rewriteUrlPort(rawUrl, port) {
|
|
444
509
|
try {
|
|
445
510
|
const original = new URL(rawUrl);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elench/testkit-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.138",
|
|
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.
|
|
25
|
+
"@elench/testkit-protocol": "0.1.138"
|
|
26
26
|
},
|
|
27
27
|
"private": false
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elench/testkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.138",
|
|
4
4
|
"description": "Assistant-first CLI for running, inspecting, and debugging local testkit suites",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -63,7 +63,9 @@
|
|
|
63
63
|
"test:audit": "node scripts/test-boundary-audit.mjs",
|
|
64
64
|
"test:compat:node20": "volta run --node 20.19.5 --npm 10.8.2 npm test",
|
|
65
65
|
"test:database-version:compat": "node scripts/test-database-version-compat.mjs",
|
|
66
|
+
"test:docker-version:compat": "node scripts/test-docker-version-compat.mjs",
|
|
66
67
|
"test:engine-version:compat": "node scripts/test-engine-version-compat.mjs",
|
|
68
|
+
"test:kiln-local": "node scripts/test-kiln-local-driver-fixture.mjs",
|
|
67
69
|
"test:live": "node scripts/live-sandbox/harness.mjs",
|
|
68
70
|
"test:live:github": "node scripts/test-live-github-fixture.mjs",
|
|
69
71
|
"test:live:local-prod-launcher": "node scripts/test-live-local-prod-launcher-fixture.mjs",
|
|
@@ -96,10 +98,10 @@
|
|
|
96
98
|
},
|
|
97
99
|
"dependencies": {
|
|
98
100
|
"@babel/code-frame": "^7.29.0",
|
|
99
|
-
"@elench/next-analysis": "0.1.
|
|
100
|
-
"@elench/testkit-bridge": "0.1.
|
|
101
|
-
"@elench/testkit-protocol": "0.1.
|
|
102
|
-
"@elench/ts-analysis": "0.1.
|
|
101
|
+
"@elench/next-analysis": "0.1.138",
|
|
102
|
+
"@elench/testkit-bridge": "0.1.138",
|
|
103
|
+
"@elench/testkit-protocol": "0.1.138",
|
|
104
|
+
"@elench/ts-analysis": "0.1.138",
|
|
103
105
|
"@oclif/core": "^4.10.6",
|
|
104
106
|
"@playwright/test": "^1.52.0",
|
|
105
107
|
"esbuild": "^0.25.11",
|
|
@@ -0,0 +1,188 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eA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