mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
- Adds `scripts/run-test-audit.sh` to automate unit test execution with coverage. - Adds `scripts/analyze-flakiness.mjs` to detect test flakiness. - Adds `scripts/static-test-analysis.mjs` to find suspicious test patterns. - Adds `scripts/coverage-gap-analysis.mjs` to identify critical coverage gaps. - Adds `scripts/generate-audit-report.mjs` to produce markdown reports. - Generates initial audit report `test-audit-report-2025-02-18.md` and `issues/ISSUE_test_audit_findings.md`. - Documents findings in `decisions/DECISIONS_2025-02-18.md`. Co-authored-by: PR0M3TH3AN <[email protected]>
1.4 KiB
1.4 KiB
Test Audit Findings - 2025-02-18
Overview
The daily test audit has identified significant coverage gaps and suspicious patterns in the test suite.
Critical Coverage Gaps (< 70%)
- js/userBlocks.js (25.77% statements) - Critical for moderation.
- js/relayManager.js (56.75% statements) - Core networking logic.
- js/nostr/watchHistory.js (58.14% statements) - User data integrity.
- js/services/authService.js (Branches: 62.71%) - Auth flow reliability.
- js/nostr/dmDecryptWorker.js (Branches: 31.66%) - Privacy/Security.
Suspicious Patterns
- 91 files contain suspicious patterns.
- Network Dependence: High usage of
fetch/WebSocketwithout apparent mocking in unit tests (e.g.,tests/nostr/client.test.mjs,tests/services/attachmentService.test.mjs). - Time Dependence: Frequent use of
sleep/setTimeout(e.g.,tests/login-modal-controller.test.mjs). - Console Usage: Tests logging to console (e.g.,
tests/nostr/watchHistory.test.jshas 19 occurrences).
Recommended Actions
- Immediate: Create a "fixit" sprint to address coverage in
js/userBlocks.jsandjs/relayManager.js. - Refactor: Replace
sleep()calls withwaitFor()or mock timers intests/login-modal-controller.test.mjs. - Infrastructure: Introduce
mswornockfor network mocking to removefetchdependencies in unit tests.