Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(tests): Rename disableRouterMocks to enableRouterMocks #88513

Merged
merged 2 commits into from
Apr 2, 2025

Conversation

malwilley
Copy link
Member

Ref https://github.com/getsentry/frontend-tsc/issues/85

In preparation for making the new test routing the default behavior, I'm inverting disableRouterMocks. This will make the ergonomics slightly better, where toggling on the legacy behavior will be done with enableRouterMocks: true, and enableRouterMocks will be deprecated.

For now this inverts all the existing usages, but does not change the default behavior. The next step will be to add enableRouterMocks: true for all other tests and change the default to use the new routing.

@malwilley malwilley requested review from a team as code owners April 1, 2025 23:29
@malwilley malwilley requested review from a team and removed request for a team April 1, 2025 23:29
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 1, 2025
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #88513      +/-   ##
==========================================
+ Coverage   87.74%   87.76%   +0.01%     
==========================================
  Files       10014    10010       -4     
  Lines      567528   566789     -739     
  Branches    22298    22283      -15     
==========================================
- Hits       498000   497414     -586     
+ Misses      69111    68956     -155     
- Partials      417      419       +2     

@@ -137,6 +138,7 @@ function patchBrowserHistoryMocksEnabled(history: MemoryHistory, router: Injecte
}

function makeAllTheProviders(options: ProviderOptions) {
const enableRouterMocks = options.enableRouterMocks ?? true;
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@ryan953 ryan953 left a comment

Choose a reason for hiding this comment

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

default to true looks correct in all the places inside reactTestingLibrary.tsx

@malwilley malwilley enabled auto-merge (squash) April 2, 2025 16:25
@malwilley malwilley merged commit 8209259 into master Apr 2, 2025
41 checks passed
@malwilley malwilley deleted the malwilley/ref/test-router-deprecation branch April 2, 2025 17:08
Copy link

sentry-io bot commented Apr 4, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ReferenceError: useLocation is not defined useSpansIndexed(useDiscover.ts) View Issue
  • ‼️ ReferenceError: useLocation is not defined useSpansIndexed(useDiscover.ts) View Issue
  • ‼️ ReferenceError: useLocation is not defined useSpansIndexed(useDiscover.ts) View Issue
  • ‼️ Error: Must be used within a TourContextProvider useDemoToursAll(demoTours.tsx) View Issue
  • ‼️ Error: Must be used within a TourContextProvider useDemoToursAll(demoTours.tsx) View Issue

Did you find this useful? React with a 👍 or 👎

andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
In preparation for making the new test routing the default behavior, I'm
inverting `disableRouterMocks`. This will make the ergonomics slightly
better, where toggling on the legacy behavior will be done with
`enableRouterMocks: true`, and `enableRouterMocks` will be deprecated.

For now this inverts all the existing usages, but does not change the
default behavior. The next step will be to add `enableRouterMocks: true`
for all other tests and change the default to use the new routing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants