diff --git a/app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx b/app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx
index eab9c7114bf..f84d2ab9db3 100644
--- a/app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx
+++ b/app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx
@@ -7,9 +7,6 @@ const fakeIcon = () => ;
describe('', () => {
describe(' click handler', () => {
it('runs the scroll animation if the column contains scrollable content', () => {
- vi.useFakeTimers({
- toFake: ['requestIdleCallback']
- });
const scrollToMock = vi.fn();
const { container } = render(
@@ -18,7 +15,6 @@ describe('', () => {
);
container.querySelector('.scrollable').scrollTo = scrollToMock;
fireEvent.click(screen.getByText('notifications'));
- vi.runAllTimers();
expect(scrollToMock).toHaveBeenCalledWith({ behavior: 'smooth', top: 0 });
});
diff --git a/app/javascript/mastodon/test_helpers.tsx b/app/javascript/mastodon/test_helpers.tsx
index 4f17f62e13d..ae1f1cd4f6e 100644
--- a/app/javascript/mastodon/test_helpers.tsx
+++ b/app/javascript/mastodon/test_helpers.tsx
@@ -7,6 +7,15 @@ import { render as rtlRender } from '@testing-library/react';
import { IdentityContext } from './identity_context';
+beforeAll(() => {
+ global.requestIdleCallback = vi.fn((cb: IdleRequestCallback) => {
+ // @ts-expect-error IdleRequestCallback expects an argument of type IdleDeadline,
+ // but that doesn't exist in this environment.
+ cb();
+ return 0;
+ });
+});
+
function render(
ui: React.ReactElement,
{