-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Review app “port detection” checks for Jest
Port detection has now been fixed in `jest-dev-server`: argos-ci/jest-puppeteer#518
- Loading branch information
1 parent
27d62d7
commit afdf8f7
Showing
7 changed files
with
30 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import { teardown } from 'jest-environment-puppeteer' | ||
|
||
import serverStop from '../server/stop.mjs' | ||
|
||
/** | ||
* Close browser | ||
*/ | ||
export default async function browserClose () { | ||
await Promise.all([ | ||
serverStop(), // Stop web server | ||
teardown() // Close browser | ||
]) | ||
export default async function browserOpen () { | ||
await teardown() // Close browser, stop server | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,10 @@ | ||
import { getServers, setup } from 'jest-dev-server' | ||
import waitOn from 'wait-on' | ||
import { setup } from 'jest-dev-server' | ||
|
||
import config from '../../index.js' | ||
|
||
import serverStop from './stop.mjs' | ||
|
||
const PORT = process.env.PORT || config.ports.test | ||
import config from '../../../jest-dev-server.config.js' | ||
|
||
/** | ||
* Start web server | ||
*/ | ||
export default async function serverStart () { | ||
const servers = await getServers() | ||
|
||
// Server start timeout | ||
let timeout = 1000 | ||
|
||
// Server stopping? | ||
if (servers.some(({ signalCode }) => signalCode === 'SIGTERM')) { | ||
await serverStop() // Wait for server to stop | ||
timeout = 0 // No need to wait for start | ||
} | ||
|
||
// Wait until ready check | ||
const ready = ({ timeout = 30000 } = {}) => waitOn({ | ||
resources: [`tcp:${PORT}`], | ||
timeout | ||
}) | ||
|
||
// Wait until ready (or start up) | ||
try { | ||
await ready({ timeout }) | ||
} catch (error) { | ||
await setup({ | ||
// Ensure PORT works (on Windows) + SIGINT/SIGTERM signal events | ||
command: `cross-env-shell PORT=${PORT} node app/start.js`, | ||
port: PORT | ||
}) | ||
await ready() | ||
} | ||
await setup(config) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { ports } = require('./config/index.js') | ||
|
||
/** | ||
* @type {import('jest-dev-server').JestDevServerOptions} | ||
*/ | ||
module.exports = { | ||
command: 'npm start --workspace app', | ||
port: process.env.PORT || ports.test, | ||
|
||
// Skip when already running | ||
usedPortAction: 'ignore' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters