Formatting and linting fixes
This commit is contained in:
parent
60233d0974
commit
5c06646f58
@ -529,7 +529,7 @@ export async function readConfigFile(configPath?: string): Promise<ConfigArgs> {
|
||||
* configPath is used as the filename in error messages
|
||||
*/
|
||||
export function parseConfigFile(configFile: string, configPath: string): ConfigArgs {
|
||||
if (configFile == "") {
|
||||
if (!configFile) {
|
||||
return { _: [], config: configPath }
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user