简体   繁体   中英

Prevent vscode jest extension interpreting cypress tests as jest tests

I have a create-react-app project with both jest (in ./src/components) and cypress (in ./cypress) tests. I have separate commands in my package.json file to run both test suites, and everything works as expected.

My problem is with the vscode jest extension ( orta.vscode-jest ), which interprets my cypress tests as jest tests and tries to run them.

I solved this by adding a line to my .vscode/settings.json file, telling the vscode jest extension ( orta.vscode-jest ) to use the correct jest command

{
  "jest.pathToJest": "npm run test:jest --"
}

Where the test:jest command is defined in my package.json :

{
  "scripts: {
    "test:jest": "CI=true react-scripts test",
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM