1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-26 04:14:29 +00:00
code-server-2/test/utils/integration.ts

16 lines
581 B
TypeScript
Raw Normal View History

import { parse, parseConfigFile, setDefaults } from "../../src/node/cli"
import { runCodeServer } from "../../src/node/main"
2021-03-09 23:36:56 +00:00
import * as httpserver from "./httpserver"
export async function setup(argv: string[], configFile?: string): Promise<httpserver.HttpServer> {
argv = ["--bind-addr=localhost:0", "--log=warn", ...argv]
2021-03-09 23:36:56 +00:00
const cliArgs = parse(argv)
const configArgs = parseConfigFile(configFile || "", "test/integration.ts")
const args = await setDefaults(cliArgs, configArgs)
const server = await runCodeServer(args)
2021-03-09 23:36:56 +00:00
return new httpserver.HttpServer(server)
2021-03-09 23:36:56 +00:00
}