Archived
1
0

chore: update gitignore with test dirs

This commit is contained in:
Joe Previte
2021-03-09 16:36:56 -07:00
parent aeaf11ced6
commit 9ee2556dd1
4 changed files with 30 additions and 8 deletions

21
test/utils/integration.ts Normal file
View File

@ -0,0 +1,21 @@
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 * as httpserver from "./httpserver"
export async function setup(
argv: string[],
configFile?: string,
): Promise<[express.Application, express.Application, httpserver.HttpServer, DefaultedArgs]> {
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)
return [app, wsApp, new httpserver.HttpServer(server), args]
}