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
expect
properly.. So I'm really confused as to why I'm getting this error. extend-expect
here.Native development is not DOM. Detox implements its own expectation API, which is routed to the appropriate platform's native implementation, and toHaveAttribute()
is not implemented. We have no concrete plans currently to support this, but we will consider in the future, once a planned rewrite of the iOS side is completed.