Add CI/CD automation, auto-merge for bot PRs, and meaningful unit tests#158
Open
Add CI/CD automation, auto-merge for bot PRs, and meaningful unit tests#158
Conversation
Contributor
amadib
commented
Apr 19, 2026
- GitHub Actions CI workflow: install, lint (non-blocking), test (ChromeHeadless), build, and npm audit on every PR and push to master
- Auto-merge workflow: enables GitHub auto-merge on Dependabot/Snyk PRs via pull_request_target; fails gracefully if repo settings don't allow it
- karma.conf.js: adds ChromeHeadlessNoSandbox custom launcher for CI
- package.json: adds test:ci and audit scripts
- src/test.ts: modernises zone.js imports (zone.js/testing) and installs a global Chrome extension API mock so background.ts module-level calls don't throw during test runs
- src/tsconfig.spec.json: adds chrome to compiler types so chrome.* references in service source files compile under the test tsconfig
- Replaces skeleton 'should create' tests with real behavioural coverage: ConfigurationService: HTTP fetch, caching for config and manifest version DefinitionService: local lookup (match/no-match/case-insensitive), routing logic (local vs remote), remote fetch with URL assertion PopupComponent: service wiring, lookupTerm flow, isLoading state HomepageComponent: config/version population, saveOptions timeout, optionsChanged
- GitHub Actions CI workflow: install, lint (non-blocking), test (ChromeHeadless), build, and npm audit on every PR and push to master - Auto-merge workflow: enables GitHub auto-merge on Dependabot/Snyk PRs via pull_request_target; fails gracefully if repo settings don't allow it - karma.conf.js: adds ChromeHeadlessNoSandbox custom launcher for CI - package.json: adds test:ci and audit scripts - src/test.ts: modernises zone.js imports (zone.js/testing) and installs a global Chrome extension API mock so background.ts module-level calls don't throw during test runs - src/tsconfig.spec.json: adds chrome to compiler types so chrome.* references in service source files compile under the test tsconfig - Replaces skeleton 'should create' tests with real behavioural coverage: ConfigurationService: HTTP fetch, caching for config and manifest version DefinitionService: local lookup (match/no-match/case-insensitive), routing logic (local vs remote), remote fetch with URL assertion PopupComponent: service wiring, lookupTerm flow, isLoading state HomepageComponent: config/version population, saveOptions timeout, optionsChanged Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…conflict - auto-merge.yml: replace github.actor with github.event.pull_request.user.login (accurate PR-author check; actor is forgeable on synchronize events per S6549) and move PR number/repo into env vars to eliminate shell template injection risk - package.json: bump @angular-builders/custom-webpack 16 → 19 to match Angular 19 workspace and unblock npm ci peer dependency resolution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ConfigurationService spy setup and the config/version init it-blocks were copy-pasted across homepage and popup specs, pushing new-code duplication to 5.3% (limit 3%). Extract createConfigServiceSpy and itLoadsConfigAndVersion into src/testing/spec-helpers.ts so each spec imports rather than repeats them. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Angular 15+ uses strict exact peer deps per package version; adding .npmrc with legacy-peer-deps=true restores pre-npm-7 resolution that the existing package-lock.json was generated with. Also aligns all @angular/* versions back to the consistent 19.2.18/19 baseline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Lock file had Angular 16-era entries; running npm install with legacy-peer-deps now produces a consistent lock file for npm ci. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- angular.json: correct tsConfig path to src/tsconfig.spec.json (was missing src/ prefix, causing immediate CI crash) - karma.conf.js: update framework, plugin path, and reporter for Angular 19 (angular/cli → angular-devkit/build-angular, karma-coverage-istanbul-reporter → karma-coverage) - package.json: add karma-coverage devDependency; add karma-specific minimatch@3 override to fix karma 6 incompatibility with hoisted minimatch@9; add @babel/core override to fix deduplication bug from package-lock regeneration - SCSS: migrate Angular Material theming from removed @import/@include mat-core()/angular-material-theme() API to new @use/mat.m2-define-palette()/mat.all-component-themes() API - src/tsconfig.spec.json: add polyfills.ts to files so Angular build-angular karma builder can resolve it - popup.component.spec.ts: add missing import { of } from 'rxjs' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- src/test.ts: remove webpack-specific require.context + __karma__.loaded/start manipulation. Angular 19's karma builder auto-loads spec files via FindTestsPlugin, and the old pattern left the browser stuck in CONFIGURING so karma killed it with "Disconnected, because no message in 30000 ms". - popup.component.spec.ts: import FormsModule (template uses ngForm/ngModel, previously failed with NG0301: Export of name 'ngForm' not found). - lookup.component.spec.ts: seed definitions=[] and lookupWord='' before detectChanges; template reads definitions.length which is undefined when the component is rendered in isolation. - src/tsconfig.app.json: exclude testing/**/*.ts so the production build does not try to compile spec-helpers.ts (which uses Jasmine globals). 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.


