Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with jest matchers #13705

Open
MultidimensionalLife opened this issue Nov 12, 2024 · 1 comment
Open

problem with jest matchers #13705

MultidimensionalLife opened this issue Nov 12, 2024 · 1 comment

Comments

@MultidimensionalLife
Copy link

MultidimensionalLife commented Nov 12, 2024

Describe the bug

I tried to generate a new project using yarn create react-app my-project --template typescript. But I have a jest matcher errors right away.

Environment

local dev

Steps to reproduce

yarn create react-app my-project --template typescript
cd my-project
yarn start

Screenshot 2024-11-12 at 11 42 00 AM

Thanks!

@REM-001
Copy link

REM-001 commented Nov 16, 2024

this issue is often related to how diffrent versions of Typescript and Jest interact, especially when type definitions are involved. You might want to check your Typescript configurations:

In your tsconfig.json file, ensure this option is set:

{
 "compilerOptions": {
     "jsx": "react-jsx" 
  }
}

If this doesn't work, try explicitly importing the expect function and any matchers you're using from Jest:

import { expect, test, describe } from '@jest/globals';

test('my test', () => {
  expect(true).toBe(true);
});

I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants