A callback of waitFor fires events, which it repeats every time it retries
What it finds
waitFor calls its callback again and again until it stops throwing. An event fired in it is fired on every attempt, so the test clicks or types more often than it says. Actions belong before waitFor, and only the check inside.
Reported are calls of fireEvent and user event methods inside the callback of waitFor.
From the rule's source, action_in_wait_for.rs.
declare const screen: any;declare const fireEvent: any;declare function waitFor(f: () => void): Promise<void>;it("opens", async () => { await waitFor(() => { fireEvent.click(screen.getByText("Open"));tx0 reports: this event is fired again every time });}); Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:action-in-wait-for" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:action-in-wait-for] reason="..."tx0 explain tx0/ts:action-in-wait-for shows the same in the terminal. Found a false positive? Report it.