From 5c06646f5804603ee6ef7104ac858872a3fbda35 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Thu, 14 Jan 2021 10:55:19 -0500 Subject: [PATCH] Formatting and linting fixes --- src/node/cli.ts | 4 ++-- test/httpserver.ts | 2 +- test/integration.ts | 15 +++++++++------ test/proxy.test.ts | 12 ++++++------ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/node/cli.ts b/src/node/cli.ts index 2469bedbf..c8ca387a9 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 570adf13d..50f887863 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 a4cc7586d..6a321cae0 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 defb99166..88948fa10 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")