MCPcopy
hub / github.com/vercel/next.js / findPort

Function findPort

test/lib/next-test-utils.ts:259–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257}
258
259export function findPort() {
260 // [NOTE] What are we doing here?
261 // There are some flaky tests failures caused by `No available ports found` from 'get-port'.
262 // This may be related / fixed by upstream https://github.com/sindresorhus/get-port/pull/56,
263 // however it happened after get-port switched to pure esm which is not easy to adapt by bump.
264 // get-port-please seems to offer the feature parity so we'll try to use it, and leave get-port as fallback
265 // for a while until we are certain to switch to get-port-please entirely.
266 try {
267 return getRandomPort()
268 } catch (e) {
269 require('console').warn('get-port-please failed, falling back to get-port')
270 return getPort()
271 }
272}
273
274export interface NextOptions {
275 cwd?: string

Callers 15

index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
gsp-gssp.test.tsFile · 0.90
index.test.tsFile · 0.90
runTestsFunction · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90

Calls 2

requireFunction · 0.50
warnMethod · 0.45

Tested by 15

runTestsFunction · 0.72
getDataFunction · 0.72
devStartAndExportFunction · 0.72
runDevFunction · 0.72
startServerFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
checkMissingFunction · 0.72
runTestsFunction · 0.72
collectStdoutFromDevFunction · 0.72
runTestsFunction · 0.72
startApiServerFunction · 0.72