{"id":648,"hash":"24122f40c2fb38a71924abca22fdb95830ec0bcaf56e13ac9fe2a823bd317262","pattern":"Cannot find name &#39;describe&#39;. Do you need to install type definitions for a test runner?","full_message":"When using TypeScript in conjunction with Jest, my specs would fail with error messages like:\n\ntest/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`.\ntest/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`.\ntest/unit/some.spec.ts:3:7 - error TS2304: Cannot find name 'expect'.\ntest/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`.\n\nThe types are already installed.\n\nI use:\n\n    \"@types/jest\": \"^23.3.12\",\n    \"jest\": \"^23.6.0\",\n    \"ts-jest\": \"^23.10.5\",\n    \"typescript\": \"^3.1.6\"\n\nI run tests using jest --forceExit --coverage --verbose","ecosystem":"npm","package_name":"typescript","package_version":null,"solution":"After fiddling with the tsconfig.json for a while I finally figured that commenting the \"types\": [], will work.\n\nFailing configuration (before)\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    \"types\": []\n  }\n}\n\nWorking configuration\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    // \"types\": []\n  }\n}","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/54139158/cannot-find-name-describe-do-you-need-to-install-type-definitions-for-a-test","votes":251,"created_at":"2026-04-19T04:51:27.257214+00:00","updated_at":"2026-04-19T04:51:27.257214+00:00"}