danger / danger-js

⚠️ Stop saying "you forgot to …" in code review
http://danger.systems/js/
MIT License
5.28k stars 368 forks source link

GithubUtils: fileContents throwing error #367

Open bdotdub opened 7 years ago

bdotdub commented 7 years ago

Using the following dangerfile.js (ignore hard coded values ☺️):

"use strict";

schedule(async function() {
  const fileContents = await danger
    .git
    .created_files
    .map(p => danger.github.utils.fileContents(p, "danger/danger-js", "relative_files"))

  console.log(fileContents);
})

And running the command:

$ yarn danger pr https://github.com/danger/danger-js/pull/359

I'm seeing the following error:

TypeError: this.getFileContents is not a function

Been trying to debug but can't quite find the why this would be failing: https://github.com/danger/danger-js/blob/b6348da0eab7935ccbc2c68082ed558fa052c4dc/source/platforms/github/GitHubAPI.ts#L72-L74

I hope it's not my local env (installed it via yarn) and should be easily reproducible with the above.

orta commented 7 years ago

Ergh, it's probably JavaScript and it's unreliable this operator.

orta commented 7 years ago

395 has a new version of this function - should fix this