feat: runtime smoke test, gitea actions workflows, runtime-checks record
check / check (push) Successful in 49s
check / check (push) Successful in 49s
This commit is contained in:
1 parent
d301ef5a62
commit
c92fe4db73
15 files changed
+847
-137
No files matched your search
+16
-4
@@ -23,7 +23,10 @@ test("runInit copies agents, stamps version, targets project or global dir", ()
|
||||
assert.equal(project.target, path.join(cwd, ".opencode", "agents"))
|
||||
assert.deepEqual(project.copied, ["pocock-worker.md", "pocock.md"])
|
||||
assert.deepEqual(project.skipped, [])
|
||||
assert.equal(readFileSync(path.join(project.target, "pocock.md"), "utf8"), "---\nmode: primary\n---\nv1\n")
|
||||
assert.equal(
|
||||
readFileSync(path.join(project.target, "pocock.md"), "utf8"),
|
||||
"---\nmode: primary\n---\nv1\n",
|
||||
)
|
||||
assert.equal(readFileSync(path.join(project.target, ".pocock-version"), "utf8"), "9.9.9\n")
|
||||
|
||||
const global = runInit({ argv: ["init", "-g"], cwd, pkgRoot, home })
|
||||
@@ -41,7 +44,10 @@ test("runInit copies agents, stamps version, targets project or global dir", ()
|
||||
assert.deepEqual(forced.skipped, [])
|
||||
assert.match(readFileSync(path.join(project.target, "pocock.md"), "utf8"), /v1/)
|
||||
|
||||
assert.throws(() => runInit({ argv: ["init", "--wat"], cwd, pkgRoot, home }), /unknown argument --wat/)
|
||||
assert.throws(
|
||||
() => runInit({ argv: ["init", "--wat"], cwd, pkgRoot, home }),
|
||||
/unknown argument --wat/,
|
||||
)
|
||||
} finally {
|
||||
for (const dir of [pkgRoot, home, cwd]) rmSync(dir, { recursive: true, force: true })
|
||||
}
|
||||
@@ -49,14 +55,20 @@ test("runInit copies agents, stamps version, targets project or global dir", ()
|
||||
|
||||
test("agentsTarget resolves global vs project locations", () => {
|
||||
assert.equal(agentsTarget(false, "/repo", "/home/u"), path.join("/repo", ".opencode", "agents"))
|
||||
assert.equal(agentsTarget(true, "/repo", "/home/u"), path.join("/home/u", ".config", "opencode", "agents"))
|
||||
assert.equal(
|
||||
agentsTarget(true, "/repo", "/home/u"),
|
||||
path.join("/home/u", ".config", "opencode", "agents"),
|
||||
)
|
||||
})
|
||||
|
||||
test("runInit fails clearly when the package has no agents dir", () => {
|
||||
const empty = mkdtempSync(path.join(tmpdir(), "init-empty-"))
|
||||
try {
|
||||
writeFileSync(path.join(empty, "package.json"), "{}")
|
||||
assert.throws(() => runInit({ argv: ["init"], cwd: empty, pkgRoot: empty, home: empty }), /no agents\/ in package/)
|
||||
assert.throws(
|
||||
() => runInit({ argv: ["init"], cwd: empty, pkgRoot: empty, home: empty }),
|
||||
/no agents\/ in package/,
|
||||
)
|
||||
} finally {
|
||||
rmSync(empty, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user