@testdriverai/mcp 7.11.223-test → 7.11.225-test
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/blog-demos/replay-info.mjs +55 -0
- package/docs/agent.mdx +2 -0
- package/package.json +1 -1
- package/vitest.blog.config.mjs +41 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Prints the replay links for a blog demo run, as JSON.
|
|
3
|
+
//
|
|
4
|
+
// Usage (from sdk/, after running the demo):
|
|
5
|
+
// node blog-demos/replay-info.mjs test-tauri-app
|
|
6
|
+
//
|
|
7
|
+
// Reads the result files the TestDriver vitest plugin writes to
|
|
8
|
+
// .testdriver/results/blog-demos/<slug>.test.mjs/*.json and picks the newest passing one.
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
|
|
12
|
+
const slug = process.argv[2];
|
|
13
|
+
if (!slug) {
|
|
14
|
+
console.error("Usage: node blog-demos/replay-info.mjs <slug>");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const dir = path.join(process.cwd(), ".testdriver", "results", "blog-demos", `${slug}.test.mjs`);
|
|
19
|
+
if (!fs.existsSync(dir)) {
|
|
20
|
+
console.error(`No results found in ${dir}. Run the demo first.`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const results = fs
|
|
25
|
+
.readdirSync(dir)
|
|
26
|
+
.filter((f) => f.endsWith(".json"))
|
|
27
|
+
.map((f) => {
|
|
28
|
+
const file = path.join(dir, f);
|
|
29
|
+
return { file, mtime: fs.statSync(file).mtimeMs, data: JSON.parse(fs.readFileSync(file, "utf-8")) };
|
|
30
|
+
})
|
|
31
|
+
.sort((a, b) => b.mtime - a.mtime);
|
|
32
|
+
|
|
33
|
+
const passed = results.find((r) => r.data.test?.passed === true) || null;
|
|
34
|
+
const pick = passed || results[0];
|
|
35
|
+
if (!pick) {
|
|
36
|
+
console.error(`No result files in ${dir}.`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const d = pick.data;
|
|
41
|
+
console.log(
|
|
42
|
+
JSON.stringify(
|
|
43
|
+
{
|
|
44
|
+
passed: Boolean(passed),
|
|
45
|
+
error: d.test?.error || null,
|
|
46
|
+
replayUrl: d.replay?.url || d.replayUrl || null,
|
|
47
|
+
embedUrl: d.replay?.embedUrl || null,
|
|
48
|
+
gifUrl: d.replay?.gifUrl || null,
|
|
49
|
+
testRunUrl: d.urls?.testRun || d.testRunLink || null,
|
|
50
|
+
resultFile: pick.file,
|
|
51
|
+
},
|
|
52
|
+
null,
|
|
53
|
+
2,
|
|
54
|
+
),
|
|
55
|
+
);
|
package/docs/agent.mdx
CHANGED
|
@@ -98,3 +98,5 @@ which requires the installation to be signed in. Sign-in state doesn't decide
|
|
|
98
98
|
*whether* the agent reviews — it decides *how good* the review gets. A signed-out
|
|
99
99
|
install still gets its bugs caught from reading the code; signing in upgrades
|
|
100
100
|
findings from `suspected` to `observed`.
|
|
101
|
+
|
|
102
|
+
test
|
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Runs the blog demo tests in blog-demos/ only.
|
|
2
|
+
// They live outside examples/ so the CI jobs that run every example don't pick them up.
|
|
3
|
+
//
|
|
4
|
+
// Usage (from sdk/):
|
|
5
|
+
// TD_CHANNEL=stable npx vitest run --config vitest.blog.config.mjs --project stable blog-demos/<slug>.test.mjs
|
|
6
|
+
//
|
|
7
|
+
// API key: the base config always uses the test-account key from shared/fixtures.
|
|
8
|
+
// To run with a different key (e.g. a team key for public stable replays), set
|
|
9
|
+
// TD_BLOG_API_KEY in the environment or put `TD_BLOG_API_KEY=...` in ~/.testdriver/blog.env.
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import os from "node:os";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import base from "./vitest.config.mjs";
|
|
14
|
+
|
|
15
|
+
function readBlogKey() {
|
|
16
|
+
if (process.env.TD_BLOG_API_KEY) return process.env.TD_BLOG_API_KEY;
|
|
17
|
+
const file = path.join(os.homedir(), ".testdriver", "blog.env");
|
|
18
|
+
if (!fs.existsSync(file)) return null;
|
|
19
|
+
const line = fs
|
|
20
|
+
.readFileSync(file, "utf-8")
|
|
21
|
+
.split("\n")
|
|
22
|
+
.find((l) => l.trim().startsWith("TD_BLOG_API_KEY="));
|
|
23
|
+
return line ? line.split("=").slice(1).join("=").trim().replace(/^["']|["']$/g, "") : null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const blogKey = readBlogKey();
|
|
27
|
+
const withKey = (env) => (blogKey ? { ...env, TD_API_KEY: blogKey } : env);
|
|
28
|
+
if (blogKey) process.env.TD_API_KEY = blogKey;
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
...base,
|
|
32
|
+
test: {
|
|
33
|
+
...base.test,
|
|
34
|
+
include: ["blog-demos/**/*.test.mjs"],
|
|
35
|
+
env: withKey(base.test.env),
|
|
36
|
+
projects: base.test.projects.map((p) => ({
|
|
37
|
+
...p,
|
|
38
|
+
test: { ...p.test, env: withKey(p.test.env) },
|
|
39
|
+
})),
|
|
40
|
+
},
|
|
41
|
+
};
|