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

Unexpected behaviour calling diffForFile on added or renamed file #532

Closed
chris48s opened this issue Mar 10, 2018 · 0 comments
Closed

Unexpected behaviour calling diffForFile on added or renamed file #532

chris48s opened this issue Mar 10, 2018 · 0 comments

Comments

@chris48s
Copy link

danger version: 3.1.7

Looking at #369 I think the intended behaviour is that it should be possible to get a diff for a created file, but I am observing different behaviour. Maybe there has been a regression? For example, if I declare the dangerfile:

const { danger, fail, message, warn } = require('danger');

danger.git.diffForFile('dangerfile.flow.js').then(function(diff) {
  message('foo');
});

I observe the following:

$ npm run danger pr "https://github.com/danger/danger-js/pull/518"

> test-app@ danger [path]
> danger "pr" "https://github.com/danger/danger-js/pull/518"

Starting Danger PR on danger/danger-js#518
Error:  { HttpError: {"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/contents/#get-contents"}
    at IncomingMessage.response.on ([path]/request.js:73:18)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'HttpError',
  code: 404,
  status: 'Not Found',
  headers: 
   { [truncated] }

## Failures
node` failed.
## Markdowns
### Log

Danger: Failing the build, there is 1 fail.

Similarly, if I declare the dangerfile:

const { danger, fail, message, warn } = require('danger');

danger.git.diffForFile('source/dsl/cli-args.ts').then(function(diff) {
  message('foo');
});

I observe the following:

$ npm run danger pr "https://github.com/danger/danger-js/pull/518"

> test-app@ danger [path]
> danger "pr" "https://github.com/danger/danger-js/pull/518"

Starting Danger PR on danger/danger-js#518
Error:  { HttpError: {"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/contents/#get-contents"}
    at IncomingMessage.response.on ([path]/request.js:73:18)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'HttpError',
  code: 404,
  status: 'Not Found',
  headers: 
   { [truncated] }

## Failures
node` failed.
## Markdowns
### Log

Danger: Failing the build, there is 1 fail.

If I attempt to get a diff of any of the modified files, for example:

const { danger, fail, message, warn } = require('danger');

danger.git.diffForFile('source/dsl/DangerDSL.ts').then(function(diff) {
  message('foo');
});

then the output is:

$ npm run danger pr "https://github.com/danger/danger-js/pull/518"

> test-app@ danger [path]
> danger "pr" "https://github.com/danger/danger-js/pull/518"

Starting Danger PR on danger/danger-js#518
## Messages
foo
Danger: Passed, found only messages.

as expected.

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

No branches or pull requests

1 participant