#1679·probot

probot.receive webhook for tests does not work when probot app listening to parent level webhook events

Author: asarverCreated Apr 18, 2022Updated Jul 30, 2025

Bug Report

Current Behavior When running a test creating an issues.unlabeled (or issue_comment.created, etc.) event, on code where the probot app is subscribed to the parent event (i.e. issues, or issue_comment), the webhook handler is never evoked

javascript
// Your code here
module.exports = (app) => {
  app.on('issues', async context => {
    app.log.info('yay!')
  })
};

// test code
test('print yay on webhook receive', async () => {
  probot.load(myProbotApp)
  // works on just `name: 'issues'`
  await probot.receive({ name: 'issues.unlabeled', payload })
  // this fails
  expect(logSpy).toHaveBeenCalledWith(expect.objectContaining({ msg: 'yay!' }))
})

Expected behavior/code The probot app listens to all events when subscribed to the issues event webhook, tests should emulate the same

Environment

  • Probot version(s): 11.4.1
  • Node/npm version: 16.13.1
  • OS: OSX 12.3.1