Skip to content

Move the UI test stack off Karma #596

Description

@DerOetzi

Why

Karma has been deprecated since April 2023, and the ecosystem has started to act on it.

  • Jasmine announced the phase-out in jasmine/jasmine#2084: 6.x is the last version compatible with karma-jasmine, and 7.0 removed the APIs that only existed for it. Concretely, jasmine-core 7 ends its Env constructor with Object.freeze(this), while zone.js patches Jasmine by assigning to jasmine.getEnv().describe and friends in place. Every spec then fails to load with TypeError: Cannot assign to read only property 'describe' — see the closed bump build(deps-dev): Bump jasmine-core from 6.3.0 to 7.0.2 in /ui #593.
  • zone.js is at 0.16.2, which is the newest release on npm, and it has no support for Jasmine 7.
  • Angular's own builder announces it on every run: The "@angular-devkit/build-angular:karma" builder is deprecated as part of Angular's Webpack support deprecation.

So the UI test dependencies are frozen where they are: jasmine-core stays on 6.x, and .github/dependabot.yml ignores its majors until this issue is done. That is a holding position, not a plan.

What

Move ui/ to Angular's supported unit-test setup (@angular/build:unit-test, Vitest-based) and drop the Karma stack:

  • angular.json: replace the test target's @angular-devkit/build-angular:karma builder.
  • Remove karma, karma-chrome-launcher, karma-coverage, karma-jasmine, karma-jasmine-html-reporter, karma.conf.js and src/test.ts.
  • Carry the coverage floor over. karma.conf.js currently enforces statements 68 / branches 53 / functions 56 / lines 67, and the rule is that work which adds coverage raises it to match — the replacement needs an equivalent gate, or CI loses it silently.
  • .github/workflows/build_project.yml: check-ui runs npm test -- --watch=false --browsers=ChromeHeadlessCI --code-coverage; the flags change with the runner.
  • Remove the jasmine-core ignore entry from .github/dependabot.yml.

Acceptance

  • All 87 existing specs pass unchanged, or every deviation is explained.
  • Coverage is enforced at no less than today's floor, and check-ui fails when it is undercut.
  • No karma* package is left in ui/package.json.
  • jasmine-core can move to its current major again, and the Dependabot ignore is gone.
  • A decision record covers the runner choice.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions