test(miner-extension): bring the browser extension under a real coverage gate (#4865) - #5633
Conversation
- Updated package.json to include tests for the @jsonbored/gittensory-miner-extension in the ui:test script. - Added a new test script in the miner extension's package.json for running tests with vitest. - Introduced vitest configuration for the miner extension, enabling coverage reporting and setting thresholds. - Created comprehensive test suites for background.js, opportunity-badge.js, and toolbar-badge.js, ensuring critical functionality is covered. - Expanded README.md to document the new testing process and coverage expectations.
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5633 +/- ##
=======================================
Coverage 95.01% 95.01%
=======================================
Files 575 575
Lines 45738 45738
Branches 14661 14661
=======================================
Hits 43459 43459
Misses 1528 1528
Partials 751 751
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 LoopOver review result - reject/close recommendedReview updated: 2026-07-13 16:15:06 UTC
🛑 Suggested Action - Reject/Close
Review summary Nits — 5 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agentFlagged checks (non-blocking)
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
Gittensory is closing this pull request on the maintainer's behalf (No linked issue detected). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |

Summary
apps/gittensory-miner-extensionwas excluded from coverage via the rootvitest.config.tsblanketcoverage.exclude: ["apps/**"], and its existing behavior tests (test/unit/miner-*.test.ts) run thesource through a
node:vmharness, which v8 cannot attribute coverage to. This PR gives the extension areal, measured coverage gate — the extension half of Bring the miner-ui and extension under a coverage gate #4865 (the miner-ui half shipped in test(miner-ui): bring the miner-ui under a real coverage gate #5613).
apps/gittensory-miner-extension/test/) that imports thereal source files directly — using the source's own
globalThis.__GITTENSORY_MINER_EXTENSION_TEST__internals hook — so v8 attributes coverage to the files. Covers the pure state maps and the background
service worker:
toolbar-badge.js,opportunity-badge.js, andbackground.js(52 tests).coverageblock + measured baselinethresholdsto a newapps/gittensory-miner-extension/vitest.config.ts(v8;
includescoped to the three covered files), and changes the app'stestscript tovitest run --coverage.testinto the rootui:test, so the gate runs wherevernpm run ui:test/npm run test:cialready run — no new CI step.
The two DOM-page scripts —
content.js(issue-page content script) andoptions.js(options-page form) — needa jsdom mount harness and are deliberately left for a follow-up. The threshold is a real measured baseline
(100% statements/functions/lines, 96.63% branches the day this was wired), a regression floor with a small
buffer, not an aspirational target — to be raised per-PR as the deferred scripts get covered.
Advances #4865 (not closing it — the
content.js/options.jscoverage half is still open).Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.miner-ui half merged in test(miner-ui): bring the miner-ui under a real coverage gate #5613.
Validation
git diff --checknpm --workspace @jsonbored/gittensory-miner-extension run test— 52 passing; coverage 100% stmts /96.63% branches / 100% funcs / 100% lines, over the configured floor
npm run docs:drift-checknpm run test:ci(full local gate) — run before mergenpm audit --audit-level=moderateIf any required check was skipped, explain why:
apps/gittensory-miner-extension/**, which Codecovignores (
apps/**), so it owes nocodecov/patchcoverage; the new gate is the app's own vitest threshold.It touches no
src/**, no other workspace's source, no OpenAPI/MCP/wrangler/migrations, so those generatedartifacts and their drift checks are unaffected.
Safety
UI Evidencesection — n/a: no user-visible UI or extension-behavior change.UI Evidence
No visible UI or extension-behavior change. This PR only adds a test suite, a coverage-gate config, a
testscript, and a dev-facing README section — there is no user-facing surface to screenshot (same as the miner-ui
coverage-gate PR #5613).
Notes
node:vm-based tests in roottest/unit/are left in place as behavior tests; the newapp-local suite's role is coverage instrumentation the
vmharness structurally cannot provide.