jest-puppeteer
jest-puppeteer copied to clipboard
Using createServer.listen() doesn't correctly detect used ports
🐛 Bug Report
getIsPortTaken function doesn't seem to work correctly under macOS.
To Reproduce
Steps to reproduce the behavior:
nc -l localhost 3000to start a minimal server locally- Start
jest-dev-serveron the same port with usedPortAction set to "ask" - It doesn't ask
Expected behavior
It should ask
Link to repl or repo (highly encouraged)
Please provide a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run npx envinfo --system --binaries --npmPackages expect-puppeteer,jest-dev-server,jest-environment-puppeteer,jest-puppeteer,spawnd --markdown --clipboard
Paste the results here:
*** Clipboard option removed - use clipboardy or clipboard-cli directly ***
## System:
- OS: macOS 10.14.6
- CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
- Memory: 1.98 GB / 16.00 GB
- Shell: 5.7.1 - /usr/local/bin/zsh
## Binaries:
- Node: 12.10.0 - /usr/local/bin/node
- Yarn: 1.17.3 - /usr/local/bin/yarn
- npm: 6.11.3 - /usr/local/bin/npm
- Watchman: 4.9.0 - /usr/local/bin/watchman
## npmPackages:
- jest-dev-server: ^4.3.0 => 4.3.0
I'm running into this issue. This bug breaks Jest in VSCode since the local server keeps running and different runs fail all the time.
~Same issue here, this still seems to be broken~
Should be working, be sure that the port config is set to the correct port:
jest-puppeteer.config.js
module.exports = {
server: {
command: `npm start`,
port: 3000, // if set correctly should work
usedPortAction: 'ask'
},
exitOnPageError: false
}
The getIsPortTaken function checks the provided port by trying to start a server on that specific port. Test configured port by adding: console.log('conigured port:', config.port); at node_modules\jest-dev-server\lib\global.js:173 (using jest-puppeteer v4.4.0)
Fixed in #518