Error in jest: TypeError: React.forwardRef is not a function
Mnigos opened this issue · comments
index.spec.tsx
import { render, screen } from '@testing-library/react'
import Home from '.'
describe('Home', () => {
it('should render component', () => {
render(<Home />)
expect(screen.getByText('RIGTCH')).toBeInTheDocument()
})
})
error message
Test suite failed to run
TypeError: React.forwardRef is not a function
> 1 | import { Button } from '@vechaiui/react'
| ^
2 |
3 | export default function Index() {
4 | return (
at Object.<anonymous> (node_modules/@vechaiui/icon/src/core.tsx:5:41)
at Object.<anonymous> (node_modules/@vechaiui/icon/src/index.ts:1:1)
at Object.<anonymous> (node_modules/@vechaiui/alert/src/alert.tsx:2:1)
at Object.<anonymous> (node_modules/@vechaiui/alert/src/index.ts:3:1)
at Object.<anonymous> (node_modules/@vechaiui/react/src/index.ts:1:1)
at Object.<anonymous> (app/routes/index.tsx:1:1)
at Object.<anonymous> (app/routes/index.spec.tsx:3:1)
at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
at runJest (node_modules/@jest/core/build/runJest.js:404:19)
at _run10000 (node_modules/@jest/core/build/cli/index.js:320:7)
at runCLI (node_modules/@jest/core/build/cli/index.js:173:3)
I also tried to wrap Home
component into VechaiProvider
and got same result