test(manifest): read README at test time; tighten npm pack assertions; fix ellipsis in tool description
This commit is contained in:
3
index.ts
3
index.ts
@@ -336,7 +336,8 @@ export default function question(pi: ExtensionAPI) {
|
|||||||
name: "question",
|
name: "question",
|
||||||
label: "Question",
|
label: "Question",
|
||||||
description:
|
description:
|
||||||
"Ask the user one or more multiple-choice questions. Every question automatically gets a final Something else… option for free-text answers.",
|
"Ask the user one or more multiple-choice questions. Every question automatically gets a final Something else... option for free-text answers.",
|
||||||
|
|
||||||
parameters: QuestionParams,
|
parameters: QuestionParams,
|
||||||
|
|
||||||
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
|
|||||||
|
|
||||||
const packageRoot = dirname(fileURLToPath(import.meta.url));
|
const packageRoot = dirname(fileURLToPath(import.meta.url));
|
||||||
const pkg = JSON.parse(readFileSync(resolve(packageRoot, "package.json"), "utf8"));
|
const pkg = JSON.parse(readFileSync(resolve(packageRoot, "package.json"), "utf8"));
|
||||||
const readme = readFileSync(resolve(packageRoot, "README.md"), "utf8");
|
|
||||||
|
|
||||||
function getPackedPaths() {
|
function getPackedPaths() {
|
||||||
const output = execFileSync("npm", ["pack", "--dry-run", "--json"], {
|
const output = execFileSync("npm", ["pack", "--dry-run", "--json"], {
|
||||||
@@ -49,6 +49,7 @@ test("package.json exposes pi-question as a standalone pi package", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("README documents local and git installation", () => {
|
test("README documents local and git installation", () => {
|
||||||
|
const readme = readFileSync(resolve(packageRoot, "README.md"), "utf8");
|
||||||
assert.match(readme, /pi install \/absolute\/path\/to\/question/);
|
assert.match(readme, /pi install \/absolute\/path\/to\/question/);
|
||||||
assert.match(readme, /pi install https:\/\/gitea\.rwiesner\.com\/pi\/pi-question/);
|
assert.match(readme, /pi install https:\/\/gitea\.rwiesner\.com\/pi\/pi-question/);
|
||||||
});
|
});
|
||||||
@@ -56,8 +57,7 @@ test("README documents local and git installation", () => {
|
|||||||
test("npm pack includes runtime package assets", () => {
|
test("npm pack includes runtime package assets", () => {
|
||||||
const packedPaths = getPackedPaths();
|
const packedPaths = getPackedPaths();
|
||||||
|
|
||||||
assert.ok(packedPaths.includes("README.md"));
|
|
||||||
assert.ok(packedPaths.includes("package.json"));
|
|
||||||
assert.ok(packedPaths.includes("index.ts"));
|
assert.ok(packedPaths.includes("index.ts"));
|
||||||
assert.ok(packedPaths.includes("question-core.mjs"));
|
assert.ok(packedPaths.includes("question-core.mjs"));
|
||||||
|
assert.deepEqual(packedPaths.filter((p) => p.endsWith('.test.mjs')), []);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user