Cannot find name 'describe'. Do you need to install type definitions for a test runner?

error ts2304: cannot find name 'svgelementtagnamemap'.
cannot find name typescript
error ts2304: cannot find name
cannot find name 'iterable
cannot find name 'object' in angular 7
cannot find name 'bigint
error ts2304: cannot find name focusoptions
cannot find type definition file for jquery angular

When using TypeScript in conjunction with Jest, my specs would fail with error messages like:

test/unit/some.spec.ts:1:1 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.
test/unit/some.spec.ts:2:3 - error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha`.
test/unit/some.spec.ts:3:7 - error TS2304: Cannot find name 'expect'.
test/unit/some.spec.ts:7:1 - error TS2582: 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`.

The types are already installed.

I use:

    "@types/jest": "^23.3.12",
    "jest": "^23.6.0",
    "ts-jest": "^23.10.5",
    "typescript": "^3.1.6"

I run tests using jest --forceExit --coverage --verbose

I'm using VSCode as my IDE and in my Angular project, I had to comment-out/remove types in tsconfig.json and add jest in types at tsconfig.spec.json.


  "compilerOptions": {
    // "types": []


  "compilerOptions": {
    "types": ["jest", "node"]

Cannot find name '$' in component.ts, In the console First install jQuery. npm install --save jquery. And install jQuery Definition. npm install -D @types/jquery. call your jquery in your  TypeScript 2.x. If you are using TypeScript 2.x you no longer need to have Typings or Definitely Typed installed. Simply install the following package.

After fiddling with the tsconfig.json for a while I finally figured, that commenting the "types": [], will work.

failing config (before)

// tsconfig.json
  "compilerOptions": {
    "types": []

working config

// tsconfig.json
  "compilerOptions": {
    // "types": []

[typescript] Cannot find name 'JQuery' · Issue #96 · testing-library , node_modules/@types/testing-library__cypress/index.d.ts:445:77 - error TS2304: Cannot find name 'JQuery'. Reproduction repository: When runningidor whoamifrom the command line interface (CLI), the Unix username is not returned and the error "cannot find name for user ID"is returned. It is possible that the error, "No such user"could also be seen. -bash-4.1$ id id: cannot find name for user ID 1234567890

TS2304 Cannot find name 'SVGElementTagname' · Issue #43977 , Typescript compile errors compiling the @types/jquery with error TS2304 Cannot find name 'SVGElementTagname' this does not seem to be a  If you’re getting started using Typescript with React and you see this error, it is most likely that you need to change your file extension from .ts to .tsx – For me, when I heard about the .jsx file extension I really didn’t like the idea, but for TypeScript it makes a lot more sense. …

You have to import jest in your test file:

import 'jest';

Another way to solve is adding in your tsconfig.json file:

   "compilerOptions": {
     "types": [ "node", "jest" ],
     "moduleResolution": "node"

node_modules\@types\jquery\index.d.ts(2956,62): error TS2304, ts(2956,62): error TS2304: Cannot find name 'Iterable'. Request: '/temp/manifests.​js' Request: '/node_modules/@microsoft/sp-loader/dist/sp-loader-assembly_en-  Cannot find control with unspecified name attribute Solution: Look for a statement in the HTML angular template like this: [formControl]="myCtrl"

You can have a separate tsconfig.json in the test folder __tests__:

    "extends": "../tsconfig.json",
    "compilerOptions": {
        "baseUrl": "./",
        "outDir": "../build",
        "noEmit": true,
        "rootDir": "../",
    "exclude": ["node_modules"],

which extends the one in the root folder:

  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "./lib",
    "rootDir": "./src",
    "strict": true,
    "noImplicitAny": true,
    "esModuleInterop": true,
  "exclude": ["node_modules", "**/*.test.ts", "__tests__"]

This way you tests files still get excluded from the public build, but still get to share all the common options.

Cannot find name 'WebGL2RenderingContext' - Questions, node_modules/three/src/renderers/webgl/WebGLUtils.d.ts:3:43 - error TS2304: Cannot find name 'WebGL2RenderingContext'. I tried installing  TS2304: Cannot find name 'SetConstructor'. As far as I knew, the issue was indeed related to the recent upgrade I made switching Angular2 beta to Angular2 RC1. I managed to fix that, but it took a fair amount of time due to the lack of documentation almost anywhere.

Typescript getting error TS2304 cannot find name ' require', When we try to get a TypeScript running, we get this error: "TS2304: Cannot find name 'require' " when we attempt to transpile a simple ts node page. The contents  Dismiss Join GitHub today. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

TS2304:Cannot find name '$'. (and also 'toas, Topic: TS2304:Cannot find name '$'. (and also 'toastr'). Takis Koumoutsakos pro asked 4 years ago. 0 0. How can I get rid of this typescript error I get in  There is a work-around mentioned in the changelog for 2.0.0-beta.6 (2016-02-11) (listed under breaking changes):. If you use --target=es5, you will need to add a line somewhere in your application (for example, at the top of the .ts file where you call bootstrap):

[Solved]ts node "error TS2304: Cannot find name" after updating to , TSError: ⨯ Unable to compile TypeScript: src/common/atlas/atlas.constants.ts(3,​27): error TS2304: Cannot find name 'Tile'. src/common/atlas/atlas.constants.ts(6​  Whoami: cannot find name for user id 0. Ask Question Asked 7 years, 4 months ago. Active 1 month ago. Viewed 19k times 8. 1. When I run whoami it says: whoami: cannot

  • I also had to remove "typeRoots" from my tsconfig file, which was apparently overriding "types".
  • Or add jest to types: "types": ["jest"]
  • @Madeo did you add the @types/jest to the dev dependencies in your package.json?
  • Yes, I have added that, plus I have imported them into my test file. I have played with excludes and types, but nothing. Everything runs nicely, just that complaint from the compiler =(
  • Works in 2019 November
  • but this will start copying test files to lib folder which will get deployed
  • What I found is that if I remove , "*/.spec.ts" from the "excluded" property in tsconfig.json, then the red underline in VS Code goes away for "describe" in .spec files, however those files are now output into /lib folder as part of the package. It seems like there is no way to exclude .spec files from the package, but include partially to get 'describe` errors to go away?
  • @Ross just amended my post
  • If you're going to import something, then is better to import the "describe" and "it" functions or whatever you need from jest
  • I used mocha but had the same problem, VSCode was complaining about describe and the other types missing even with .eslintrc overriding env with mocha. Adding a file in my test dir only doing import { describe, before, it } from 'mocha' solved the error in VSCode.