forked from mirrors/probot
fix(probot): passes logger to webhooks (#2011)
This commit is contained in:
parent
dbeda67e4a
commit
93007b63c4
|
@ -6,6 +6,7 @@ import { webhookTransform } from "./octokit-webhooks-transform.js";
|
|||
|
||||
export function getWebhooks(state: State) {
|
||||
const webhooks = new Webhooks({
|
||||
log: state.log,
|
||||
secret: state.webhooks.secret!,
|
||||
transform: (hook) => webhookTransform(state, hook),
|
||||
});
|
||||
|
|
|
@ -642,5 +642,21 @@ describe("Probot", () => {
|
|||
expect((error as Error).message).toMatch(/error from app/);
|
||||
}
|
||||
});
|
||||
|
||||
it("passes logger to webhooks", async () => {
|
||||
const probot = new Probot({
|
||||
appId,
|
||||
privateKey,
|
||||
log: pino(streamLogsToOutput),
|
||||
});
|
||||
|
||||
// @ts-expect-error
|
||||
probot.on("unknown-event", () => {});
|
||||
|
||||
expect(output.length).toEqual(1);
|
||||
expect(output[0].msg).toEqual(
|
||||
'"unknown-event" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue