Skip to content

Commit

Permalink
fix: use host in port check (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpburns authored and gregberge committed Jul 14, 2019
1 parent 78c21b1 commit e419eb2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/jest-dev-server/src/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async function outOfStin(block) {
return result
}

function getIsPortTaken(port) {
function getIsPortTaken(config) {
let server
const cleanupAndReturn = result =>
new Promise(resolve => server.once('close', () => resolve(result)).close())
Expand All @@ -100,7 +100,7 @@ function getIsPortTaken(port) {
err.code === 'EADDRINUSE' ? resolve(cleanupAndReturn(true)) : reject(),
)
.once('listening', () => resolve(cleanupAndReturn(false)))
.listen(port)
.listen(config.port, config.host)
})
}

Expand Down Expand Up @@ -135,7 +135,7 @@ async function setupJestServer(providedConfig, index) {
)
const [portProcess] = await findProcess('port', config.port)
logProcDetection(portProcess, config.port)
killProc(portProcess)
await killProc(portProcess)
},
async ask() {
console.log('')
Expand Down Expand Up @@ -171,7 +171,7 @@ async function setupJestServer(providedConfig, index) {
}

if (config.port) {
const isPortTaken = await getIsPortTaken(config.port)
const isPortTaken = await getIsPortTaken(config)
if (isPortTaken) {
await usedPortHandler()
}
Expand Down

0 comments on commit e419eb2

Please sign in to comment.