I have my test setup using jest
and detox
(@e2e)
Issue is, despite seemingly properly importing @testing-lib/jest-dom
, I can't seem to use the toHaveAttribute()
matcher as I should be able to.
Inside my spec.js
file:
import { toHaveAttribute } from '@testing-library/jest-dom/matchers'
import '@testing-library/jest-dom/extend-expect'
expect.extend({
toHaveAttribute,
})
// ... tests here
However, when running my tests, I get the following error:
TypeError: expect(...).toHaveAttribute is not a function
- As you can see @ docs I should be setting up my
expect
properly.. So I'm really confused as to why I'm getting this error. - I found a similar issue, but as you can see, I'm properly importing the
extend-expect
here.
Aucun commentaire:
Enregistrer un commentaire