Fix formatting in techniques.js#26
Merged
Merged
Conversation
sebdraven
approved these changes
May 14, 2026
Test infrastructure ------------------- - Vitest + happy-dom: 5 test files, 83 unit tests covering ContentExtractor (cleanText keeping Unicode scripts, detectPageType edge cases, title extraction), TechniqueAnalyzer (risk bands, keyword matching boundaries, weight escalation), SuspiciousSitesManager (exact/contains/pattern matching plus the Storm1516 social-account format, handle extraction, logging gate), UIManager (escapeHtml, sanitizeHexColor, isSafeHttpUrl, adjustColor clamp, tooltip), and manifest sanity (JSON validity, declared paths exist). - tests/helpers/loadScript.js loads each content-script source as it would run in Chrome (indirect eval inside happy-dom's window), keeping the production code unchanged. Source-side adjustments to make the modules testable ---------------------------------------------------- - Suspicioussitesmanager.js: expose `window.SuspiciousSitesManager` (the class, in addition to the instance). Gate the "no databases loaded" warning behind DIMA_DEBUG — same noise-reduction rationale as the previous review pass. Tidy an unused destructure variable. Tooling ------- - package.json with vitest, happy-dom, eslint, globals; scripts: test, test:watch, test:coverage, lint, lint:fix, ci. - eslint.config.js (flat config): browser globals for source, node + vitest globals for tests, no-eq-eq smart, no-redeclare disabled because database files declare their own globals at top level. - vitest.config.js: happy-dom env, coverage scoped to modules/ + content.js. - .gitignore. GitHub Actions -------------- - ci.yml: lint + tests on every push to main and every PR. - release.yml: on tag v*.*.*, verify tag matches manifest.version, run npm ci, zip the runtime files (manifest, content.js, modules/, data/, docs, README, LICENSE, icons), upload as workflow artifact and create a draft GitHub release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
contentExtractor.test.js — add three cases that exercise the matchStem switch on `article` and `blog`: - /articles/foo -> news - /blogs/post -> blog - blogs.example.com -> blog animations.test.js — new file. Scans content.js for @Keyframes declarations and uiManager.js for `animation:` references, asserting that every name begins with `dima`. Prevents a future change from re-introducing a generic keyframe name (fadeIn, slideIn, ...) that would collide with the host page's CSS namespace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
accessibility.test.js — exercise createButton() against happy-dom and
assert that the rendered badge:
- carries role=button and tabindex=0
- exposes an aria-label including score and risk level
- hides the decorative 🧠 from screen readers
- fires showModal on Enter and on Space
- preventDefault on Space (so the host page doesn't scroll)
- ignores unrelated keys
syncInit.test.js — guard the bootstrap of Suspicioussitesmanager.js:
- no setTimeout(...) call in the init block (comments are stripped
so the historical note explaining why the delay was removed
doesn't trip the assertion)
- window.checkSuspiciousSite is callable immediately after the
module is loaded (no async wait)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drops the `push: branches: [main]` trigger from the CI workflow. The test/lint suite already runs on every pull request just before merge, so a second run after the merge lands on main is redundant — it costs a minute of Actions time without changing what we know about main. The release workflow keeps its `push: tags` trigger; tagging still produces the draft release zip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.