--- UPDATE---- I can run the test using command line but can't run the test with Jest Runner extension in VSCode.
------Original Question -----------------
I think I have corrupted my npm modules because I tried to install some more recent version of jest and ts-jest related modules in my project (was hoping to fix some test related problem) but it caused a lot of other problems so I just reverted the package.json
and package.lock.json
.
Now in my test files, it doesn't recognize jest
anymore. Typescript simple shows a bunch of errors complaining it can't find jest
, can't find describe
(which is defined in jest).
I tried to delete the node_modules folder and run npm install
, that didn't help. I cleared npm cache; it didn't help.
Not sure what else I can try.
This is my tsconfig.json
{
"compilerOptions": {
/* Basic Options */
"target": "es6",
"module": "commonjs",
"outDir": "./dist",
"allowJs": true,
"importHelpers": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"sourceMap": true,
/* Strict Type-Checking Options */
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true,
"experimentalDecorators": true,
"types": [
"node",
"jest"
],
"baseUrl":".",
"paths": {
"@/*": [
"src/*"
]
},
},
"include": [
"src/**/*.ts",
"*.ts",
"src/**/*.json"
]
}
Sorry but not sure what else I can share apart from a screenshot in this particular case.
jest
as a type in your tsconfig.json. – Postmillennialismnode_modules
and thennpm install
to recreate if you think it’s corruption. – Anelacetypes/jest
folder in my `node_modules? – Atlantes@
is important. – Anelacenpm upgrade
with appropriate options). Did you follow the steps outlined in the other answer? – Anelace