Skip to content

docs: add Karma and Jasmine to the testing guide - #3856

Open
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:docs-testing-guide-karma
Open

armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:docs-testing-guide-karma

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Checklist

Description

This adds the Karma and Jasmine section that #3855 mentioned would follow. #3050 asks how to mock AngularFire in tests, and its thread has relied on a wrapper-class workaround for Jasmine since 2022.

How I checked it

I pasted every snippet unchanged into apps created with ng new and ran them in headless Chrome:

  • Angular 20 with AngularFire 20.1.1, with the @angular/build:karma builder and with the older @angular-devkit/build-angular:karma
  • Angular 21 with AngularFire 21.0.0 and Angular 22 with 22.0.0-rc.1, both with "runner": "karma"
  • Angular 22 again with zone.js

Then I removed each instruction in turn and confirmed the failure the page describes. For the part on moving to Vitest, I took two of those apps through Angular's migration guide and reran the page's examples.

Fixes #3050

@armando-navarro armando-navarro added bump: patch Size of the change: a fix or docs change that reaches users comp: docs Documentation. type: chore Maintenance with no user-facing behavior change. labels Dec 1, 2026
@armando-navarro armando-navarro added this to the 22.0.0 milestone Dec 1, 2026
@armando-navarro

Copy link
Copy Markdown
Collaborator Author

This will stay a draft until #3855 merges. At that point I'll rebase this branch on main and request a review.

Karma with Jasmine was the Angular CLI's test setup before
Angular 21.

The new section says which of the page's patterns work under
Karma as written, gives the one line the fake Auth example needs
for Jasmine's types, shows two replacements for a module mock,
which Jasmine does not have, and explains why Firebase apps
carry over between spec files. The part on moving to Vitest
gains a path for Karma projects.

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

Labels

bump: patch Size of the change: a fix or docs change that reaches users comp: docs Documentation. type: chore Maintenance with no user-facing behavior change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs] Mocking of angularfire methods with angularfire 7 during tests

1 participant