Skip to content

Cannot write coverage reports #31

@emman27

Description

@emman27

Hi, I've recently attempted moving to vue-jest from jest-vue-preprocessor. However, it seems like there's an issue with the conversion of .vue files that's blocking the coverage reports.

Here's the stack trace:

Failed to write coverage reports:
        ERROR: TypeError: Cannot read property 'decl' of undefined
        STACK: TypeError: Cannot read property 'decl' of undefined
    at path/node_modules/istanbul-reports/lib/lcovonly/index.js:32:38
    at Array.forEach (<anonymous>)
    at LcovOnlyReport.onDetail (path/node_modules/istanbul-reports/lib/lcovonly/index.js:30:28)
    at LcovReport.(anonymous function) [as onDetail] (path/node_modules/istanbul-reports/lib/lcov/index.js:21:24)
    at Visitor.(anonymous function) [as onDetail] (path/node_modules/istanbul-lib-report/lib/tree.js:34:30)
    at ReportNode.Node.visit (path/node_modules/istanbul-lib-report/lib/tree.js:123:17)
    at path/node_modules/istanbul-lib-report/lib/tree.js:116:23
    at Array.forEach (<anonymous>)
    at visitChildren (path/node_modules/istanbul-lib-report/lib/tree.js:115:32)
    at ReportNode.Node.visit (path/node_modules/istanbul-lib-report/lib/tree.js:126:5)

The reason I'm filing this here is because I have no such issues if I use jest-vue-preprocessor instead. Digging through the istanbul code gives me

var fc = node.getFileCoverage()
console.log(fc)
FileCoverage {
  data: 
   { path: 'unknown',
     statementMap: 
      { '0': [Object],
        '1': [Object],
        '2': [Object],
        '3': [Object],
        '4': [Object],
        '5': [Object],
        '6': [Object] },
     fnMap: {},
     branchMap: {},
     s: 
      { '0': 18,
        '1': 20,
        '2': 18,
        '3': 20,
        '4': 15,
        '5': 13,
        '6': 15,
        '7': NaN,
        '8': NaN,
        '9': NaN,
        '10': NaN,
        '11': NaN,
        '12': NaN,
        '13': NaN,
        '14': NaN,
        '15': NaN,
        '16': NaN,
        '17': NaN,
        '18': NaN,
        '19': NaN,
        '20': NaN,
        '21': NaN,
        '22': NaN,
        '23': NaN,
        '24': NaN,
        '25': NaN,
        '26': NaN,
        '27': NaN },
     f: 
      { '0': NaN,
        '1': NaN,
        '2': NaN,
        '3': NaN,
        '4': NaN,
        '5': NaN,
        '6': NaN,
        '7': NaN,
        '8': NaN,
        '9': NaN,
        '10': NaN,
        '11': NaN },
     b: 
      { '0': [Array],
        '1': [Array],
        '2': [Array],
        '3': [Array],
        '4': [Array],
        '5': [Array],
        '6': [Array],
        '7': [Array],
        '8': [Array],
        '9': [Array],
        '10': [Array],
        '11': [Array],
        '12': [Array],
        '13': [Array] },
     _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c',
     hash: 'd3767ca38b776b618c16aa6dc3fa8c1632bfc5e2' } }

Looks to me like the fnMap object is strangely missing. If I mess with the source code to avoid throwing errors, none of my .vue files have coverage reports on them.

  • jest-vue-preprocessor has no issues reporting coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions