MCPcopy Index your code
hub / github.com/github/docs / isServerHealthy

Function isServerHealthy

script/server-for-jest.js:10–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8export const START_JEST_SERVER = Boolean(JSON.parse(process.env.START_JEST_SERVER || 1))
9
10export async function isServerHealthy() {
11 try {
12 const res = await got.head(`http://localhost:${PORT}/healthz`, { retry: { limit: 0 } })
13 return res.statusCode === 200
14 } catch (err) {
15 // This exception is thrown if you can't even connect.
16 if (err instanceof RequestError) {
17 return false
18 }
19 throw err
20 }
21}
22
23export function killServer() {
24 kill(PORT, 'tcp')

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected