@skill-test/vitest 0.3.0 → 0.5.0
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 +25 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,6 +29,31 @@ import { skillTest } from "@skill-test/vitest";
|
|
|
29
29
|
skillTest("greeter confirms the appointment", "cases/greet.yaml");
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
## Assert on tool use, and stream
|
|
33
|
+
|
|
34
|
+
The SDK's tool-event and streaming surfaces are re-exported too. `toolCalls`
|
|
35
|
+
returns the normalized `tool_call` events a run took (each a `ToolEvent` with
|
|
36
|
+
`kind`/`name`/`input`/`output`/`index`), and `streamSkill` yields them live so a
|
|
37
|
+
test can **short-circuit** on bad behavior:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { it, expect } from "vitest";
|
|
41
|
+
import { runSkill, toolCalls, streamSkill } from "@skill-test/vitest";
|
|
42
|
+
|
|
43
|
+
it("commits without deleting", async () => {
|
|
44
|
+
const report = await runSkill("cases/edit.skilltest.yaml");
|
|
45
|
+
const calls = toolCalls(report.runs[0]!.transcript);
|
|
46
|
+
expect(calls.some((c) => String(c.input?.command).includes("git commit"))).toBe(true);
|
|
47
|
+
expect(calls.some((c) => String(c.input?.command).includes("rm -rf"))).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("makes no network call", async () => {
|
|
51
|
+
for await (const ev of streamSkill("cases/edit.skilltest.yaml")) {
|
|
52
|
+
expect(ev.event.name).not.toBe("curl"); // break to abort early
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
32
57
|
## Recommended: auto-discover a tree of cases
|
|
33
58
|
|
|
34
59
|
When vitest is your primary test runner, keep your cases as data and let one
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skill-test/vitest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "vitest integration for skilltest: register AI-skill test cases as vitest tests, built on @skill-test/sdk.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@skill-test/sdk": "0.
|
|
31
|
+
"@skill-test/sdk": "0.5.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"vitest": ">=1.0.0"
|