Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Failed to write coverage reports: metrics.isEmpty is not a function. #291

Closed
@panmona

Description

@panmona

Is this a bug report?

Yes.

Can you also reproduce the problem with npm 4.x?

No.

Which terms did you search for in User Guide?

  • istanbul
  • metrics.isEmpty
  • coverage

Environment

  1. npm ls react-scripts-ts (if you haven’t ejected): react-scripts-ts@2.14.0
  2. node -v: v9.10.0
  3. npm -v: 5.8.0
  4. yarn --version (if you use Yarn): 1.3.2
  5. npm ls react-scripts-ts (if you haven’t ejected): react-scripts-ts@2.14.0

Then, specify:

  1. Operating system: macOS Version 10.12 / Windows 10

Steps to Reproduce

  1. Install react-scripts-ts in version 2.14 (no issues in version 2.13)
  2. Run npm run test or yarn test (runs jest with --coverage)

Expected Behavior

The tool writes the coverage report.

Actual Behavior

The tool doesn't write the coverage report.
Stacktrace below:

        Failed to write coverage reports:
        ERROR: TypeError: metrics.isEmpty is not a function
        STACK: TypeError: metrics.isEmpty is not a function
    at tableRow (/UserPath/ts-coverage-error/node_modules/istanbul-reports/lib/text/index.js:133:27)
    at TextReport.onSummary (/UserPath/ts-coverage-error/node_modules/istanbul-reports/lib/text/index.js:188:15)
    at TextReport.onDetail (/UserPath/ts-coverage-error/node_modules/istanbul-reports/lib/text/index.js:193:17)
    at Visitor.(anonymous function) [as onDetail] (/UserPath/ts-coverage-error/node_modules/istanbul-lib-report/lib/tree.js:34:30)
    at ReportNode.Node.visit (/UserPath/ts-coverage-error/node_modules/istanbul-lib-report/lib/tree.js:123:17)
    at /UserPath/ts-coverage-error/node_modules/istanbul-lib-report/lib/tree.js:116:23
    at Array.forEach (<anonymous>)
    at visitChildren (/UserPath/ts-coverage-error/node_modules/istanbul-lib-report/lib/tree.js:115:32)
    at ReportNode.Node.visit (/UserPath/ts-coverage-error/node_modules/istanbul-lib-report/lib/tree.js:126:5)
    at /UserPath/ts-coverage-error/node_modules/istanbul-lib-report/lib/tree.js:116:23

Reproducible Demo

Demo Project

  1. clone the project
  2. run yarn
  3. run yarn test / npm run test

If I delete my node_modules rm -rf node_modules then run npm install and npm test/yarn test it works. (at least on my computer, couldn't reproduce this in my CI.)
And if I downgrade to react-scripts-ts 2.13.0 and re-run yarn + yarn test there's also no metrics.isEmpty is not a function error.

Hope you can reproduce this issue and find out why it happens. I find it really weird!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions