I'm starting a web server as part of the test runner initialization. The server picks any free port, so port numbers are not constant over multiple test runs. How can I access the port number in my tests?
My testcafe config
module.exports = {
hooks: {
testRun: {
before: async ctx => {
let appServerPort = await startLocalServer();
// ???
}
}
}
}
A test
test('my test', async (t) => {
await t.expect(true).ok();
}).page(`localhost:${ ??? }`);