Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bkeepers
Copy link
Contributor

When running tests that require('probot') with jest --watch, you'll eventually get:

(node:42819) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added. Use emitter.setMaxListeners() to increase limit

To reproduce it, save the following in a file and run it with jest --watch. Hit enter 10 times to re-run the test, and you should see the warning above appear.

// example.test.js
const createProbot = require('probot')

test('MaxListenersExceededWarning', () => {
  createProbot({})
})

This has to do with the way jest reloads code. This PR moves the registering of the unhandledRejection rejection listener to the setup method, which is called by the CLI scripts.

@bkeepers bkeepers requested a review from a team November 21, 2017 03:11
Copy link
Member

@JasonEtco JasonEtco left a comment

Choose a reason for hiding this comment

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

:shipit: 🎈 🤖 🚢

…ction

* origin/master:
  chore: Move index.js into lib/ (#338)
@bkeepers bkeepers merged commit f8abe25 into master Nov 21, 2017
@bkeepers bkeepers deleted the move-unhandled-rejection branch November 21, 2017 03:33
bkeepers added a commit that referenced this pull request Nov 21, 2017
* origin/master:
  fix: Move unhandled rejection listener to cli scripts (#339)
  chore: Move index.js into lib/ (#338)
  Add option to develop Probot on Glitch (#306)
  refactor: absorb github-app
  chore: Setup Appveyor (#334)
  docs: Replace examples with include from website (#327)

# Conflicts:
#	lib/index.js
bkeepers added a commit that referenced this pull request Nov 21, 2017
* origin/master:
  fix: Move unhandled rejection listener to cli scripts (#339)
  chore: Move index.js into lib/ (#338)
  Add option to develop Probot on Glitch (#306)
  refactor: absorb github-app
  chore: Setup Appveyor (#334)
  docs: Replace examples with include from website (#327)

# Conflicts:
#	lib/index.js
bkeepers added a commit that referenced this pull request Nov 24, 2017
* origin/master:
  Fix two 404s to the API docs (#344)
  Add `context.log` to add event context to each log message (#321)
  fix(package): update github to version 12.0.3 (#340)
  chore(packaging): Remove semantic-release from CI (#341)
  refactor: switch ejs for hbs
  fix: Move unhandled rejection listener to cli scripts (#339)
  chore: Move index.js into lib/ (#338)
  Add option to develop Probot on Glitch (#306)
  refactor: absorb github-app
  chore: Setup Appveyor (#334)
  docs: Replace examples with include from website (#327)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants