-
Notifications
You must be signed in to change notification settings - Fork 412
Closed
Description
@testing-library/jest-domversion: ^6.4.6nodeversion: v21.1.0jest(orvitest) version: ^29.7.0npm(oryarn) version: 10.4.0
react-testing-libraryversion: ^16.0.0
Relevant code or config:
//__tests__index.test.js
import '@testing-library/jest-dom'
import { render, screen } from '@testing-library/react'
import ProfileForm from '@/components/Form'
import { expect } from '@jest/globals';
import '@testing-library/jest-dom/extend-expect'; // for additional matchers
describe('Home', () => {
it('renders a heading', () => {
render(<ProfileForm />)
const heading = screen.getByRole('heading', { level: 1 })
expect(heading).toBeInTheDocument()
})
})
// jest.setup.ts
import { config } from 'dotenv';
config();
import '@testing-library/jest-dom';
//jest.config.ts
import nextJest from "next/jest.js";
import type { Config } from "jest";
const createJestConfig = nextJest({
dir: "./",
});
const config: Config = {
clearMocks: true,
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
},
collectCoverage: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
preset: "ts-jest",
testEnvironment: "node",
setupFiles: ["<rootDir>/jest.setup.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
};
export default createJestConfig(config);What you did:
I was just trying to run my test and I was using expect
What happened:
my test is not running and it's showing that expect is not defined
Reproduction:
https://github.com/Boby900/yogurt
Problem description:
I am not able to run my test
Metadata
Metadata
Assignees
Labels
No labels
