mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
feat(cli) : allow passing PlaywrightServer.startDefault parameters via cli (#12530)
This commit is contained in:
parent
d81330f28f
commit
a2b3d4f570
@ -229,8 +229,11 @@ program
|
||||
program
|
||||
.command('run-server', { hidden: true })
|
||||
.option('--port <port>', 'Server port')
|
||||
.option('--path <path>', 'Endpoint Path', '/')
|
||||
.option('--max-clients <maxClients>', 'Maximum clients')
|
||||
.option('--no-socks-proxy', 'Disable Socks Proxy')
|
||||
.action(function(options) {
|
||||
runServer(options.port ? +options.port : undefined).catch(logErrorAndExit);
|
||||
runServer(options.port ? +options.port : undefined, options.path, options.maxClients ? +options.maxClients : Infinity, options.socksProxy).catch(logErrorAndExit);
|
||||
});
|
||||
|
||||
program
|
||||
|
@ -52,8 +52,8 @@ export function runDriver() {
|
||||
};
|
||||
}
|
||||
|
||||
export async function runServer(port: number | undefined) {
|
||||
const server = await PlaywrightServer.startDefault({ path: '/', maxClients: Infinity });
|
||||
export async function runServer(port: number | undefined, path: string = '/', maxClients: number = Infinity, enableSocksProxy: boolean = true) {
|
||||
const server = await PlaywrightServer.startDefault({ path, maxClients, enableSocksProxy });
|
||||
const wsEndpoint = await server.listen(port);
|
||||
process.on('exit', () => server.close().catch(console.error));
|
||||
console.log('Listening on ' + wsEndpoint); // eslint-disable-line no-console
|
||||
|
Loading…
Reference in New Issue
Block a user