Upgrade to 2.16.0 and above give failed tests #1625
-
TypeError: Cannot read property 'getAllByTestId' of undefined
where
render imported from |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Looks like it's do to with number inputs specifically :) |
Beta Was this translation helpful? Give feedback.
-
I am attempting to reproduce this: describe('Repro', () => {
it('should render', () => {
wrapper = render(
<Router>
<NumberInput
data-testid="blah"
name="number-input"
onChange={onChangeSpy}
/>
</Router>
)
expect(wrapper.getAllByTestId('blah')).toHaveLength(1)
})
}) The test passes. Are you able to provide a failing test? |
Beta Was this translation helpful? Give feedback.
-
This is because |
Beta Was this translation helpful? Give feedback.
This is because
NumberInput
is dependent on the canvas API. We have worked around this by addingimport 'jest-canvas-mock'
tosetupTests.ts
.