Files
bitvid/issues/ISSUE_test_audit_findings.md
T
google-labs-jules[bot]andPR0M3TH3AN 661a51084e feat(test-audit): Add daily test integrity and coverage audit workflow
- 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]>
2026-02-18 20:17:01 +00:00

23 lines
1.4 KiB
Markdown

# 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%)
1. **js/userBlocks.js** (25.77% statements) - Critical for moderation.
2. **js/relayManager.js** (56.75% statements) - Core networking logic.
3. **js/nostr/watchHistory.js** (58.14% statements) - User data integrity.
4. **js/services/authService.js** (Branches: 62.71%) - Auth flow reliability.
5. **js/nostr/dmDecryptWorker.js** (Branches: 31.66%) - Privacy/Security.
## Suspicious Patterns
- **91 files** contain suspicious patterns.
- **Network Dependence**: High usage of `fetch` / `WebSocket` without 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.js` has 19 occurrences).
## Recommended Actions
1. **Immediate**: Create a "fixit" sprint to address coverage in `js/userBlocks.js` and `js/relayManager.js`.
2. **Refactor**: Replace `sleep()` calls with `waitFor()` or mock timers in `tests/login-modal-controller.test.mjs`.
3. **Infrastructure**: Introduce `msw` or `nock` for network mocking to remove `fetch` dependencies in unit tests.