vitest plugin: test options that do not fit plugin.json userConfig are accepted, the engine refuses them at load
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
Hướng nghiên cứu
Start by reading the vitest plugin implementation and the claude-tests/len.test.ts reproduction described in the issue. Trace how test options reach the mod and how plugin.json userConfig is read; compare validation behavior with claude plugin test. Done when mismatched types and declared bounds fail with the engine's stated error. Pull request #218 is already open.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
The vitest plugin passes the options of a test to the mod as given. The engine validates them against the plugin's userConfig (type, bounds) when it loads the module and refuses a mismatch. A test with an option of the wrong type ("10" for a number option) runs the mod with that string under vitest and is a load error under claude plugin test.
Versions
@kwitsch/vitest-plugin-claude-code-mod0.18.0- Claude Code 2.1.336 (
claude plugin test) - vitest 5.1.2, Node 26.14.0, Linux (WSL2)
Minimal reproduction
Plugin repro-len (package.json: { "name": "repro-len", "version": "0.0.1", "type": "module" }; plugin/hooks/hooks.json: { "modules": ["./register.js"] }; plugin/.claude-plugin/plugin.json: { "name": "repro-len", "version": "0.0.1", "description": "repro", "userConfig": { "limit": { "type": "number", "title": "Limit", "description": "A limit", "default": 5 } } }). src/register.js is copied to plugin/hooks/register.js:
export const register = (on, options) => {
on("session.start", async ($, e, next) => {
const v = await $.env.get("REPRO_VAR");
await $.ui.toast(`${v} ${typeof options?.limit}`);
return next(e);
});
};
vitest.config.ts: plugins: [claudeCodeMod({ mod: "./src/register.js", portable: "error" })]. The test file is claude-tests/len.test.ts; vitest runs it with vitest run, the engine with claude plugin test <copy of plugin/ with the test in test/>.
import { expect, test } from "claude-code/testing";
const START = { source: "startup", cwd: "/proj", surface: "terminal", isInteractive: true };
test("2: option of a type userConfig does not declare", { options: { limit: "10" } }, async ($, on) => {
const toasts: string[] = [];
on("env.get", () => ({ value: "a" }));
on("ui.toast", (_$, e) => (toasts.push(String(e.text)), { value: undefined }));
on("session.start", () => ({ cwd: "/proj" }));
await $.session.start(START);
expect(toasts).toEqual(["a number"]);
});
vitest: the mod runs with the string; the test fails only on its own assertion:
AssertionError: expected [ 'a string' ] to deeply equal [ 'a number' ]
claude plugin test:
(fail) 2: option of a type userConfig does not declare [14.42ms]
HooksError: repro-len: hooks module did not load: options do not fit plugin.json userConfig: Limit must be a number (settings.json pluginConfigs["tmp.Y3wSe0kFWm@claude-plugin-test"].options)
Expected
The vitest plugin checks a test's options against the userConfig of the plugin's plugin.json (type, and bounds if declared) and fails with the engine's text (options do not fit plugin.json userConfig: <Title> must be a <type>), so a test cannot feed the mod a value Claude Code never delivers.
Relations
- Part of #41 (migration of kwitsch/claude-plugins-development), same family as #33 (the kit accepts what the engine rejects). Found by the jev-api migration, kwitsch/claude-plugins-development#195: its tests had to be rewritten to the engine-valid form, which then passes under both runners.
- Ngôn ngữ chính
- TypeScript
- Star
- 0
- Fork
- 0
- Merge trung bình
- 29 phút
- Pull request đã merge (30 ngày)
- 138
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của kwitsch/claude-code-plugin-tooling
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
kwitsch/claude-code-plugin-tooling#210 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
kwitsch/claude-code-plugin-tooling#212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
kwitsch/claude-code-plugin-tooling#209 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
kwitsch/claude-code-plugin-tooling#208 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của kwitsch/claude-code-plugin-tooling
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
makecindy/cindy#15342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
no-repo-link tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Priyanshu-byte-coder/devtrack#4067 ·
Maintainer thường phản hồi trong vòng 1 ngày