2024-05-30 03:12:56 -04:00
|
|
|
import { reconfigure } from './hostAdminClient'
|
|
|
|
|
2024-06-25 07:03:05 -04:00
|
|
|
export const STARTUP_TIMEOUT =
|
|
|
|
parseInt(Cypress.env('STARTUP_TIMEOUT'), 10) || 120_000
|
|
|
|
|
2024-05-30 03:12:56 -04:00
|
|
|
let lastConfig: string
|
|
|
|
|
2024-05-30 03:13:40 -04:00
|
|
|
export function startWith({
|
|
|
|
pro = false,
|
|
|
|
version = 'latest',
|
|
|
|
vars = {},
|
|
|
|
varsFn = () => ({}),
|
2024-06-11 07:01:21 -04:00
|
|
|
withDataDir = false,
|
2024-05-30 03:13:40 -04:00
|
|
|
}) {
|
2024-05-30 03:12:56 -04:00
|
|
|
before(async function () {
|
2024-05-30 03:13:40 -04:00
|
|
|
Object.assign(vars, varsFn())
|
2024-06-11 07:01:21 -04:00
|
|
|
const cfg = JSON.stringify({ pro, version, vars, withDataDir })
|
2024-05-30 03:12:56 -04:00
|
|
|
if (lastConfig === cfg) return
|
|
|
|
|
2024-06-25 07:03:05 -04:00
|
|
|
this.timeout(STARTUP_TIMEOUT)
|
2024-06-11 07:01:21 -04:00
|
|
|
await reconfigure({ pro, version, vars, withDataDir })
|
2024-05-30 03:12:56 -04:00
|
|
|
lastConfig = cfg
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export { reconfigure }
|