Auto detection of Jest version not working in 24.1.0
See original GitHub issueWhen using version 23.10.0 and extending plugin:jest/recommended
, eslint loads without issue.
When using version 24.1.0, the following output can be seen:
[Info - 23:45:50] ESLint server is starting
[Info - 23:45:50] ESLint server running in node v12.14.1
[Info - 23:45:50] ESLint server is running.
[Info - 23:45:51] ESLint library loaded from: PROJECT_PATH/node_modules/eslint/lib/api.js
[Info - 23:45:51] Error while loading rule 'jest/no-deprecated-functions': Unable to detect Jest version - please ensure jest package is installed, or otherwise set version explicitly Occurred while linting PROJECT_PATH/.eslintrc.js
After explicitly setting the version, as per the error message, eslint runs without issue; however, it seems like it’s a bug (unless version 23.x wasn’t using any of the rules that required the version detection?).
If it helps, see below my .eslintrc.js
file:
module.exports = {
env: {
commonjs: true,
es2021: true,
node: true,
},
extends: [
'plugin:jest/recommended',
'airbnb-base',
],
parserOptions: {
ecmaVersion: 12,
},
plugins: [
'jest',
],
rules: {
},
settings: {
jest: {
version: 26,
},
},
};
Here are also the eslint* packages I am using:
{
"devDependencies": {
"eslint": "^7.11.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0"
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
Jest passing tests but --covering option not picking up files
I have tested covering with some simple examples found on github and those were working so the problem is not from my environment....
Read more >How to resolve create-react-app babel-jest Error. - Medium
1)Manually installing incompatible versions is known to cause hard-to-debug issues.If you would prefer to ignore this check, add ...
Read more >babel-jest - NPM Package Overview - Socket.dev
Jest plugin to use babel for transformation. Version: 24.9.0 was published by scotthovestadt. Start using Socket to analyze babel-jest and ...
Read more >Test with Jest - devmio
Today there is hardly a developer who does not have these design patterns in mind and automatically applies them in his daily work....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A workaround for this issue is to specify the version via
latest
as most ESLint versions are back-wards compatible in the.eslintrc
.It seems, another fix for this is
blank
findsC:\Development\alloy-web2\projects\web-core-unit-test\node_modules\jest\package.json
paths: [process.cwd(), __dirname]
finds C:\Development\alloy-web2\projects\web-core-unit-test\node_modules\jest\package.jsonSo they both match now. Where as before, it thrown an error.