You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tests that use rerender started failing after upgrading from 4.1.0 to 5.1.0. I understand the function behaviour changed recently, but this is not working for me:
it('should show MyComponent when show = true', async () => {
const { rerender } = render(MyComponent, {
props: {show: true}
})
expect(screen.queryByTestId('my_component')).toBeInTheDocument()
await rerender({props: {show: false}})
expect(screen.queryByTestId('my_component')).not.toBeInTheDocument()
})
The text was updated successfully, but these errors were encountered:
Thanks for your reply @mcous. I think I figured out the reason the tests broke. It wasn't because of the syntax (by the way, I didn't see any warnings, not sure if Vitest is suppressing them). It was because I was not using a reactive variable to hide my component, but instead a regular variable that depends on the prop and which was being assigned on mount.
Gotcha; that makes sense! rerender in v4 destroyed and remounted the component, which would prevent you from seeing those sorts of reactivity bugs. That's why it was changed!
Tests that use
rerender
started failing after upgrading from 4.1.0 to 5.1.0. I understand the function behaviour changed recently, but this is not working for me:The text was updated successfully, but these errors were encountered: