Coverage Broken: metrics.isEmpty is not a function at tableRow
See original GitHub issuecommand run:
jest --forceExit --verbose --bail --useStderr --runInBand --expand --colors --coverage
output:
Failed to write coverage reports:         ERROR: TypeError: metrics.isEmpty is not a function         STACK: TypeError: metrics.isEmpty is not a function     at tableRow (/Users/qtb9604/bmw/packages/http/node_modules/istanbul-reports/lib/text/index.js:133:27)     at TextReport.onSummary (/Users/qtb9604/bmw/packages/http/node_modules/istanbul-reports/lib/text/index.js:188:15)     at TextReport.onDetail (/Users/qtb9604/bmw/packages/http/node_modules/istanbul-reports/lib/text/index.js:193:17)     at Visitor.(anonymous function) [as onDetail] (/Users/qtb9604/bmw/packages/http/node_modules/istanbul-lib-report/lib/tree.js:34:30)     at ReportNode.Node.visit (/Users/qtb9604/bmw/packages/http/node_modules/istanbul-lib-report/lib/tree.js:123:17)     at /Users/qtb9604/bmw/packages/http/node_modules/istanbul-lib-report/lib/tree.js:116:23     at Array.forEach (native)     at visitChildren (/Users/qtb9604/bmw/packages/http/node_modules/istanbul-lib-report/lib/tree.js:115:32)     at ReportNode.Node.visit (/Users/qtb9604/bmw/packages/http/node_modules/istanbul-lib-report/lib/tree.js:126:5)     at /Users/qtb9604/bmw/packages/http/node_modules/istanbul-lib-report/lib/tree.js:116:23
jest --debug yields:
{   "configs": [     {       "automock": false,       "browser": false,       "cache": true,       "cacheDirectory": "/var/folders/t6/0brzsz0s6v5fqttj19rylpn18r1g3z/T/jest_mm3xxb",       "clearMocks": false,       "coveragePathIgnorePatterns": [         "index.ts",         "locales",         "src/controllers",         "src/middleware",         "src/prototypes",         "src/types",         "tests/unit/mocks"       ],       "detectLeaks": false,       "forceCoverageMatch": [],       "globals": {         "ts-jest": {           "tsConfigFile": "tsconfig.json"         }       },       "haste": {         "providesModuleNodeModules": []       },       "moduleDirectories": [         "node_modules"       ],       "moduleFileExtensions": [         "ts",         "js"       ],       "moduleNameMapper": {},       "modulePathIgnorePatterns": [],       "name": "3fa0a9dc4bb9d4586ae003b68f15eda0",       "resetMocks": false,       "resetModules": false,       "restoreMocks": false,       "rootDir": "/Users/qtb9604/vea-server",       "roots": [         "/Users/qtb9604/vea-server"       ],       "runner": "jest-runner",       "setupFiles": [],       "snapshotSerializers": [],       "testEnvironment": "/Users/qtb9604/vea-server/node_modules/jest-environment-node/build/index.js",       "testEnvironmentOptions": {},       "testLocationInResults": false,       "testMatch": [         "**/tests/**/*.test.(ts)"       ],       "testPathIgnorePatterns": [         "/node_modules/"       ],       "testRegex": "",       "testRunner": "/Users/qtb9604/vea-server/node_modules/jest-jasmine2/build/index.js",       "testURL": "about:blank",       "timers": "real",       "transform": [         [           "^.+\\.(ts|tsx)$",           "/Users/qtb9604/vea-server/node_modules/ts-jest/preprocessor.js"         ]       ],       "transformIgnorePatterns": [         "/node_modules/"       ],       "watchPathIgnorePatterns": []     }   ],   "globalConfig": {     "bail": false,     "changedFilesWithAncestor": false,     "collectCoverageFrom": [       "src/**"     ],     "coverageDirectory": "/Users/qtb9604/vea-server/coverage",     "coverageReporters": [       "json",       "text",       "lcov",       "clover"     ],     "detectLeaks": false,     "expand": false,     "globalSetup": null,     "globalTeardown": null,     "listTests": false,     "maxWorkers": 7,     "noStackTrace": false,     "nonFlagArgs": [],     "notify": false,     "notifyMode": "always",     "passWithNoTests": false,     "rootDir": "/Users/qtb9604/vea-server",     "runTestsByPath": false,     "testFailureExitCode": 1,     "testPathPattern": "",     "testResultsProcessor": null,     "updateSnapshot": "new",     "useStderr": false,     "verbose": null,     "watch": false,     "watchman": true   },   "version": "22.4.2" }
Issue Analytics
- State:
 - Created 6 years ago
 - Reactions:5
 - Comments:24 (7 by maintainers)
 

Top Related StackOverflow Question
try
yarn remove jest && yarn add --dev jest(ornpmequivalent) to amke sure all of Jest’s dependencies are updated as wellFWIW, I had to manually delete my
yarn.lockfile to get this working. Much thanks to others in this thread that pointed me in the correct direction 🙏 … I was banging my head around for a while.Things tried with no luck (in no particular order):
22.4.0