question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jest types are not recognized when in subfolder

See original GitHub issue

Environment

  1. node -v: 10.15.3

  2. npm -v: 6.13.4

  3. npm ls jest: 25.1.0

  4. your vscode-jest settings if customized: “jest.pathToJest”: “frontend/node_modules/.bin/jest”, “jest.pathToConfig”: “frontend/jest.config.js”,

  5. Operating system: MacOS Catalina

Prerequisite

  • are you able to run jest test from command line? yes
  • how do you run your tests from command line? yarn test

Relevant Debug Info

so i have a project splitted up in frontend and backend folder the frontend is a typescript with parcel to compile it to js and jest for testing. nothing fancy. the node_modules are also in the frontend folder

The Jest Runner works fine. but when i open the test.file i get this error “Cannot find name ‘test’. Do you need to install type definitions for a test runner? Try npm i @types/jest or npm i @types/mocha.ts(2582)” when i hover over “test” or “expect”

i installed the types. the file is colored red in the filetree.

i create a example repo (https://github.com/maxkarkowski/jest-vscode-test) with the vscode settings folder visible in it

Expected Behavior

vscode should find the types even if they are in a subfodler

Actual Behavior

test files are marked


Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:5

github_iconTop GitHub Comments

2reactions
philipfeldmanncommented, Mar 16, 2020

Facing the same issue. Unit tests itself are working but intellisense isn’t.

Any suggestions?

0reactions
connectdotzcommented, May 4, 2021

Since this is not related to the extension, I will convert it to a discussion instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found