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

Updated the ProbotOctokit.defaults() initialization with hotfix #847

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions templates/basic-ts/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import nock from "nock";
// Requiring our app implementation
import myProbotApp from "../src/index.js";
import { Probot, ProbotOctokit } from "probot";
// Requiring the OctokitOptions for ProbotOctokit.defaults()
import {OctokitOptions} from "probot/lib/types";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't use internal entrypoints like this.

TypeScript can infer these types anyways.

In a future major version, these won't be accesssible

// Requiring our fixtures
//import payload from "./fixtures/issues.opened.json" with { "type": "json"};
import fs from "fs";
Expand Down Expand Up @@ -34,10 +36,13 @@ describe("My Probot app", () => {
appId: 123,
privateKey,
// disable request throttling and retries for testing
Octokit: ProbotOctokit.defaults({
retry: { enabled: false },
throttle: { enabled: false },
}),
Octokit: ProbotOctokit.defaults((instanceOptions:OctokitOptions):OctokitOptions => {//Initializing via closure
return {
...instanceOptions,
retry: { enabled: false },
throttle: { enabled: false },
}
})
});
// Load our app into probot
probot.load(myProbotApp);
Expand Down
Loading