diff --git a/src/node/cli.ts b/src/node/cli.ts index 2469bedb..c8ca387a 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -529,8 +529,8 @@ export async function readConfigFile(configPath?: string): Promise { * configPath is used as the filename in error messages */ export function parseConfigFile(configFile: string, configPath: string): ConfigArgs { - if (configFile == "") { - return { _: [], config: configPath } + if (!configFile) { + return { _: [], config: configPath } } const config = yaml.safeLoad(configFile, { diff --git a/test/httpserver.ts b/test/httpserver.ts index 570adf13..50f88786 100644 --- a/test/httpserver.ts +++ b/test/httpserver.ts @@ -64,7 +64,7 @@ export class HttpServer { public port(): number { const addr = this.hs.address() - if (addr && typeof addr == "object") { + if (addr && typeof addr === "object") { return addr.port } throw new Error("server not listening or listening on unix socket") diff --git a/test/integration.ts b/test/integration.ts index a4cc7586..6a321cae 100644 --- a/test/integration.ts +++ b/test/integration.ts @@ -1,12 +1,15 @@ -import { createApp } from "../src/node/app" -import { register } from "../src/node/routes" -import { parse, setDefaults, parseConfigFile, DefaultedArgs } from "../src/node/cli" -import * as httpserver from "./httpserver" 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]> { +export async function setup( + argv: string[], + configFile?: string, +): Promise<[express.Application, express.Application, httpserver.HttpServer, DefaultedArgs]> { const cliArgs = parse(argv) - let configArgs = parseConfigFile(configFile || "", "test/integration.ts") + const configArgs = parseConfigFile(configFile || "", "test/integration.ts") const args = await setDefaults(cliArgs, configArgs) const [app, wsApp, server] = await createApp(args) diff --git a/test/proxy.test.ts b/test/proxy.test.ts index defb9916..88948fa1 100644 --- a/test/proxy.test.ts +++ b/test/proxy.test.ts @@ -1,11 +1,11 @@ -import * as integration from "./integration" -import * as httpserver from "./httpserver" -import * as express from "express" import * as assert from "assert" +import * as express from "express" +import * as httpserver from "./httpserver" +import * as integration from "./integration" describe("proxy", () => { let codeServer: httpserver.HttpServer | undefined - let nhooyrDevServer = new httpserver.HttpServer() + const nhooyrDevServer = new httpserver.HttpServer() let proxyPath: string before(async () => { @@ -32,14 +32,14 @@ describe("proxy", () => { }) it("should rewrite the base path", async () => { - ;[,, codeServer,] = await integration.setup(["--auth=none"], "") + ;[, , codeServer] = await integration.setup(["--auth=none"], "") const resp = await codeServer.fetch(proxyPath) assert.equal(resp.status, 200) assert.equal(await resp.json(), "asher is the best") }) it("should not rewrite the base path", async () => { - ;[,,codeServer,] = await integration.setup(["--auth=none", "--proxy-path-passthrough=true"], "") + ;[, , codeServer] = await integration.setup(["--auth=none", "--proxy-path-passthrough=true"], "") const resp = await codeServer.fetch(proxyPath) assert.equal(resp.status, 200) assert.equal(await resp.json(), "joe is the best")