@elench/testkit 0.1.82 → 0.1.83
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/README.md +37 -7
- package/lib/cli/agents/index.mjs +64 -0
- package/lib/cli/agents/investigate.mjs +75 -0
- package/lib/cli/agents/investigation-context.mjs +102 -0
- package/lib/cli/agents/investigation-context.test.mjs +144 -0
- package/lib/cli/agents/prompt-builder.mjs +25 -0
- package/lib/cli/agents/providers/claude.mjs +74 -0
- package/lib/cli/agents/providers/claude.test.mjs +95 -0
- package/lib/cli/agents/providers/codex.mjs +83 -0
- package/lib/cli/agents/providers/codex.test.mjs +93 -0
- package/lib/cli/agents/providers/shared.mjs +134 -0
- package/lib/cli/command-helpers.mjs +53 -25
- package/lib/cli/command-helpers.test.mjs +122 -0
- package/lib/cli/commands/investigate.mjs +87 -0
- package/lib/cli/commands/investigate.test.mjs +83 -0
- package/lib/cli/entrypoint.mjs +3 -0
- package/lib/cli/presentation/colors.mjs +12 -0
- package/lib/cli/presentation/events-reporter.mjs +135 -0
- package/lib/cli/presentation/events-reporter.test.mjs +73 -0
- package/lib/cli/presentation/summary-box.mjs +11 -11
- package/lib/cli/presentation/summary-box.test.mjs +17 -0
- package/lib/cli/presentation/tree-reporter.mjs +159 -0
- package/lib/cli/presentation/tree-reporter.test.mjs +166 -0
- package/lib/cli/tui/run-app.mjs +1 -0
- package/lib/cli/tui/run-session-app.mjs +370 -0
- package/lib/cli/tui/run-session-app.test.mjs +50 -0
- package/lib/cli/tui/run-session-state.mjs +481 -0
- package/lib/cli/tui/run-tree-state.mjs +1 -0
- package/lib/cli/tui/run-tree-state.test.mjs +324 -0
- package/lib/config-api/auth-fixtures.mjs +15 -10
- package/lib/config-api/index.test.mjs +54 -0
- package/lib/discovery/index.mjs +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/runner/orchestrator.mjs +1 -0
- package/lib/runtime/index.d.ts +138 -5
- package/lib/runtime/index.mjs +68 -2
- package/lib/runtime-src/k6/http-assertions.js +31 -1
- package/lib/runtime-src/k6/http-checks.js +120 -0
- package/lib/runtime-src/k6/http-checks.test.mjs +120 -0
- package/lib/runtime-src/k6/http-suite-runtime.js +5 -1
- package/lib/runtime-src/k6/http.js +213 -23
- package/lib/runtime-src/k6/http.test.mjs +205 -0
- package/lib/runtime-src/shared/error-body.mjs +42 -0
- package/lib/runtime-src/shared/http-parsing.mjs +68 -0
- package/lib/runtime-src/shared/http-parsing.test.mjs +69 -0
- 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 +5 -5
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
extractCookie,
|
|
4
|
+
getSseEventData,
|
|
5
|
+
parseJsonBody,
|
|
6
|
+
parseSseEvents,
|
|
7
|
+
} from "./http-parsing.mjs";
|
|
8
|
+
import {
|
|
9
|
+
deriveDeterministicIp,
|
|
10
|
+
extractErrorMessageFromBody,
|
|
11
|
+
hasStandardErrorShape,
|
|
12
|
+
} from "./error-body.mjs";
|
|
13
|
+
|
|
14
|
+
describe("runtime shared parsing", () => {
|
|
15
|
+
it("extracts cookies from set-cookie headers", () => {
|
|
16
|
+
const response = {
|
|
17
|
+
headers: {
|
|
18
|
+
"set-cookie": [
|
|
19
|
+
"fixture_session=jwt-primary; Path=/",
|
|
20
|
+
"fixture_refresh=refresh-primary; Path=/",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
expect(extractCookie(response, "fixture_session")).toBe("jwt-primary");
|
|
26
|
+
expect(extractCookie(response, "fixture_refresh")).toBe("refresh-primary");
|
|
27
|
+
expect(extractCookie(response, "missing")).toBeNull();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("parses JSON response bodies", () => {
|
|
31
|
+
expect(parseJsonBody({ body: "{\"ok\":true}" })).toEqual({ ok: true });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("parses SSE events and extracts typed event data", () => {
|
|
35
|
+
const body = [
|
|
36
|
+
"event: progress",
|
|
37
|
+
"data: {\"step\":1}",
|
|
38
|
+
"",
|
|
39
|
+
"event: complete",
|
|
40
|
+
"data: {\"success\":true}",
|
|
41
|
+
"",
|
|
42
|
+
].join("\n");
|
|
43
|
+
|
|
44
|
+
expect(parseSseEvents(body)).toEqual([
|
|
45
|
+
{ event: "progress", data: { step: 1 } },
|
|
46
|
+
{ event: "complete", data: { success: true } },
|
|
47
|
+
]);
|
|
48
|
+
expect(getSseEventData(body, "complete")).toEqual({ success: true });
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("runtime shared error helpers", () => {
|
|
53
|
+
it("extracts human-readable error messages", () => {
|
|
54
|
+
expect(extractErrorMessageFromBody({ error: "bad request" })).toBe("bad request");
|
|
55
|
+
expect(extractErrorMessageFromBody({ error: { message: "nested" } })).toBe("nested");
|
|
56
|
+
expect(extractErrorMessageFromBody({ message: "top-level" })).toBe("top-level");
|
|
57
|
+
expect(extractErrorMessageFromBody({ ok: true })).toBeNull();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("detects the standard structured error shape", () => {
|
|
61
|
+
expect(hasStandardErrorShape({ error: { code: "BAD", message: "boom" } })).toBe(true);
|
|
62
|
+
expect(hasStandardErrorShape({ error: { message: "boom" } })).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("derives deterministic test-network IPs", () => {
|
|
66
|
+
expect(deriveDeterministicIp("bourne", 1)).toBe(deriveDeterministicIp("bourne", 1));
|
|
67
|
+
expect(deriveDeterministicIp("bourne", 1)).not.toBe(deriveDeterministicIp("bourne", 2));
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elench/testkit-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.83",
|
|
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.83"
|
|
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.83",
|
|
4
4
|
"description": "CLI for discovering and running local HTTP, DAL, and Playwright test suites",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@babel/code-frame": "^7.29.0",
|
|
84
|
-
"@elench/next-analysis": "0.1.
|
|
85
|
-
"@elench/testkit-bridge": "0.1.
|
|
86
|
-
"@elench/testkit-protocol": "0.1.
|
|
87
|
-
"@elench/ts-analysis": "0.1.
|
|
84
|
+
"@elench/next-analysis": "0.1.83",
|
|
85
|
+
"@elench/testkit-bridge": "0.1.83",
|
|
86
|
+
"@elench/testkit-protocol": "0.1.83",
|
|
87
|
+
"@elench/ts-analysis": "0.1.83",
|
|
88
88
|
"@oclif/core": "^4.10.6",
|
|
89
89
|
"esbuild": "^0.25.11",
|
|
90
90
|
"execa": "^9.5.0",
|