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.

Wrong line number in console stack trace

See original GitHub issue

Hi,

When an error occurs in a karma test, the line number is always the same number that does not match with the real line number where the error occurs:

Karma version: 0.12.17 Node: v0.10.25

Chrome 36.0.1985 (Mac OS X 10.9.4) Controller: blablaController should do some stuff FAILED
    Expected spy foo.bar to have been called with [ 'foobar' ] but it was never called.
    Error: Expected spy foo.bar to have been called with [ 'foobar' ] but it was never called.
        at null.<anonymous> (/Users/me/workspace/foobar/app/common/foobarCtrl.spec.js:9:6615)

What should we do to get good line number ? On line 9 there is no code at all, its an empty line.

Any suggestion ?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
clakechcommented, Jul 24, 2014

We think this comes from our use of istanbul for code coverage.

istanbul reduce our code base to a file with all the code on one line to be able to check if we execute all the code or not.

if I disable istanbul, it works.

but we should be able to use istanbul with karma and to be able to know on which line of code an error occurs.

regards

0reactions
jdmarshallcommented, Mar 18, 2021

Upgrading karma-coverage fixes this problem.

See also https://www.npmjs.com/package/karma-coverage#dont-minify-instrumenter-output

Read more comments on GitHub >

github_iconTop Results From Across the Web

StackTrace return wrong line number of exception in release ...
This is why default project settings remove line number info, it can't be reliable. Nor are stack traces, methods can disappear wholesale. What ......
Read more >
Wrong exception line number in stack trace in release mode
When I checked line 61, there was no possibility of error at all, only a prototype class was created on line 61. A...
Read more >
An error directs to a wrong line in the ... - Unity Issue Tracker
Resolution Note: Source code line numbers in managed stack traces might be wrong when the Unity editor is compiling code in release mode...
Read more >
449797 – Wrong line numbers in the stack trace - Bugs - Eclipse
I have added option -XnoInline and I see no difference in stacktraces. Lines which correspond to original method names are wrong ( it...
Read more >
Line numbers are incorrect in exception stack trace : KT-8628
In which console exactly are you clicking the link? Line numbers greater than the number of lines in the file are expected behavior...
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