unit-test-quality: "dependencies found but no mocking" flags every test that imports the module under test
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- devtools, testing-qa
Direzione di ricerca
Start with test-coverage-analyzer-configuration.ts:101-106 and test-coverage-analyzer-validation-patterns.ts:105-116, then inspect the unit test quality rules and Jest configuration. Reproduce the listed false positives and check how the rules handle external boundaries, mock cleanup flags, parameterized tests, edge-case indicators, and setTimeout. Done means the reported false positives are addressed while the listed real debt remains detectable.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Found in the 8.0.0 self-audit triage: RoC 7.29.1 (npm, 5fc54afe) on a clean clone of develop at 2d2fa9a, with typescript resolvable (verdict compliance, 0 failed / 46 warnings). The bucket method and per-law tables are kept by QA; counts are from that run.
What happens
486 of 661 Unit Test Quality findings are "Dependencies found but no mocking detected". Any import … from is a "dependency" (test-coverage-analyzer-configuration.ts:101-106, IMPORT_STATEMENT: /import\s+.*from/), and the rule fires when no mock/spy/stub word appears (test-coverage-analyzer-validation-patterns.ts:105-116). 363 of the 486 files import only relative project modules (the module under test), 99 more add only Node built-ins; tests that spawn the built CLI or build temp-dir fixtures are told to mock.
Other templates of the same law:
- "No edge case testing" (74): the word list misses negative titles ("does NOT flag …") and
toBe(false); constant tables with no input are asked for edge cases. - "Mock functions without cleanup" (4):
jest.config.jssetsresetMocks/restoreMocks/clearMocks: true; the detector never reads it. - "Excessive mocking": tests are counted with
/it\s*\(/only, soit.eachcounts 0 tests. - "setTimeout usage": matches
jest.setTimeout(N).
Real debt that should stay visible: 9 identical 50 ms sleeps in afterAll, a wall-clock-dependent performance test, ~18 tests spying pure helpers (45 mock setups for 16 tests).
Suggested direction
Count only external boundaries the test actually calls (network/db clients, child_process, the clock), never a relative import; no mock demand for spawn-the-CLI or temp-fixture tests (or drop "no mocks" as a defect); read the jest config's mock reset flags; count it.each(/test(; accept negative titles and toBe(false) as edge cases.
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 0
- Merge medio
- 38m
- PR unite (30g)
- 96
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Rule-Of-Code/RoC
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Rule-Of-Code/RoC#436 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Rule-Of-Code/RoC#439 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 49/100
Rule-Of-Code/RoC#438 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 53/100
Rule-Of-Code/RoC#437 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
Rule-Of-Code/RoC#435 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Rule-Of-Code/RoC
Issue simili
-
documentation lens:human needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
thebristolsound/birdbrain#2246 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
A voting window past about 69.9 million hours stores a deadline that reads back as no deadlineApertabug ready-for-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
BoardGamesEmpire/board-games-empire-backend#1452 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue stretch
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno