Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using createServer.listen() doesn't correctly detect used ports #281

Closed
zen0wu opened this issue Sep 17, 2019 · 3 comments
Closed

Using createServer.listen() doesn't correctly detect used ports #281

zen0wu opened this issue Sep 17, 2019 · 3 comments

Comments

@zen0wu
Copy link

zen0wu commented Sep 17, 2019

馃悰 Bug Report

getIsPortTaken function doesn't seem to work correctly under macOS.

To Reproduce

Steps to reproduce the behavior:

  1. nc -l localhost 3000 to start a minimal server locally
  2. Start jest-dev-server on the same port with usedPortAction set to "ask"
  3. 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
@domoritz
Copy link

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.

@BitFis
Copy link

BitFis commented Jan 7, 2021

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)

@gregberge
Copy link
Member

Fixed in #518

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants