ERROR in error TS2688: Cannot find type definition file for 'jest'

Ricardo Rocha

I have an angular 6 application and I'm using karma + jasmine to run my tests. but when I run ng test I'm getting the following error:

ERROR in error TS2688: Cannot find type definition file for 'jest'.

Any one knows how to solve this problem?

Ricardo Rocha

I didn't realized that in my tsconfig.spec.json I was using jest instead of jasmin in types node. Also, I had a missing configuration.

So, I have changed from this:

{
  "extends": "./tsconfig.es5.json",
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "outDir": "../out-tsc/spec",
    "module": "commonjs",
    "target": "es6",
    "baseUrl": "",
    "types": [
      "jest",
      "node"
    ]
  },
  "files": [
    "**/*.spec.ts"
  ]
}

To this:

{
  "extends": "./tsconfig.es5.json",
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "outDir": "../out-tsc/spec",
    "module": "commonjs",
    "types": [
      "jasmine",
      "node"
    ]
  },
  "files": [
    "test.ts",
    "polyfills.ts"
  ],
  "include": [
    "**/*.spec.ts",
    "**/*.d.ts"
  ]
}

And this changes solves my problem.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

error TS2688: Cannot find type definition file for 'dist'

error TS2688: Cannot find type definition file for 'bson'

error TS2688: Cannot find type definition file for 'ioredis'

TypeScript error in undefined(undefined,undefined): Cannot find type definition file for 'src'. TS2688

TS2688: Cannot find type definition file for 'node' with @types/node installed

Using Jest I get: Cannot find type definition file for 'jasmine'

Cannot find type definition file for 'redux-logger' error in tsconfig.json

Compile on heroku node ts- jest types- cannot find type definition

After typescript update 2.3.4 => 2.4.2 i get compilation error "Cannot find type definition file for 'reflect-metadata'."

Cannot find type definition file for 'ramda'

Build:Cannot find type definition file for 'node'

Angular 7: cannot find the type definition file

"Cannot find Symbol" error in Java method definition

error TS2318: Cannot find global type 'Object'

Cannot find type definition file for 'core-js'

Error shallow Jest Enzyme React cannot find "store"

Jest fails with error: Cannot find module 'react/lib/ReactComponentTreeHook'

How do I resolve Jest Mock error "Cannot find module"

TypeScript Definition File Cannot Find .d.ts

NextJS type error: Cannot find name 'NextApplicationPage'

express error - cannot find module - static file

Subprocess The system cannot find the file specified Error

printf \'<a>\' gives error - cannot find the file specified

Cannot find function in google docs file error

Python error: Cannot find the file specified

Cannot find namespace error in typescript context file?

Unity gives "Type or namespace definition, or end-of-file expected" error

c# Error Message - Type Or namespace definition or end of file expected

Downloading file error: Cannot convert type