question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML reporter reports 'Unable to lookup source'

See original GitHub issue

Link to bug demonstration repository

🍫☕️

Expected behavior

I attempted to follow the installation instructions at istanbul.js.org. I expect the HTML report generated by nyc mocha to have working links to view the coverage of each source file.

Observed behavior

https://user-images.githubusercontent.com/107633044/175787832-1a150551-900f-4557-b02d-1ce96f03920e.mov

Unable to lookup source: /Users/jackson/Documents/mocha/src/file:/Users/jackson/Documents/mocha/src/hello.ts (ENOENT: no such file or directory, open '/Users/jackson/Documents/mocha/src/file:/Users/jackson/Documents/mocha/src/hello.ts')
Error: Unable to lookup source: /Users/jackson/Documents/mocha/src/file:/Users/jackson/Documents/mocha/src/hello.ts (ENOENT: no such file or directory, open '/Users/jackson/Documents/mocha/src/file:/Users/jackson/Documents/mocha/src/hello.ts')
    at Context.defaultSourceLookup [as sourceFinder] (/Users/jackson/Documents/mocha/node_modules/istanbul-lib-report/lib/context.js:17:15)
    at Context.getSource (/Users/jackson/Documents/mocha/node_modules/istanbul-lib-report/lib/context.js:71:21)
    at annotateSourceCode (/Users/jackson/Documents/mocha/node_modules/istanbul-reports/lib/html/annotator.js:232:40)
    at HtmlReport.onDetail (/Users/jackson/Documents/mocha/node_modules/istanbul-reports/lib/html/index.js:414:33)
    at Visitor.value (/Users/jackson/Documents/mocha/node_modules/istanbul-lib-report/lib/tree.js:38:38)
    at ReportNode.visit (/Users/jackson/Documents/mocha/node_modules/istanbul-lib-report/lib/tree.js:88:21)
    at /Users/jackson/Documents/mocha/node_modules/istanbul-lib-report/lib/tree.js:92:19
    at Array.forEach ()
    at ReportNode.visit (/Users/jackson/Documents/mocha/node_modules/istanbul-lib-report/lib/tree.js:91:28)
    at ReportTree.visit (/Users/jackson/Documents/mocha/node_modules/istanbul-lib-report/lib/tree.js:127:24)

Troubleshooting steps

Environment information

  System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
    Memory: 272.58 MB / 16.00 GB
  Binaries:
    Node: 18.4.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.12.1 - /opt/homebrew/bin/npm
  npmPackages:
    nyc: ^15.1.0 => 15.1.0
    source-map-support: ^0.5.21 => 0.5.21
    ts-node: ^10.8.1 => 10.8.1
    typescript: ^4.7.4 => 4.7.4

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

7reactions
urska19commented, Jun 27, 2022

I was having the same issue. Downgrading to ts-node: 10.8.0 resolved it for me. Hope it helps.

1reaction
pfedancommented, Jun 28, 2022

@coreyfarrell @bcoe There’s an ongoing discussion about this problem on ts-node’s side: https://github.com/TypeStrong/ts-node/issues/1790

According to them, it might as well be a bug on nyc’s side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nyc says "Unable to lookup source" in reports
I am generating coverage reports using nyc in Node 16. Unable to lookup source: /home/<user>/code/<project>/src/rest/file:/home/<user>/code/< ...
Read more >
Embed a report - Looker Studio Help
Edit the HTML source of the page in which you want to embed the report. Paste the iframe code where you want the...
Read more >
Troubleshooting AWS CodeBuild
Provides troubleshooting information for AWS CodeBuild.
Read more >
pytest-html-reporter
Generates a static html report based on pytest framework.
Read more >
Unable to upload the sonar coverage report for angular ...
6 11:20:40.999 INFO: Default locale: "en", source code encoding: "UTF-8" 11:20:41.000 DEBUG: Work directory: /home/jenkins/workspace/_ci-webapp- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found