summaryrefslogtreecommitdiffstats
path: root/benchmarks/wait.js
blob: 771f9f2626cf186759ae9292841866b5de6996ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict'

const os = require('os')
const path = require('path')
const waitOn = require('wait-on')

const socketPath = path.join(os.tmpdir(), 'undici.sock')

let resources
if (process.env.PORT) {
  resources = [`http-get://localhost:${process.env.PORT}/`]
} else {
  resources = [`http-get://unix:${socketPath}:/`]
}

waitOn({
  resources,
  timeout: 5000
}).catch((err) => {
  console.error(err)
  process.exit(1)
})