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
- 星號
- 13.9k
- 分支
- 1.4k
- 平均合併
- 7 小時 2 分鐘
- 30 天內合併 PR
- 153
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
cursor/plugins 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 80/100
維護者通常 1 天內回覆
-
statechart: a relative TLA2TOOLS or JAVA path fails, because TLC runs in the snapshot folder可能已有人在做 @Ehsan-hash 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1 小時以內 新手友好度 80/100
nuxt-content/nuxt-studio#599 ·
維護者通常 1 天內回覆
-
Orchestrator error text still cuts at a locationless 'at async' or 'at new' message line可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug
難度 2/5 1-3 小時 新手友好度 79/100
hurttlocker/o8#4997 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
danielmiessler/LifeOS#2413 ·
維護者通常 3 天內回覆
-
Plugin: sheet music can't be scrolled by hand before playback可能已有人在做 @snakajima 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
receptron/jinglescript#51 ·
維護者通常 1 天內回覆