Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

principle-test-behavior-not-implementation: listed matchers do not all pass when imports return undefined

Aberta Para iniciantes
#474 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@Yi-111-a já está trabalhando nisso.

Desde 1/10/2026.

  • #476 de @Yi-111-a — aberto
  • #487 de @lab1207 — aberto

Avaliação

Dificuldade
1/5
Tempo estimado
Menos de uma hora
Facilidade para iniciantes
88/100
Tipo de issue
Documentação
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
javascript
Domínio
documentation

Direção de pesquisa

Comece por pstack/skills/principle-test-behavior-not-implementation/SKILL.md, especialmente pelas linhas 15-18, e compare cada matcher listado com o comportamento indefinido mostrado na issue. Atualize a explicação ou o agrupamento para que a afirmação de comportamento indefinido se aplique somente aos matcher que de fato passam, enquanto as asserções fracas, mas não vacuosas, sejam descritas com precisão.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
12.5k
Forks
1.2k
Merge médio
12h 32min
PRs com merge (30d)
115

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de cursor/plugins

Todas as issues de cursor/plugins

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.