Upon trying to run my tests, I'm presented with what seems to be the same error from #72, #116. Upon running my tests, I get the error
● Test suite failed to run
TypeError: Cannot read property 'removeListener' of undefined
at PuppeteerEnvironment.teardown (../../node_modules/jest-environment-puppeteer/lib/PuppeteerEnvironment.js:126:22)
Steps to reproduce the behavior:
global-setup.js and global-teardown.jsyarn to install deps then jest to kick off the test suite. Error pops up almost immediately.I expect my tests to run and not get this error.
https://github.com/imjared/jest-puppeteer-issue-repro
## System:
- OS: macOS 10.14.2
- CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
- Memory: 2.22 GB / 16.00 GB
- Shell: 5.3 - /bin/zsh
## Binaries:
- Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
- Yarn: 1.12.3 - /usr/local/bin/yarn
- npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
- Watchman: 4.9.0 - /usr/local/bin/watchman
It seems that you have not added a globalSetup of jest-environment-puppeteer to the global-setup file.
If you don't need globalSetup, don't specify it in jest.config.
This PR may solve the problem
https://github.com/imjared/jest-puppeteer-issue-repro/pull/1
nailed it @xiaoyuhen. Thanks for the oversight there and apologies for the false alarm bug report here!

Can confirm that the changes work as expected. I think my confusion was that I used the examples from the jest-dev-server readme rather than the main package.
Most helpful comment
hi,@imjared
It seems that you have not added a
globalSetupofjest-environment-puppeteerto the global-setup file.If you don't need
globalSetup, don't specify it in jest.config.This PR may solve the problem
https://github.com/imjared/jest-puppeteer-issue-repro/pull/1