Skip to content

test(auth-compat): migrate auth-compat unit tests to Vitest - #10435

Open
sedanah-m wants to merge 15 commits into
mainfrom
feature/vitest-auth-compat
Open

sedanah-m wants to merge 15 commits into
mainfrom
feature/vitest-auth-compat

Conversation

@sedanah-m

@sedanah-m sedanah-m commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Migrate @firebase/auth-compat unit tests from legacy Karma/Mocha/Chai/Sinon to native Vitest with Playwright Chromium browser runner and Node runner.

  • Replace karma.conf.js with vitest.config.mjs extending config/vitest.base.mjs
  • Add transform plugin in vitest.config.mjs to provide AuthErrorCode and AuthEventType const enum exports for Vitest runtime
  • Update package.json test scripts to use vitest run
  • Migrate auth.test.ts and popup_redirect.test.ts to native Vitest assertions, spies, and mocks with vi.mock('./platform', { spy: true })
  • Move fake controller providers to test/helpers/fake_providers.ts to decouple unit tests from integration settings
  • Configure tsconfigOverride in rollup.config.js to exclude test files from bundle packaging
  • Add standard mock cleanup in test/setup.ts and ambient types via test/types/vitest-globals.d.ts

Migrate @firebase/auth-compat unit tests from legacy Karma/Mocha/Chai/Sinon to native Vitest with Playwright Chromium browser runner and Node runner.

- Replace karma.conf.js with vitest.config.mjs extending config/vitest.base.mjs
- Add transform plugin in vitest.config.mjs to provide AuthErrorCode and AuthEventType const enum exports for Vitest runtime
- Update package.json test scripts to use vitest run
- Migrate auth.test.ts and popup_redirect.test.ts to native Vitest assertions, spies, and mocks with vi.mock('./platform', { spy: true })
- Move fake controller providers to test/helpers/fake_providers.ts to decouple unit tests from integration settings
- Configure tsconfigOverride in rollup.config.js to exclude test files from bundle packaging
- Add standard mock cleanup in test/setup.ts and ambient types via test/types/vitest-globals.d.ts
@changeset-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 95ba7f1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the auth-compat package's test suite from Karma, Mocha, and Sinon to Vitest, updating the package scripts, test files, and configurations accordingly. The feedback highlights a critical issue in the custom Vitest plugin where a loose path-matching condition could cause compilation failures if the repository is cloned into a directory containing 'internal'. Additionally, a redundant property assignment was identified in auth.test.ts just prior to using Object.defineProperty.

Comment thread packages/auth-compat/vitest.config.mjs Outdated
Comment thread packages/auth-compat/src/auth.test.ts Outdated
@sedanah-m
sedanah-m marked this pull request as ready for review October 6, 2026 17:42
@sedanah-m
sedanah-m requested review from a team and sam-gc as code owners October 6, 2026 17:43
Comment thread packages/auth-compat/package.json Outdated
Comment thread packages/auth-compat/vitest.config.mjs Outdated
Comment thread packages/auth-compat/vitest.config.mjs Outdated
Comment thread packages/auth-compat/vitest.config.mjs
Comment thread packages/auth-compat/vitest.config.mjs Outdated
Comment thread packages/auth-compat/src/auth.test.ts Outdated
Comment thread packages/auth-compat/src/auth.test.ts Outdated
Comment thread packages/auth-compat/src/auth.test.ts Outdated
@sedanah-m
sedanah-m force-pushed the feature/vitest-auth-compat branch from e85d518 to 34e95aa Compare October 8, 2026 21:20
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Vertex AI Mock Responses Check ⚠️

A newer major version of the mock responses for Vertex AI unit tests is available. update_vertexai_responses.sh should be updated to clone the latest version of the responses: v17.0

Comment thread packages/auth-compat/package.json Outdated
Comment thread packages/auth-compat/package.json Outdated
Comment thread packages/auth-compat/vitest.config.mjs Outdated
Comment thread packages/auth-compat/test/integration/flows/custom.test.ts Outdated
@sedanah-m
sedanah-m force-pushed the feature/vitest-auth-compat branch from c65dab8 to 862c763 Compare October 12, 2026 19:45

This branch has not been deployed

No deployments
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