Vscode-jest: Extension thinks I'm using old jest

Created on 13 Jun 2017  路  15Comments  路  Source: jest-community/vscode-jest

I get this message on vscode startup: "This extension relies on Jest 20+ features, it will continue to work, but some features may not work correctly."

But I am using jest 20, installed into my node_modules:

$ node_modules/.bin/jest -v
v20.0.4
bug needs information

Most helpful comment

@seanpoulter Found where it was checking the path to Jest and added a line (and subsequent test) to check for jest-cli as well. Opened a PR for this. #243

All 15 comments

The same thing for me. Any ideas?

Maybe a workaround would be to add [email protected] to your package file instead of just jest-cli.

I'm not getting the error anymore, but IDK what I did.

That could be it, I don't use global commands like that - so it's likely that in all my projects there's a direct dependency on Jest's internals

Same thing here. Create React App 1.0.7 with macOs

I still received the error after adding [email protected] to my Create-React-App package.json.

I then updated react-scripts (used by CRA), restarted Code and the error was gone.

My guess is that my react-scripts package (version 0.9.4) used by CRA had a reference to Jest 19.

react-scripts package.json on May 15th

react-scripts package.json upgrade to Jest 20

Upgrading to react-scripts 1.0.10 which uses Jest 20.0.4 and it fixed the error for me.

Not sure if its a fix but it worked for me. Also, not even sure if @flaviut is even using CRA but maybe a package in the project is referencing an old version of Jest

I still received the error after adding [email protected] to my Create-React-App package.json.

Note: this is entirely unsupported by Create React App. If you add jest to package.json in a Create React App project, we make no guarantees that tests will work in the future.

I just saw this. Using vue webpack template

What steps can we take to reproduce that problem @robertmain? The vuejs-templates/webpack repo is using Jest 21 so it might be worth looking into. If you run npm ls jest or yarn list jest in that directory, what version of Jest do you get?

$ yarn list jest
yarn list v1.3.2
warning Filtering by arguments is deprecated. Please use the pattern option instead.
鈹斺攢 [email protected]
Done in 1.38s.
$ npm run unit

> [email protected] unit C:\Users\robert\Code\Node\dashboard
> jest test/unit/specs --coverage

No tests found
In C:\Users\robert\Code\Node\dashboard
  28 files checked.
  testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
  testPathIgnorePatterns: \\node_modules\\ - 28 matches
Pattern: test/unit/specs - 0 matches
----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files |  Unknown |  Unknown |  Unknown |  Unknown |                |
----------|----------|----------|----------|----------|----------------|

You can find the repo here: http://glow.dev.maio.me/impulse/dashboard/tree/develop/

Do you continue to see the warning about the old version of Jest @robertmain? I couldn't reproduce the issue with your repo and the latest version of the extension. I didn't not appear for me.

Also in your console output, no tests were found running npm run unit because that testPathPattern test/unit/specs doesn't work on Windows. Here's the relevant issue: facebook/jest#3793

Do you continue to see the warning about the old version of Jest @robertmain? I couldn't reproduce the issue with your repo and the latest version of the extension. I didn't not appear for me.

I actually uninstalled the extension when it first started happening because I couldn't make it behave. I re-installed it when I saw your comment so I'd guess that fixed it :)

Also in your console output, no tests were found running npm run unit because that testPathPattern test/unit/specs doesn't work on Windows

Yeah, I've noticed that - I've taken to using npx jest --watch instead

@seanpoulter I'm running into this same issue right now starting a new project with "jest-cli" installed and not "jest". I noticed this originally while using React Boilerplate so that may be a good way for you to reproduce. All you have to do is follow their instructions to download, run the setup, open it in VSC and I'm getting the error. Once I add the normal Jest package the error goes away, but this is a bit counter-intuitive to have both jest-cli and jest packages.

Oh? Thanks for following up @TreTuna. Any chance you've got some time to debug the extension on your machine? The error message is shown in this code method.

@seanpoulter Found where it was checking the path to Jest and added a line (and subsequent test) to check for jest-cli as well. Opened a PR for this. #243

Thanks for figuring that out and contributing @TreTuna!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FDiskas picture FDiskas  路  3Comments

RehanSaeed picture RehanSaeed  路  5Comments

ryanlittle picture ryanlittle  路  3Comments

elderfo picture elderfo  路  4Comments

alloy picture alloy  路  3Comments