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
import{render,screen}from'tests/test-utils';importLandingPagefrom'./landing-page-component';describe('landing page component',()=>{it('displays a greeting',()=>{render(<LandingPage/>);expect(screen.getByText(/welcome/i)).toBeInTheDocument();});});
This is probably an issue with the compiler you're using. We've had a similar report before and it turned out that our code was spec compliant but the bundler wasn't: #790
@testing-library/react
version: 12.1.2Relevant code or config:
This is
jest.config.ts
.As you can see, this uses Next.js's SWC based Rust compiler settings for Jest.
And here is
jest.setup.ts
:What you did:
I created a custom
render
method to support i18n:I exported it alongside the other
@testing-library/react
methods as described in the docs:I then imported those in my tests:
What happened:
The test fails:
Reproduction:
yarn create next-app
touch tsconfig.json
yarn add next@canary
)yarn add --dev typescript @types/react jest @testing-library/react @testing-library/jest-dom ts-node
package.json
:"test": "jest"
.tsx
.Problem description:
The code is compiled with SWC and it looks like it doesn't allow redefinitions.
Suggested solution:
For now a workaround is to import the custom render and the other testing library methods seperately.
The text was updated successfully, but these errors were encountered: