'I got a problem with my render test in react
What is wrong with my render test here ? test and expect is undefined but i see some tutorials and they do the same thing. I'm on a basic create react app.
import { render, screen } from "@testing-library/react"
import App from "./App"
test("renders learn react link", () => {
render(<App />)
const linkElement = screen.getByText(/learn react/i)
expect(linkElement).toBeInTheDocument()
})
and my eslint.rc ( i don't know if it's necessary )
module.exports = {
"env": {
"browser": true,
"node": true,
"es6": true,
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
},
"settings": {
"react": {
"version": "detect",
},
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
},
"ecmaVersion": 11,
"sourceType": "module",
},
"plugins": [
"react", "react-hooks",
],
"ignorePatterns": ["__mocks__", "*_pb.js"],
"rules": {
"indent": ["error", 2, { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": ["error"],
"quotes": ["error", "double"],
"semi": ["error", "never"],
"comma-dangle": ["error", "always-multiline"],
"react/prop-types": 0,
"react/display-name": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
