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

Probot (Nock) Unit Tests Not Working with Github Enterprise #928

Closed
HenryHoggard opened this issue May 3, 2019 · 8 comments

Comments

@HenryHoggard
Copy link

commented May 3, 2019

Bug Report

Current Behavior

I have set .env GHE_HOST to the enterprise URL.

In test/index.test.js I have updated the nock URLs to the enterprise Git URL.

test('creates a passing check', async () => {
    nock('https://api.enterprisename.com')
      .post('/app/installations/11/access_tokens')
      .reply(200, { token: 'test' })

When I run npm test the application still tries to connect to normal Github.

If I run npm start it works with enterprise Git fine, it just seems to be the unit tests.

09:19:42.726Z ERROR event: request to https://api.github.com/app/installations/180/access_tokens failed, reason: Nock: Disallowed net connect for "api.github.com:443/app/installations/180/access_tokens"

Expected behavior/code

Unit test should work on Enterprise Git.

Environment

  • Probot version(s): 7.5.3
  • Node/npm version: node 8.12 npm 6.4.1
  • OS: OSX 10.14.4

@issue-label-bot issue-label-bot bot added the bug 🐞 label May 3, 2019

@issue-label-bot

This comment has been minimized.

Copy link

commented May 3, 2019

Issue-Label Bot is automatically applying the label bug 🐞 to this issue, with a confidence of 0.96. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@welcome

This comment has been minimized.

Copy link

commented May 3, 2019

Thanks for opening this issue. A contributor should be by to give feedback soon. In the meantime, please check out the contributing guidelines and explore other ways you can get involved.

@gr2m

This comment has been minimized.

Copy link
Contributor

commented May 3, 2019

As far as I know GitHub Enterprise does not have an api. subdomain. Instead, you have to prefix all API paths with /api/v3

@HenryHoggard

This comment has been minimized.

Copy link
Author

commented May 7, 2019

That hasn't worked either. It looks like its ignoring whatever URL i set and always defaulting to the public Github.

@stale

This comment has been minimized.

Copy link

commented Jul 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 6, 2019

@HenryHoggard

This comment has been minimized.

Copy link
Author

commented Jul 6, 2019

Just checking if you have any other information on this.

@stale stale bot removed the wontfix label Jul 6, 2019

@gr2m

This comment has been minimized.

Copy link
Contributor

commented Jul 6, 2019

I have set .env GHE_HOST to the enterprise URL.

What URL did you set GHE_HOST to exactly?

@JohnHandley

This comment has been minimized.

Copy link

commented Jul 23, 2019

Had the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.