argos-ci/jest-puppeteer

jest-puppeteer does not work properly with Node 18

afternun opened this issue ยท 4 comments

๐Ÿ› Bug Report

A clear and concise description of what the bug is.

We have a setup of E2E tests of React app with puppeteer. After upgrading project from Node 16 to Node 18, jest-puppeteer fails to determine that server is up and running (it reaches launchTimeout). After some digging I found out that library uses wait-on library which seems to have an issue with IPv6 addresses (which are favoured by Node since 17) jeffbski/wait-on#127.

I tried starting only hot server yarn start and using wait-on to see if issue also occurs and it does. Increasing launchTimeout doesn't help, tool simply cannot determine if anything listens on that port.

To Reproduce

Steps to reproduce the behavior:

  1. Checkout repository or setup it on your own (create-react-app + puppeteer):
  2. nvm use 18
  3. yarn
  4. yarn test:e2e

image

Expected behavior

jest-puppeteer recognises that server is running and proceeds with running tests.

Link to repl or repo (highly encouraged)

https://gitlab.com/glayfieldWH/react-tests/-/tree/main/react-test

Run npx envinfo --system --binaries --npmPackages expect-puppeteer,jest-dev-server,jest-environment-puppeteer,jest-puppeteer,spawnd --markdown --clipboard

Paste the results here:

## System:
 - OS: macOS 12.3.1
 - CPU: (10) arm64 Apple M1 Pro
 - Memory: 339.67 MB / 16.00 GB
 - Shell: 5.8 - /bin/zsh
## Binaries:
 - Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
 - Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.1/bin/yarn
 - npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
## npmPackages:
 - jest-puppeteer: ^6.1.1 => 6.1.1 

I tested using wait-port instead of wait-on. This changes waitOnScheme but works for HTTP servers. Haven't tested sockets yet. It would be probably easier and more reliable to fix wait-on...

I'm ok with breaking changes if we need to switch dependencies. We are going to need breaking changes for this package to work with the latest version of puppeteer and jest.

Niek commented

+1

Upgraded and tested, should work now.