Archived
1
0

Refactor integration tests to use main entry point

This commit is contained in:
Asher
2021-05-05 12:20:38 -05:00
parent 20e70cfa05
commit a882be5748
5 changed files with 17 additions and 20 deletions

View File

@ -1,21 +1,15 @@
import * as express from "express"
import { createApp } from "../../src/node/app"
import { parse, setDefaults, parseConfigFile, DefaultedArgs } from "../../src/node/cli"
import { register } from "../../src/node/routes"
import { parse, parseConfigFile, setDefaults } from "../../src/node/cli"
import { runCodeServer } from "../../src/node/main"
import * as httpserver from "./httpserver"
export async function setup(
argv: string[],
configFile?: string,
): Promise<[express.Application, express.Application, httpserver.HttpServer, DefaultedArgs]> {
export async function setup(argv: string[], configFile?: string): Promise<httpserver.HttpServer> {
argv = ["--bind-addr=localhost:0", ...argv]
const cliArgs = parse(argv)
const configArgs = parseConfigFile(configFile || "", "test/integration.ts")
const args = await setDefaults(cliArgs, configArgs)
const [app, wsApp, server] = await createApp(args)
await register(app, wsApp, server, args)
const server = await runCodeServer(args)
return [app, wsApp, new httpserver.HttpServer(server), args]
return new httpserver.HttpServer(server)
}