MCPcopy Create free account
hub / github.com/appium/appium / createServer

Function createServer

packages/http-server/test/helpers.ts:7–37  ·  view source on GitHub ↗
(
  driver: T,
  options: {
    extraMethodMap?: MethodMap<T>;
    hostname?: string;
    cliArgs?: Partial<ServerArgs>;
    port?: number;
  } = {},
)

Source from the content-addressed store, hash-verified

5import {server} from '../lib/server.js';
6
7export async function createServer<T extends Driver<Constraints>>(
8 driver: T,
9 options: {
10 extraMethodMap?: MethodMap<T>;
11 hostname?: string;
12 cliArgs?: Partial<ServerArgs>;
13 port?: number;
14 } = {},
15): Promise<{
16 port: number;
17 baseUrl: string;
18 setup: () => Promise<void>;
19 teardown: () => Promise<void>;
20}> {
21 const port = options.port ?? (await getTestPort());
22 const baseUrl = `http://${TEST_HOST}:${port}`;
23 let appiumServer: AppiumServer | undefined;
24 const setup = async () => {
25 appiumServer = await server({
26 routeConfiguringFunction: routeConfiguringFunction(driver),
27 port,
28 extraMethodMap: options.extraMethodMap,
29 hostname: options.hostname,
30 cliArgs: options.cliArgs,
31 });
32 };
33 const teardown = async () => {
34 await appiumServer?.close();
35 };
36 return {port, baseUrl, setup, teardown};
37}

Callers 4

proxy.e2e.spec.tsFile · 0.50
driver.e2e.spec.tsFile · 0.50

Calls 1

getTestPortFunction · 0.90

Tested by

no test coverage detected