Skip to content

Pin MongoDB test binary version in Jest setup - #312

Merged
Tybravo merged 1 commit into
SwiftChainn:mainfrom
BigNathan1:test/pin-mongodb-memory-server-version
Oct 22, 2026
Merged

Tybravo merged 1 commit into
SwiftChainn:mainfrom
BigNathan1:test/pin-mongodb-memory-server-version

Conversation

@BigNathan1

Copy link
Copy Markdown
Contributor

Summary

mongodb-memory-server picks its binary version from MONGOMS_VERSION. The repository sets that in the root jest.setup.js, but Jest loads tests/jest.setup.ts (per jest.config.js), so the pin never applied. Tests then downloaded the default MongoDB 6.0.x binary, which is large and can stall or fail on slow connections.

This PR moves the pin into tests/jest.setup.ts. An existing MONGOMS_VERSION in the environment still takes precedence, so CI can override it.

Verification

Run on this branch with MONGOMS_VERSION unset in the shell:

npx jest tests/admin.test.ts

Result: 1 suite passed, 24 of 24 tests passed. No MongoDB 6.0.14 download was triggered, and the suite used the cached 7.0.14 binary. Before this change the same suite failed with Test suite failed to run because the 6.0.14 download was interrupted.

Scope

One file changed: tests/jest.setup.ts, plus the comment explaining the pin. No test or source code changes.

Follow-up

The root jest.setup.js still sets the same variable, and it is not loaded by Jest. It is harmless but misleading. It can be removed in a separate change.

mongodb-memory-server fell back to its default 6.0.x binary because only the
root jest.setup.js set MONGOMS_VERSION, and Jest does not load that file.
Set the version in tests/jest.setup.ts instead. An existing MONGOMS_VERSION in
the environment still takes precedence.
@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

Hey @BigNathan1! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#232 [Testing] Write integration tests for the admin DLQ routes (list, retry, exhaustion) Link to this issue
#236 [Testing] Add a route-mount smoke test that fails on orphaned or unimported handlers Link to this issue
#235 [Testing] Write unit tests for admin user management (suspend, reactivate, ban enforcement) Link to this issue
#234 [Testing] Write tests for profilePicture.service and storage.service (local/S3, resize, signed URLs) Link to this issue

ℹ️ Learn more about linking PRs to issues

@Tybravo
Tybravo merged commit aaee9bf into SwiftChainn:main Oct 22, 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.

2 participants