node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

Add first integration test #569

Closed protoEvangelion closed 6 years ago

protoEvangelion commented 6 years ago

Following Octokit/rest.js pattern: https://github.com/octokit/rest.js/blob/master/test/integration/pagination-test.js

They have written a very helpful testing package that intercepts requests and provides mock responses: https://github.com/octokit/fixtures

This is useful so we don't have to rely on the GitHub api being up or down.

The downside is the scenarios they have only cover a couple of ways that we are using the GitHub API. They make adding new scenarios a fairly simple process, but one of the options will require opening a new PR on their repo.

The other option, would be to use their https://github.com/octokit/fixtures-server package to generate our own scenarios and store them in our repo. This would add complexity but offer more flexibility.

Here is a good overview on how fixtures work: https://github.com/octokit/fixtures/blob/master/HOW_IT_WORKS.md

Does this seem like a worthwhile path to pursue?

protoEvangelion commented 6 years ago

@jwu910 any thoughts?

jwu910 commented 6 years ago

Is there a way to test w/o needing the testing environment variable?

protoEvangelion commented 6 years ago

Not that I am aware of unless you can think of something else. I have seen NODE_ENV commonly set to development production testing in node projects.

protoEvangelion commented 6 years ago

:tada: This PR is included in version 1.13.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: