@elench/testkit 0.1.82 → 0.1.84

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 (100) hide show
  1. package/README.md +37 -7
  2. package/lib/cli/agents/index.mjs +64 -0
  3. package/lib/cli/agents/investigate.mjs +75 -0
  4. package/lib/cli/agents/investigation-context.mjs +102 -0
  5. package/lib/cli/agents/prompt-builder.mjs +25 -0
  6. package/lib/cli/agents/providers/claude.mjs +74 -0
  7. package/lib/cli/agents/providers/codex.mjs +83 -0
  8. package/lib/cli/agents/providers/shared.mjs +134 -0
  9. package/lib/cli/command-helpers.mjs +53 -25
  10. package/lib/cli/commands/investigate.mjs +87 -0
  11. package/lib/cli/entrypoint.mjs +3 -0
  12. package/lib/cli/presentation/colors.mjs +12 -0
  13. package/lib/cli/presentation/events-reporter.mjs +135 -0
  14. package/lib/cli/presentation/summary-box.mjs +11 -11
  15. package/lib/cli/presentation/tree-reporter.mjs +159 -0
  16. package/lib/cli/tui/run-app.mjs +1 -0
  17. package/lib/cli/tui/run-session-app.mjs +370 -0
  18. package/lib/cli/tui/run-session-state.mjs +481 -0
  19. package/lib/cli/tui/run-tree-state.mjs +1 -0
  20. package/lib/config-api/auth-fixtures.mjs +15 -10
  21. package/lib/discovery/index.mjs +1 -1
  22. package/lib/index.d.ts +5 -1
  23. package/lib/runner/orchestrator.mjs +1 -0
  24. package/lib/runtime/index.d.ts +138 -5
  25. package/lib/runtime/index.mjs +68 -2
  26. package/lib/runtime-src/k6/http-assertions.js +31 -1
  27. package/lib/runtime-src/k6/http-checks.js +120 -0
  28. package/lib/runtime-src/k6/http-suite-runtime.js +5 -1
  29. package/lib/runtime-src/k6/http.js +213 -23
  30. package/lib/runtime-src/shared/error-body.mjs +42 -0
  31. package/lib/runtime-src/shared/http-parsing.mjs +68 -0
  32. package/node_modules/@elench/next-analysis/package.json +1 -1
  33. package/node_modules/@elench/testkit-bridge/package.json +2 -2
  34. package/node_modules/@elench/testkit-protocol/package.json +1 -1
  35. package/node_modules/@elench/ts-analysis/package.json +1 -1
  36. package/package.json +7 -6
  37. package/lib/app/configs.test.mjs +0 -34
  38. package/lib/app/typecheck.test.mjs +0 -24
  39. package/lib/bundler/index.test.mjs +0 -164
  40. package/lib/cli/args.test.mjs +0 -110
  41. package/lib/cli/presentation/code-frames.test.mjs +0 -71
  42. package/lib/cli/presentation/run-reporter.test.mjs +0 -192
  43. package/lib/cli/presentation/summary-box.test.mjs +0 -43
  44. package/lib/cli/presentation/terminal-layout.test.mjs +0 -23
  45. package/lib/config/database.test.mjs +0 -29
  46. package/lib/config/discovery.test.mjs +0 -276
  47. package/lib/config/env.test.mjs +0 -40
  48. package/lib/config/index.test.mjs +0 -44
  49. package/lib/config/paths.test.mjs +0 -27
  50. package/lib/config/runtime.test.mjs +0 -82
  51. package/lib/config/skip-config.test.mjs +0 -63
  52. package/lib/config-api/index.test.mjs +0 -344
  53. package/lib/config-api/next-runtime-tsconfig.test.mjs +0 -58
  54. package/lib/coverage/backend-discovery.test.mjs +0 -61
  55. package/lib/coverage/evidence.test.mjs +0 -87
  56. package/lib/coverage/index.test.mjs +0 -715
  57. package/lib/coverage/routing.test.mjs +0 -36
  58. package/lib/coverage/shared.test.mjs +0 -72
  59. package/lib/database/fingerprint.test.mjs +0 -99
  60. package/lib/database/index.test.mjs +0 -95
  61. package/lib/database/naming.test.mjs +0 -39
  62. package/lib/database/state.test.mjs +0 -66
  63. package/lib/database/template-steps.test.mjs +0 -43
  64. package/lib/discovery/file-metadata.test.mjs +0 -51
  65. package/lib/discovery/index.test.mjs +0 -182
  66. package/lib/discovery/path-policy.test.mjs +0 -65
  67. package/lib/drizzle/index.test.mjs +0 -33
  68. package/lib/env/index.test.mjs +0 -82
  69. package/lib/history/index.test.mjs +0 -115
  70. package/lib/package.test.mjs +0 -59
  71. package/lib/playwright/index.test.mjs +0 -43
  72. package/lib/regressions/github.test.mjs +0 -324
  73. package/lib/regressions/index.test.mjs +0 -187
  74. package/lib/reporters/playwright.test.mjs +0 -167
  75. package/lib/runner/default-runtime-errors.test.mjs +0 -49
  76. package/lib/runner/execution-config.test.mjs +0 -67
  77. package/lib/runner/failure-details.test.mjs +0 -114
  78. package/lib/runner/formatting.test.mjs +0 -205
  79. package/lib/runner/metadata.test.mjs +0 -52
  80. package/lib/runner/planning.test.mjs +0 -371
  81. package/lib/runner/playwright-config.test.mjs +0 -78
  82. package/lib/runner/processes.test.mjs +0 -21
  83. package/lib/runner/regressions.test.mjs +0 -168
  84. package/lib/runner/reporting.test.mjs +0 -310
  85. package/lib/runner/results.test.mjs +0 -376
  86. package/lib/runner/runtime-manager.test.mjs +0 -252
  87. package/lib/runner/runtime-preparation.test.mjs +0 -141
  88. package/lib/runner/selection.test.mjs +0 -24
  89. package/lib/runner/setup-operations.test.mjs +0 -94
  90. package/lib/runner/state.test.mjs +0 -62
  91. package/lib/runner/suite-selection.test.mjs +0 -49
  92. package/lib/runner/template.test.mjs +0 -272
  93. package/lib/shared/build-config.test.mjs +0 -132
  94. package/lib/shared/configured-steps.test.mjs +0 -102
  95. package/lib/shared/execution-schema.test.mjs +0 -26
  96. package/lib/shared/file-timeout.test.mjs +0 -64
  97. package/lib/shared/test-context.test.mjs +0 -43
  98. package/lib/timing/index.test.mjs +0 -64
  99. package/lib/toolchains/index.test.mjs +0 -168
  100. package/lib/vitest/index.test.mjs +0 -20
