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.

Better stacktrace

See original GitHub issue

I am using your code to implement the unit test in my project, but I have errors when running Karma and the stacktrace makes it impossible to debug what is actually going wrong. Example:

FAILED TESTS:
  MyApp
    ✖ initialises with one possible page
      PhantomJS 2.0.0 (Mac OS X 0.0.0)
    TypeError: undefined is not an object (evaluating 'provider.toString') (line 180)
        at 
        at 
        at forEach ([native code])
        at 
        at 
        at 
        at 
        at 
        at /Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/test/karma/tests.config.js:41:18
        at run (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1217:29)
        at zoneBoundFn (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1194:29)
        at lib$es6$promise$$internal$$tryCatch (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:442:25)
        at lib$es6$promise$$internal$$invokeCallback (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:454:53)
        at lib$es6$promise$$internal$$publish (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:425:53)
        at /Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:97:12
        at run (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1217:29)
        at zoneBoundFn (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1194:29)
        at lib$es6$promise$asap$$flush (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:236:18)
    TypeError: null is not an object (evaluating 'myApp.pages') (line 37)
        at 
        at /Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/test/karma/tests.config.js:41:18
        at run (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1217:29)
        at zoneBoundFn (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1194:29)
        at lib$es6$promise$$internal$$tryCatch (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:442:25)
        at lib$es6$promise$$internal$$invokeCallback (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:454:53)
        at lib$es6$promise$$internal$$publish (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:425:53)
        at /Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:97:12
        at run (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1217:29)
        at zoneBoundFn (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:1194:29)
        at lib$es6$promise$asap$$flush (/Users/groyer/Documents/workspace/helperchoice/helpizr-app-v2/node_modules/zone.js/dist/zone-microtask.js:236:18)

Is there any way to know in which file this line 180 is located? or have the complete stacktrace with no empty lines? thanks

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lathonezcommented, Feb 19, 2016

Hey thanks for reaching out!

I haven’t found a way of getting a better stack trace using PhatomJS2.

Here’s the way I do it:

  1. Change browser to “Chrome” here: https://github.com/lathonez/clicker/blob/master/test/karma.config.js#L94
  2. Change singleRun to false here: https://github.com/lathonez/clicker/blob/master/test/karma.config.js#L108
  3. Rerun the test.

You should see Chrome pops up and runs through all the tests. As we’ve set singleRun to false, Karma should leave Chrome open at the end. On Chrome you should see Jasmine’s home page, with a DEBUG button in the top right hand corner. If you click DEBUG, it’ll open in a new tab and run through the tests again. F12 for dev tools and you should have a proper stack trace.

Incidentally I’ve switched to using Chrome full time personally (instead of PhantomJS2).

Let me know how go.

0reactions
lathonezcommented, Mar 7, 2016

I’ve added watch and debug functionality similar to angular 2 seed: 5fcaaf4. Updated README with instructions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

axios-better-stacktrace - npm
Axios plugin that provides better stack traces for axios errors. Latest version: 2.1.3, last published: 2 months ago.
Read more >
Stack Trace Formatter - Pretty print your exception messages
Using the .NET stack trace formatter, you can pretty print any stack trace and either copy and paste it or download a screenshot...
Read more >
Improve axios stack traces · Issue #2387 - GitHub
I create an Error in a request interceptor, store it on a config property, then use its stack trace in the response interceptor's...
Read more >
Stack Trace Enhancements and Filters - Sentry
Like stack traces, but more and better. Sentry enhances stack traces with all the information you wish they had. Try Sentry For FreeSee...
Read more >
How do I get a better stack trace on Angular errors
Generally Javascript stack traces are more useful. Unfortunately, in a production application you generally turn on minification, ...
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