istanbuljs / nyc

the Istanbul command line interface
https://istanbul.js.org/
ISC License
5.54k stars 353 forks source link

fix: merging two coverage reports for same source file causes crash #1538

Open steoj opened 8 months ago

steoj commented 8 months ago

Link to bug demonstration repository

Expected Behavior

When merging two coverage reports, one merged one should be produced

Observed Behavior

cypress-coverage-final.json jest-coverage-final.json merging these by: npx nyc merge reports (where both json reports are located in reports directory produces: Cannot read properties of undefined (reading 'start')

Troubleshooting steps

Environment Information

  System:
    OS: macOS 13.6.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 563.79 MB / 16.00 GB
  Binaries:
    Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
    Yarn: 1.22.19 - ~/node_modules/.bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
  npmPackages:
    @babel/core: ^7 => 7.23.2 
    @babel/plugin-proposal-private-property-in-object: ^7.21.11 => 7.21.11 
    @babel/plugin-syntax-flow: ^7.22.5 => 7.22.5 
    @babel/plugin-transform-react-jsx: ^7.22.15 => 7.22.15 
    @babel/preset-env: ^7 => 7.23.2 
    @babel/preset-react: ^7.22.15 => 7.22.15 
    @babel/preset-typescript: ^7.23.2 => 7.23.2 
    babel: ^6.23.0 => 6.23.0 
    babel-core: ^6.26.3 => 6.26.3 
    babel-jest: ^29.7.0 => 29.7.0 
    babel-loader: ^9 => 9.1.3 
    babel-plugin-istanbul: ^6.1.1 => 6.1.1 
    babel-plugin-transform-import-meta: ^2.2.1 => 2.2.1 
    istanbul-merge: ^2.0.0 => 2.0.0 
    nyc: ^15.1.0 => 15.1.0 
    typescript: ^5.2.2 => 5.2.2 
    vite-plugin-istanbul: ^5.0.0 => 5.0.0 
pavlo-poimanov commented 4 months ago

Also failing for me. Does anyone has a workaround?