danger / danger/danger-js

runDangerSubprocess implementation is incorrect (?)

Open
#603 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.5k
Forks
379
Avg merge
2h 8m
Merged PRs (30d)
6

Description

I encountered an issue, when danger fails on the `validateResults` function (`DangerResults.ts`) although the result is actually correct. It throws `Results passed to Danger JS did not include fails`. The result argument passed here is indeed an empty object, however the result has a correct shape at an earlier point, as it's printed to the console.

I noticed this only happens if I include markdown to the result, and only if the markdown is bigger than a certain size. This makes me think the subprocess stream is not correctly read here: https://github.com/danger/danger-js/blob/master/source/commands/utils/runDangerSubprocess.ts#L38

Because this code assumes the data will arrive in a single chunk (L43), and if it's not a json string (L41), it won't process the data ever.

Am I thinking right?

Contributor guide

Open the contributing guide

Research direction

Start in source/commands/utils/runDangerSubprocess.ts around the stream handling at lines 38–43, then inspect validateResults in DangerResults.ts. Reproduce the failure with a result containing markdown larger than the observed threshold and compare the subprocess output with the parsed result. Done means correctly shaped results, including large markdown, reach validateResults.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.