Just wanted to say that it may not work right away.
For example, in VSCode doing Ctrl+Shift+P > TypeScript: Restart TS server helps, as sometimes it fails to recognize jest, or the test file to be a module, etc.
Also, for me, with this guide, I've had my VSCode failing to recognize test and expect functions in *.ts files, showing errors, even though it worked overall with npm run test, passing these 2 tests.
What helped me is to remove test files (here: "**/*.spec.ts") from "exclude" prop in tsconfig.json. Why would you do that in the first place? :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Just wanted to say that it may not work right away.
For example, in VSCode doing
Ctrl+Shift+P
>TypeScript: Restart TS server
helps, as sometimes it fails to recognizejest
, or the test file to be a module, etc.Also, for me, with this guide, I've had my VSCode failing to recognize
test
andexpect
functions in*.ts
files, showing errors, even though it worked overall withnpm run test
, passing these 2 tests.What helped me is to remove test files (here:
"**/*.spec.ts"
) from"exclude"
prop intsconfig.json
. Why would you do that in the first place? :)