Unverified Commit fac02d85 authored by toyamarinyon's avatar toyamarinyon Committed by GitHub

Follow the breaking change of jest-config (#26082)



## Documentation / Examples

When I create a new application using Next.js and use `jest` or `react-testing-library`, I get the following error.
```
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.
    
    ReferenceError: document is not defined
```
This is because `jest-config` changed the default testing environment to node in 27.0.
> `jest-config@27.0.0` default to Node testing environment instead of browser (JSDOM) (#9874)


Raised the jest version of `with-typescript-eslint-jest` to 27.0 to make it pass the test.

- [x] Make sure the linting passes
parent 722d08ee
module.exports = { module.exports = {
roots: ['<rootDir>'], roots: ['<rootDir>'],
testEnvironment: 'jsdom',
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx'],
testPathIgnorePatterns: ['<rootDir>[/\\\\](node_modules|.next)[/\\\\]'], testPathIgnorePatterns: ['<rootDir>[/\\\\](node_modules|.next)[/\\\\]'],
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(ts|tsx)$'], transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(ts|tsx)$'],
......
...@@ -32,18 +32,18 @@ ...@@ -32,18 +32,18 @@
}, },
"devDependencies": { "devDependencies": {
"@testing-library/react": "^11.2.5", "@testing-library/react": "^11.2.5",
"@types/jest": "^26.0.20", "@types/jest": "^26.0.23",
"@types/node": "^14.14.25", "@types/node": "^14.14.25",
"@types/react": "^17.0.1", "@types/react": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^4.14.2", "@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2", "@typescript-eslint/parser": "^4.14.2",
"babel-jest": "^26.6.3", "babel-jest": "^27.0.2",
"eslint": "^7.19.0", "eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0", "eslint-config-prettier": "^7.2.0",
"eslint-plugin-react": "^7.19.0", "eslint-plugin-react": "^7.19.0",
"husky": "^4.2.3", "husky": "^4.2.3",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^26.6.3", "jest": "^27.0.4",
"jest-watch-typeahead": "^0.6.1", "jest-watch-typeahead": "^0.6.1",
"lint-staged": "^10.0.10", "lint-staged": "^10.0.10",
"prettier": "^2.0.2", "prettier": "^2.0.2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment