Skip to content

Add CI/CD automation, auto-merge for bot PRs, and meaningful unit tests#158

Open
amadib wants to merge 8 commits intomasterfrom
ci-automation-and-tests
Open

Add CI/CD automation, auto-merge for bot PRs, and meaningful unit tests#158
amadib wants to merge 8 commits intomasterfrom
ci-automation-and-tests

Conversation

@amadib
Copy link
Copy Markdown
Contributor

@amadib 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>
@amadib amadib requested a review from a team as a code owner April 19, 2026 01:31
Comment thread .github/workflows/auto-merge.yml Fixed
Comment thread .github/workflows/auto-merge.yml Fixed
amadib and others added 6 commits April 18, 2026 21:43
…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>
@amadib amadib enabled auto-merge April 19, 2026 03:21
@amadib amadib disabled auto-merge April 19, 2026 03:22
- 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>
@sonarqubecloud
Copy link
Copy Markdown

@amadib amadib enabled auto-merge April 19, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants