Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in @bcoe/v8-coverage: undefined is not iterable #542

Closed
sebbo2002 opened this issue Aug 26, 2024 · 5 comments
Closed

Bug in @bcoe/v8-coverage: undefined is not iterable #542

sebbo2002 opened this issue Aug 26, 2024 · 5 comments

Comments

@sebbo2002
Copy link

  • Version: v18.20.4 and v20.12.2
  • Platform: Darwin 23.6.0 Kernel Version 23.6.0 / GitHub Runner Ubuntu 22.0.4 LTS

There seems to be a bug in @bcoe/v8-coverage that I am currently struggling with in this repository.
I get the following error at the end of the test:

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at RangeTree.fromSortedRanges (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/range-tree.js:27:39)
    at normalizeFunctionCov (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/normalize.js:74:41)
    at Object.deepNormalizeScriptCov (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/normalize.js:59:9)
    at mergeScriptCovs (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/merge.js:59:21)
    at mergeProcessCovs (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/merge.js:34:21)
    at Report._getMergedProcessCov (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/c8/lib/report.js:336:12)
    at Report.getCoverageMapFromAllCoverageFiles (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/c8/lib/report.js:245:27)
    at Report.run (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/c8/lib/report.js:84:31)
    at exports.outputReport (/home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/c8/lib/commands/report.js:42:16)
    at /home/runner/work/vestaboard2mqtt/vestaboard2mqtt/node_modules/c8/bin/c8.js:30:15

There is already a pull request for this in the forked repository. This pull request solves the problem for me. Would it be possible to merge this patch into @bcoe/v8-coverage and use this new version to fix the bug? Thank you very much.

@sebbo2002 sebbo2002 changed the title TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) Bug in @bcoe/v8-coverage: undefined is not iterable Aug 26, 2024
@cenfun
Copy link
Contributor

cenfun commented Aug 27, 2024

Try c8 --experimental-monocart mocha to see if the error still exists

@sebbo2002
Copy link
Author

After running npm i monocart-coverage-reports@2 --save-dev it works fine, yes.

~/C/vestaboard2mqtt ❯❯❯ npm run coverage

> @sebbo2002/vestaboard2mqtt@1.0.0-test.0 coverage
> c8 mocha



  Cache
    set() / get() / delete()
      ✔ should work

  Calendar
    isSameDay()
      ✔ should work (1)
      ✔ should work (2)

  Message
    write()
      ✔ should start writing from top/left
      ✔ should accept line & row for positioning
      ✔ should add another line if text is too long
      ✔ should work with words > board length
      ✔ should allow to use CURRENT and NEXT line flags
      ✔ should remove unsupported words
    repeat()
      ✔ should work
    word2char()
      ✔ should work
      ✔ should handle german Umlaute
      ✔ should handle color emojis
      ✔ should remove special chars
    centerLines()
      ✔ should work
    center()
      ✔ should work
    isEmpty()
      ✔ should work
    toString()
      ✔ should work with empty board
      ✔ should work with any supported char


  19 passing (22ms)

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at RangeTree.fromSortedRanges (/Users/sebbo/Code/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/range-tree.js:27:39)
    at normalizeFunctionCov (/Users/sebbo/Code/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/normalize.js:74:41)
    at Object.deepNormalizeScriptCov (/Users/sebbo/Code/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/normalize.js:59:9)
    at mergeScriptCovs (/Users/sebbo/Code/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/merge.js:59:21)
    at mergeProcessCovs (/Users/sebbo/Code/vestaboard2mqtt/node_modules/@bcoe/v8-coverage/dist/lib/merge.js:34:21)
    at Report._getMergedProcessCov (/Users/sebbo/Code/vestaboard2mqtt/node_modules/c8/lib/report.js:336:12)
    at Report.getCoverageMapFromAllCoverageFiles (/Users/sebbo/Code/vestaboard2mqtt/node_modules/c8/lib/report.js:245:27)
    at Report.run (/Users/sebbo/Code/vestaboard2mqtt/node_modules/c8/lib/report.js:84:31)
    at exports.outputReport (/Users/sebbo/Code/vestaboard2mqtt/node_modules/c8/lib/commands/report.js:42:16)
    at /Users/sebbo/Code/vestaboard2mqtt/node_modules/c8/bin/c8.js:30:15
~/C/vestaboard2mqtt ❯❯❯ npx c8 --experimental-monocart mocha                                                                                                       ✘ 1 


  Cache
    set() / get() / delete()
      ✔ should work

  Calendar
    isSameDay()
      ✔ should work (1)
      ✔ should work (2)

  Message
    write()
      ✔ should start writing from top/left
      ✔ should accept line & row for positioning
      ✔ should add another line if text is too long
      ✔ should work with words > board length
      ✔ should allow to use CURRENT and NEXT line flags
      ✔ should remove unsupported words
    repeat()
      ✔ should work
    word2char()
      ✔ should work
      ✔ should handle german Umlaute
      ✔ should handle color emojis
      ✔ should remove special chars
    centerLines()
      ✔ should work
    center()
      ✔ should work
    isEmpty()
      ✔ should work
    toString()
      ✔ should work with empty board
      ✔ should work with any supported char


  19 passing (20ms)

--experimental-monocart requires the plugin monocart-coverage-reports. Run: "npm i monocart-coverage-reports@2 --save-dev"
~/C/vestaboard2mqtt ❯❯❯ npm i monocart-coverage-reports@2 --save-dev                                                                                               ✘ 1 

added 8 packages, and changed 3 packages in 2s

173 packages are looking for funding
  run `npm fund` for details
~/C/vestaboard2mqtt ❯❯❯ npx c8 --experimental-monocart mocha


  Cache
    set() / get() / delete()
      ✔ should work

  Calendar
    isSameDay()
      ✔ should work (1)
      ✔ should work (2)

  Message
    write()
      ✔ should start writing from top/left
      ✔ should accept line & row for positioning
      ✔ should add another line if text is too long
      ✔ should work with words > board length
      ✔ should allow to use CURRENT and NEXT line flags
      ✔ should remove unsupported words
    repeat()
      ✔ should work
    word2char()
      ✔ should work
      ✔ should handle german Umlaute
      ✔ should handle color emojis
      ✔ should remove special chars
    centerLines()
      ✔ should work
    center()
      ✔ should work
    isEmpty()
      ✔ should work
    toString()
      ✔ should work with empty board
      ✔ should work with any supported char


  19 passing (21ms)

------------|---------|----------|---------|---------|---------------------------
File        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s         
------------|---------|----------|---------|---------|---------------------------
All files   |   78.51 |    85.58 |   83.33 |   78.57 |                           
 cache.ts   |   58.62 |    62.96 |   83.33 |      68 | 15,35-42,67,84-94,103-113 
 config.ts  |    12.5 |      100 |    12.5 |    12.5 | 30-72                     
 index.ts   |       0 |        0 |       0 |       0 |                           
 message.ts |   91.56 |    92.68 |   97.43 |   90.62 | 94,114,206,244,254,304    
 page.ts    |     100 |      100 |     100 |     100 |                           
------------|---------|----------|---------|---------|---------------------------

=============================== Coverage summary ===============================
Statements   : 78.51% ( 95/121 )
Branches     : 85.58% ( 95/111 )
Functions    : 83.33% ( 50/60 )
Lines        : 78.57% ( 77/98 )
================================================================================
~/C/vestaboard2mqtt ❯❯❯ 

@cenfun
Copy link
Contributor

cenfun commented Aug 28, 2024

BTW, the PR is here

@sebbo2002
Copy link
Author

@cenfun Ah thanks, I hadn't found that one. Then I can close this ticket here, right?

@cenfun
Copy link
Contributor

cenfun commented Aug 28, 2024

Yes, it should be fixed in v8-coverage not c8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@cenfun @sebbo2002 and others