Skip to content

Commit

Permalink
Use advanceTimers callback
Browse files Browse the repository at this point in the history
In `user-event` v14.1 and later, it's recommended to avoid test timeouts
by attaching the library's delay function to the test framework's
function to advance its fake timers.
  • Loading branch information
msmolens committed Jun 3, 2024
1 parent 3f13e5e commit faceacf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/treetop/FilterInput.svelte.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import FilterInput from '@Treetop/treetop/FilterInput.svelte';

const setup = () => {
return {
user: userEvent.setup({ delay: null }),
user: userEvent.setup({
advanceTimers: (delay) => {
vi.advanceTimersByTime(delay);
},
}),
...render(FilterInput),
};
};
Expand Down

0 comments on commit faceacf

Please sign in to comment.