Repository navigation
test(nextjs): Switch DEBUG_BUILD with a getter instead of re-importing the SDK - #25279
Merged
JPeer264 merged 1 commit intoOct 14, 2026
Merged
Conversation
JPeer264
added this pull request to stack #25283
October 12, 2026 12:19
JPeer264
marked this pull request as ready for review
October 12, 2026 12:31
JPeer264
requested review from
nicohrubec and
s1gr1d
and removed request for
a team
October 12, 2026 12:31
JPeer264
force-pushed
the
jp/flaky-nextjs-debug-build-mock
branch
from
October 12, 2026 12:33
e183f8f to
b3a6ebd
Compare
s1gr1d
approved these changes
Oct 12, 2026
JPeer264
removed this pull request from stack #25283
October 13, 2026 15:29
JPeer264
added this pull request to stack #25335
October 13, 2026 15:29
…g the SDK The test mocked DEBUG_BUILD with vi.doMock, then called vi.resetModules and imported the client, server and edge entry points again in each test. Vitest had to evaluate three large module graphs every time, and beforeAll "pre-warmed" them once more. Under CI load this took longer than the 10s hook timeout. The entry points read DEBUG_BUILD inside init(), so one top-level vi.mock with a getter over a vi.hoisted value lets each test switch it. The entry points are imported once, and the tests take milliseconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JPeer264
force-pushed
the
jp/flaky-nextjs-debug-build-mock
branch
from
October 13, 2026 15:36
b3a6ebd to
412d5db
Compare
51 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
conflictingDebugOptions.test.tsnow mocksDEBUG_BUILDone time, with a getter over avi.hoistedvalue, and it imports the client, server and edge entry points one time. Before, each test calledvi.doMockandvi.resetModulesand imported all three entry points again, andbeforeAll"pre-warmed" them one more time.Why
Under CI load, evaluating the three module graphs again took longer than the 10 s hook timeout. Now the two tests take a few milliseconds (25 ms and 6 ms locally, 1.68 s before). The "vi.unmock is not at the top level" warning is also gone.
Failed on CI: https://github.com/getsentry/sentry-javascript/actions/runs/38034725173/job/114166137692