Skip to content

[quality] Add coverage reporting for data-fetching script tests #950

Description

@kubestellar-hive

Finding

The documentation repo has 18 test files covering data-fetching scripts (feeds, contributors, GitHub profiles, SBOM, etc.) that run via npm test (node --test scripts/*.test.js) in the pages CI workflow. However:

  1. No coverage reporting — there is no visibility into what percentage of script logic is tested
  2. No coverage thresholds — regressions can land without detection
  3. No coverage artifacts — no historical tracking of coverage trends

Test files present:

  • check-sbom-staleness.test.js
  • enrichment.test.js
  • fetch-chain.test.js
  • fetch-contributors.test.js
  • fetch-feeds.test.js
  • fetch-firehose.test.js
  • fetch-github-driver-versions.test.js
  • fetch-github-images.test.js
  • fetch-github-profiles.test.js
  • fetch-github-repos.test.js
  • fetch-github-sbom.test.js
  • fetch-gnome-extensions.test.js
  • fetch-pin-state.test.js
  • fetch-playlist-metadata.test.js
  • generate-card-images.test.js
  • request-queue.test.js
  • update-artwork.test.js

Recommendation

  1. Add c8 (or node --test --experimental-test-coverage) to generate coverage reports
  2. Upload coverage to Codecov or as a workflow artifact
  3. Set a baseline coverage threshold (e.g., 60%) to prevent regression

Example using Node.js built-in coverage:

node --test --experimental-test-coverage scripts/*.test.js

Priority

  • Impact: low — scripts are data pipelines, not user-facing; tests already exist
  • Effort: low — single command change + optional Codecov config

Filed by quality agent (hold-gated mode)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions