Skip to content

Comments

fxa-12621: Migrate 14 Mocha integration tests to Jest#20055

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

fxa-12621: Migrate 14 Mocha integration tests to Jest#20055
vbudhram wants to merge 1 commit intomainfrom
fxa-12621

Conversation

@vbudhram
Copy link
Contributor

@vbudhram vbudhram commented Feb 12, 2026

Because

  • Auth server integration tests were split across Mocha and Jest, making CI slower and harder to maintain
  • The Mocha test runner lacks Jest's parallel execution, better error reporting, and modern async handling

This pull request

  • Migrates 14 Mocha integration test files to Jest .in.spec.ts format in test/remote/
  • Adds shared test infrastructure: test-process-registry.ts for server lifecycle management, test-utils.ts for common helpers
  • Updates jest-global-setup.ts and jest-global-teardown.ts to boot/teardown the auth server for integration tests
  • Updates test-server.ts with OAuth config overrides to fix assertion verification mismatches
  • Updates test-ci.sh to skip mocha tests when TEST_TYPE=integration-jest, running only Jest suites
  • Changes test-integration-jest npm script to route through test-ci.sh for consistency
  • Sets maxWorkers: 4 in jest.integration.config.js

Mocha → Jest test parity

File Mocha Jest Status
account_create 39 39 Full parity
account_create_with_code 7 7 Full parity
account_destroy 7 7 Full parity
account_locale 2 2 Full parity
account_login 13 13 Full parity
account_profile 12 12 Full parity
account_reset 5 5 Full parity
account_signin_verification 8 8 Full parity
account_status 9 9 Full parity
account_unlock 3 3 Full parity
base_path 4 2 + 2 todo Intentional skip
concurrent 1 1 Full parity
db 23 23 Full parity
email_validity 2 2 Full parity
flow 2 2 Full parity

base_path: 2 tests marked todo — they test __lbheartbeat__ and __version__ endpoints not present in the spawned
key_server.

Issue

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

Checklist

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

Other Information

Notable behavior change: The Mocha test "cannot stub the same account twice" had an un-awaited assert.isRejected() that was effectively a no-op. The Jest version correctly tests actual server behavior as "can re-stub an unverified account".

@vbudhram vbudhram self-assigned this Feb 13, 2026
@vbudhram vbudhram force-pushed the fxa-12621 branch 11 times, most recently from 29bd601 to ccde954 Compare February 18, 2026 02:24
@vbudhram vbudhram marked this pull request as ready for review February 18, 2026 18:32
@vbudhram vbudhram requested a review from a team as a code owner February 18, 2026 18:32
@vbudhram vbudhram force-pushed the fxa-12621 branch 4 times, most recently from 0d4b23e to ad08936 Compare February 18, 2026 22:01
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