Skip to content

fix(test): Migrate more Mocha integration tests to Jest PART 1#20109

Open
vbudhram wants to merge 1 commit intomainfrom
fxa-12622
Open

fix(test): Migrate more Mocha integration tests to Jest PART 1#20109
vbudhram wants to merge 1 commit intomainfrom
fxa-12622

Conversation

@vbudhram
Copy link
Contributor

@vbudhram vbudhram commented Feb 26, 2026

Because

  • We want to improve CI times and auth-server integration tests take time

This pull request

  • Adds 10 new Jest .in.spec.ts files mirroring the Mocha originals with 1:1 test parity (93 total test cases)
  • Replaces superagent with Node's built-in http module in test helpers to avoid circular reference crashes in Jest workers
  • Converts Chai assert.*() assertions to Jest expect().* matchers
  • Converts before()/after() to beforeAll()/afterAll() and forEach() version loops to describe.each()
  • Updates jest-global-setup.ts to generate config/version.json in worktree environments where git rev-parse fails
  • Updates jest-global-teardown.ts to clean up the generated version.json

Issue

Closes: https://mozilla-hub.atlassian.net/browse/FXA-12622

Checklist

  • My commit is GPG signed
  • Tests pass locally (if applicable)
  • Documentation updated (if applicable)
  • RTL rendering verified (if UI changed)

Other Information

Stability: Ran yarn test-integration-jest 5 times consecutively — all 417 tests passed on every run with zero flakes.

No Mocha files removed in this PR. The original .js test files remain until the full migration is complete and the Mocha runner can be retired.

Test Parity: Mocha vs Jest

Test Suite Mocha Source Jest Tests Mocha Tests Parity
attached_clients_tests .js 5 5 Full
device_tests .js 18 18 Full
device_tests_refresh_tokens .js 13 13 Full
misc_tests .js 16 16 Full
oauth_tests .js 12 12 Full
oauth_session_token_scope_tests .js 8 8 Full
session_tests .js 13 13 Full
push_db_tests .js 1 1 Full
pushbox_db pushbox/db.ts 6 6 Full
sign_key_tests .js 1 1 Full
Total 93 93 Full

@vbudhram vbudhram requested a review from a team as a code owner February 26, 2026 14:09
@vbudhram vbudhram changed the title fxa-12622: Migrate more Mocha integration tests to Jest (WIP) fix(test): Migrate more Mocha integration tests to Jest Feb 26, 2026
@vbudhram vbudhram self-assigned this Feb 26, 2026
@vbudhram vbudhram changed the title fix(test): Migrate more Mocha integration tests to Jest fix(test): Migrate more Mocha integration tests to Jest PART 1 Feb 26, 2026
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.

1 participant