mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
- Refactored `tests/auth-service.test.mjs` to use `node:test` API so it is detected by the runner. - Removed console noise from `tests/watchHistory/watch-history-telemetry.test.mjs`. - Generated daily audit report `test-audit-report-2026-02-12.md`. - Updated test logs and tracking artifacts. Co-authored-by: PR0M3TH3AN <[email protected]>
2.3 KiB
2.3 KiB
Test Audit Report - 2026-02-12
Summary
The unit test suite passed successfully (680 tests). A critical issue where tests/auth-service.test.mjs was skipped (resulting in 10% coverage for authService.js) was identified and fixed, raising coverage to 62%. Several critical production files remain with low coverage.
Test Run Details
- Command:
node --import ./tests/test-helpers/setup-localstorage.mjs --test --experimental-test-coverage tests/**/*.test.mjs - Result: 680 passed, 0 failed.
- Duration: ~42s
Critical Coverage Gaps
The following critical files have low coverage (< 50%):
| File | Line Coverage | Function Coverage | Impact |
|---|---|---|---|
js/webtorrent.js |
12.25% | 4.00% | Critical (Playback core) |
js/userBlocks.js |
18.92% | 26.47% | High (Moderation) |
js/nostr/nip46Client.js |
27.42% | 44.59% | High (Remote Signing) |
js/views/VideoListView.js |
48.81% | 36.04% | Medium (Main Feed UI) |
Fixed Issues
- Auth Service Tests Skipped:
tests/auth-service.test.mjswas using raw async blocks withoutnode:testimports, causing the runner to skip it.- Fix: Refactored to use
describe/testfromnode:test. - Result:
js/services/authService.jscoverage improved from 10% to 62%.
- Fix: Refactored to use
- Console Noise: Removed a leftover
console.logintests/watchHistory/watch-history-telemetry.test.mjs.
Static Analysis Findings
- Time Dependency: Extensive use of
setTimeoutfound intests/nostr/client.test.mjs,tests/moderation/video-card.test.mjs, and others. These are potential sources of flakiness. - Skipped Tests:
tests/nostr/sessionActor.test.mjsskips a test when WebCrypto is unavailable. - Network Calls: No unmocked external network calls detected in unit tests (mocks appear to be used).
Recommendations
- Prioritize Webtorrent Tests: Add unit tests for
js/webtorrent.jsto cover the torrent client wrapper logic. - Moderation Coverage: Expand
tests/user-blocks.test.mjs(if it exists) or create it to coverjs/userBlocks.js. - Refactor Timeouts: Replace
await new Promise(r => setTimeout(r, N))with deterministicwaitForhelpers intests/nostr/client.test.mjsto reduce flakiness risk.