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] Dead link in warning when importing Danger JS #1467

Open
bertrand-toca opened this issue Oct 7, 2024 · 1 comment
Open

[BUG] Dead link in warning when importing Danger JS #1467

bertrand-toca opened this issue Oct 7, 2024 · 1 comment
Labels

Comments

@bertrand-toca
Copy link

Describe the bug
When I use an import statement like this:

import { danger } from 'danger';

I get the warning message described here https://github.com/danger/danger-js/blob/491bb0b401148366cbe0e4d2bc9705fea521a647/source/danger.ts#L13C5-L13C66

Hey there, it looks like you're trying to import the danger module. Turns out
that the code you write in a Dangerfile.js is actually a bit of a sneaky hack. 

When running Danger, the import or require for Danger is removed before the code
is evaluated. Instead all of the imports are added to the global runtime, so if
you are importing Danger to use one of it's functions - you should instead just
use the global object for the root DSL elements.

There is a spectrum thread for discussion here:
  - https://spectrum.chat/?t=0a005b56-31ec-4919-9a28-ced623949d4d

That spectrum link doesn't exist anymore.

To Reproduce
Steps to reproduce the behavior:

  1. Add this line in a danger.ts: import { danger } from 'danger';
  2. Run Danger

Expected behavior

Get a warning with a non-dead link, or amend the warning message so the link isn't needed.

Screenshots
If applicable, add screenshots to help explain your problem.

Your Environment

software version
danger.js 12.3.3
node 18.20.4
npm 10.7.0
Operating System MacOS

Additional context
Add any other context about the problem here.

@orta
Copy link
Member

orta commented Oct 18, 2024

#1153 (reply in thread) would make a good replacement

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

No branches or pull requests

2 participants