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.

It is overly difficult to debug Dangerfiles

See original GitHub issue

Today, I had some mad issues with a Dangerfile. I eventually narrowed it down to the diffForFile crashing on a file that had been removed (that’s another, separate issue).

Problems include cryptic error messages, no line numbers to debug with, and, worst of all, apparently no console.log? Any time I tried to use console.log, it would usually not work.

I’m not really sure why this is the case.

I know it’s a pretty massive departure in architecture, and may have been covered before, but:

What is dangerfile just exported a function with the following signature:

module.exports = function dangerfile({
  danger,
  warn,
  fail,
  message,
  schedule,
  markdown,
}) {

}

Then, danger can just require the dangerfile, and inject in all the things it needs to. That would remove the need to essentially just eval the code, give people more control, allow console.log, and, most importantly, show line numbers in error messages.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
fbarthocommented, Apr 1, 2019

It seems to be working these days. Thoughts on closing this?

1reaction
deecewancommented, May 2, 2018

yeah that’s completely understandable.

is there a simple reason that console.log doesn’t work? That would solve most debugging. Another thing that Fastlane does is tell you the line number your config crashed on, which would be helpful (I’m pretty sure it does a similar eval thing, despite being ruby).

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ - Danger.systems
#Can I use the same Dangerfile across many repos? Ish, it's currently quite complex to set up, but work is on-going on ......
Read more >
Danger bot - GitLab Docs
On startup, Danger reads a Dangerfile from the project root. ... Running and debugging the results of those tools locally is easier if...
Read more >
Want to Automate Code Reviews? Set Up Danger JS for ...
This option allows us to debug dangerfile locally without spamming comments on a real PR. Run the following command in your repository's root...
Read more >
Working with danger JS and integrating it with GitHub
cat /Users/toninichev/Cloud/workspace/nodeJS/Examples/Sparkjs/dangerfile.js. import {danger, warn} from 'danger'. // No PR is too small to ...
Read more >
danger | Yarn - Package Manager
... so it's possible that it could break your Dangerfiles too. How do you know? Roughly, if you have any code that uses...
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