Skip to content

Commit

Permalink
fix: port collisions in createTestContext (#1326)
Browse files Browse the repository at this point in the history
- port workaround allows more performant parallel testing
- testing on CI environments should still utilize Jest’s `—runInBand` flag
  • Loading branch information
haysclark committed Sep 16, 2020
1 parent f0129d2 commit f059254
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/testing/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export async function createTestContext(opts?: CreateTestContextOptions): Promis
await Layout.create({ entrypointPath: opts?.entrypointPath, projectRoot: opts?.projectRoot })
)
const pluginManifests = await PluginWorktime.getUsedPlugins(layout)
const randomPort = await getPort({ port: getPort.makeRange(4000, 6000) })
const randomStartPort = Math.floor(Math.random() * (6000 - 4000)) + 4000
const randomPort = await getPort({ port: getPort.makeRange(randomStartPort, 6000) })
const privateApp = app as PrivateApp

const forcedServerSettings = {
Expand Down

0 comments on commit f059254

Please sign in to comment.