@@ -1,168 +0,0 @@
1
- import fs from "fs";
2
- import os from "os";
3
- import path from "path";
4
- import { execa } from "execa";
5
- import { afterEach, describe, expect, it } from "vitest";
6
- import {
7
- applyToolchainEnv,
8
- normalizeRuntimeToolchain,
9
- normalizeToolchainRegistry,
10
- resolveConfiguredToolchain,
11
- } from "./index.mjs";
12
-
13
- const tempDirs = [];
14
-
15
- afterEach(() => {
16
- while (tempDirs.length > 0) {
17
- fs.rmSync(tempDirs.pop(), { recursive: true, force: true });
18
- }
19
- });
20
-
21
- function makeTempDir(prefix) {
22
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
23
- tempDirs.push(dir);
24
- return dir;
25
- }
26
-
27
- function writeJson(filePath, value) {
28
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
29
- fs.writeFileSync(filePath, JSON.stringify(value, null, 2));
30
- }
31
-
32
- describe("toolchains", () => {
33
- it("normalizes named toolchain profiles and runtime references", () => {
34
- const registry = normalizeToolchainRegistry({
35
- frontend: {
36
- cwd: "frontend",
37
- install: "download",
38
- node: "20.19.5",
39
- },
40
- });
41
-
42
- expect(normalizeRuntimeToolchain("frontend", "Service \"web\" runtime.toolchain", registry)).toEqual(
43
- expect.objectContaining({
44
- kind: "node",
45
- cwd: "frontend",
46
- install: "download",
47
- node: "20.19.5",
48
- refName: "frontend",
49
- })
50
- );
51
- });
52
-
53
- it("fails clearly when host versions do not satisfy a require-host toolchain", async () => {
54
- const productDir = makeTempDir("testkit-toolchain-host-");
55
- writeJson(path.join(productDir, "package.json"), {
56
- name: "toolchain-host-product",
57
- engines: {
58
- node: ">=20.19.5 <21",
59
- npm: ">=10.8.2 <11",
60
- },
61
- });
62
-
63
- const config = {
64
- name: "frontend",
65
- productDir,
66
- testkit: {
67
- runtime: {
68
- toolchain: {
69
- kind: "node",
70
- cwd: ".",
71
- detect: "auto",
72
- install: "require-host",
73
- },
74
- },
75
- },
76
- };
77
-
78
- await expect(
79
- resolveConfiguredToolchain(config, {
80
- hostNodeVersion: "18.19.0",
81
- hostNpmVersion: "10.8.2",
82
- })
83
- ).rejects.toThrow("requires Node >=20.19.5 <21");
84
- });
85
-
86
- it("provisions a downloaded Node toolchain from a deterministic range minimum", async () => {
87
- const productDir = makeTempDir("testkit-toolchain-download-");
88
- writeJson(path.join(productDir, "package.json"), {
89
- name: "toolchain-download-product",
90
- engines: {
91
- node: ">=20.19.5 <21",
92
- npm: ">=10.8.2 <11",
93
- },
94
- });
95
-
96
- const archiveBuffer = await buildFakeNodeArchive();
97
- const config = {
98
- name: "frontend",
99
- productDir,
100
- testkit: {
101
- runtime: {
102
- toolchain: {
103
- kind: "node",
104
- cwd: ".",
105
- detect: "auto",
106
- install: "download",
107
- },
108
- },
109
- },
110
- };
111
-
112
- const resolved = await resolveConfiguredToolchain(config, {
113
- fetchImpl: async () => ({
114
- ok: true,
115
- status: 200,
116
- arrayBuffer: async () => archiveBuffer,
117
- }),
118
- });
119
-
120
- expect(resolved).toMatchObject({
121
- kind: "node",
122
- install: "download",
123
- nodeVersion: "20.19.5",
124
- npmVersion: "10.8.2",
125
- nodeSource: "package.json#engines.node",
126
- npmSource: "package.json#engines.npm",
127
- });
128
- expect(fs.existsSync(resolved.nodeExecutable)).toBe(true);
129
- expect(applyToolchainEnv({ PATH: "/usr/bin" }, resolved).PATH).toContain(
130
- path.dirname(resolved.nodeExecutable)
131
- );
132
- });
133
- });
134
-
135
- async function buildFakeNodeArchive() {
136
- const root = makeTempDir("testkit-node-archive-root-");
137
- const platform = process.platform === "darwin" ? "darwin" : process.platform;
138
- const arch = process.arch;
139
- const bundleDir = path.join(root, `node-v20.19.5-${platform}-${arch}`);
140
- const binDir = path.join(bundleDir, "bin");
141
- fs.mkdirSync(binDir, { recursive: true });
142
-
143
- fs.writeFileSync(
144
- path.join(binDir, "node"),
145
- [
146
- "#!/usr/bin/env bash",
147
- 'if [[ \"$1\" == *\"template-step-module-runner.mjs\" ]]; then',
148
- " shift",
149
- " exec node \"$@\"",
150
- "fi",
151
- 'if [[ \"$1\" == *\"npm-cli.js\" ]]; then',
152
- " shift",
153
- " exec node \"$@\"",
154
- "fi",
155
- "exec node \"$@\"",
156
- ].join("\n"),
157
- { mode: 0o755 }
158
- );
159
- fs.writeFileSync(
160
- path.join(binDir, "npm"),
161
- ['#!/usr/bin/env bash', 'echo "10.8.2"'].join("\n"),
162
- { mode: 0o755 }
163
- );
164
-
165
- const archivePath = path.join(root, "node-v20.19.5-linux-x64.tar.gz");
166
- await execa("tar", ["-czf", archivePath, "-C", root, path.basename(bundleDir)]);
167
- return fs.readFileSync(archivePath);
168
- }
@@ -1,20 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { defineConfig, testkitExcludes } from "./index.mjs";
3
-
4
- describe("testkit vitest defineConfig", () => {
5
- it("appends testkit suite excludes", () => {
6
- const config = defineConfig({
7
- test: {
8
- exclude: ["dist"],
9
- },
10
- });
11
-
12
- expect(config.test.exclude).toEqual(
13
- expect.arrayContaining(["dist", "**/*.int.testkit.ts", "**/*.pw.testkit.ts"])
14
- );
15
- });
16
-
17
- it("exports the default testkit excludes", () => {
18
- expect(testkitExcludes()).toContain("**/*.scenario.testkit.ts");
19
- });
20
- });