principle-test-behavior-not-implementation: listed matchers do not all pass when imports return undefined
维护者通常 1 天内回复
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 88/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
调研方向
从 pstack/skills/principle-test-behavior-not-implementation/SKILL.md 开始,尤其查看第 15-18 行,并将列出的每个 matcher 与 issue 中展示的未定义行为进行比较。更新说明或分组,使关于未定义行为的说法仅适用于实际通过的 matcher,同时准确描述较弱但非空洞的断言。
由索引模型根据 Issue 内容生成。
描述
Observed at commit 2eb7ed4613cfc8f098dfe464a23680ea44d84c5e: pstack/skills/principle-test-behavior-not-implementation/SKILL.md lines 15-18.
The skill's check is "would the test still pass if every function it imports returned undefined?" and it lists, as "Five shapes that still pass when every imported function returns undefined", assertions such as:
toBeDefined,toBeTruthy,toBeInstanceOf,toBeGreaterThan(0)toEqual([]),toHaveLength(0)
Problem
Several of these do not pass when the value is undefined:
expect(undefined).toBeDefined() // fails
expect(undefined).toBeTruthy() // fails
expect(undefined).toBeInstanceOf(Foo) // fails
expect(undefined).toBeGreaterThan(0) // throws (received value must be a number)
expect(undefined).toEqual([]) // fails
expect(undefined).toHaveLength(0) // throws (received value must have a length property)
They are weak assertions, but the stated reason ("still passes when every import returns undefined") is false for them, which can lead an agent following the rule to delete tests that do fail when the function breaks, or to distrust the check. (not.toThrow, toBeUndefined, not.toHaveBeenCalled and a missing expect do pass.)
Suggested fix
Describe the principle by what the test can detect rather than by matcher name: ask whether the assertion would still pass if the function returned a wrong but plausible value (an empty array, true, a different object). Either remove the matchers that fail on undefined from the list, or move them to a separate "weak but not vacuous" group with the accurate explanation, and keep the undefined claim only for the matchers that truly pass.
- 主要语言
- TypeScript
- 星标
- 9.7k
- 派生
- 919
- 平均合并
- 14 小时 37 分钟
- 30 天内合并 PR
- 66
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cursor/plugins 的其他 Issue
-
pstack: Comment Sicko agent name has a space and Grok rejects the spawn可能已有人在做 @lab1207 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
create-plugin README documents a /create-plugin command that does not exist可能已有人在做 @lab1207 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
cursor-sdk auth.md: non-null assertion described as a runtime missing-variable check可能已有人在做 @lab1207 于 3 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
watch-pr: review threads are fetched without pagination (first 100 only)可能已有人在做 @Yi-111-a 于 3 天前认领。 未关闭
难度 2/5 半天 新手友好度 84/100
维护者通常 1 天内回复
-
check-agent-compatibility: SKILL.md description has an unquoted colon, YAML parse fails可能已有人在做 @rufushsu9987 于 17 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 95/100
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100
solana-foundation/solana-com#2245 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
`document.cookie` with `max-age=0` does not delete the cookie可能已有人在做 @BartInTheField 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
capricorn86/happy-dom#2460 ·
维护者通常 2 天内回复