Skip to content

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

Open
@bertrand-toca

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions