| 257 | } |
| 258 | |
| 259 | export 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 | |
| 274 | export interface NextOptions { |
| 275 | cwd?: string |