Archived
1
0

Merge branch 'main' into jsjoeio/upgrade-vscode-1.54

This commit is contained in:
Joe Previte
2021-03-17 13:51:27 -07:00
committed by GitHub
31 changed files with 232 additions and 390 deletions

View File

@ -1,5 +1,5 @@
import { Level, logger } from "@coder/logger"
import * as fs from "fs-extra"
import { promises as fs } from "fs"
import * as net from "net"
import * as os from "os"
import * as path from "path"
@ -337,14 +337,14 @@ describe("cli", () => {
const vscodeIpcPath = path.join(os.tmpdir(), "vscode-ipc")
beforeAll(async () => {
await fs.remove(testDir)
await fs.mkdirp(testDir)
await fs.rmdir(testDir, { recursive: true })
await fs.mkdir(testDir, { recursive: true })
})
beforeEach(async () => {
delete process.env.VSCODE_IPC_HOOK_CLI
args = { _: [] }
await fs.remove(vscodeIpcPath)
await fs.rmdir(vscodeIpcPath, { recursive: true })
})
it("should use existing if inside code-server", async () => {
@ -358,7 +358,7 @@ describe("cli", () => {
it("should use existing if --reuse-window is set", async () => {
args["reuse-window"] = true
await expect(await shouldOpenInExistingInstance(args)).toStrictEqual(undefined)
await expect(shouldOpenInExistingInstance(args)).resolves.toStrictEqual(undefined)
await fs.writeFile(vscodeIpcPath, "test")
await expect(shouldOpenInExistingInstance(args)).resolves.toStrictEqual("test")

View File

@ -1,5 +1,5 @@
import { field, logger } from "@coder/logger"
import * as fs from "fs-extra"
import { promises as fs } from "fs"
import * as net from "net"
import * as path from "path"
import * as tls from "tls"
@ -45,14 +45,14 @@ describe("SocketProxyProvider", () => {
beforeAll(async () => {
const cert = await generateCertificate("localhost")
const options = {
cert: fs.readFileSync(cert.cert),
key: fs.readFileSync(cert.certKey),
cert: await fs.readFile(cert.cert),
key: await fs.readFile(cert.certKey),
rejectUnauthorized: false,
}
await fs.mkdirp(path.join(tmpdir, "tests"))
await fs.mkdir(path.join(tmpdir, "tests"), { recursive: true })
const socketPath = await provider.findFreeSocketPath(path.join(tmpdir, "tests/tls-socket-proxy"))
await fs.remove(socketPath)
await fs.rmdir(socketPath, { recursive: true })
return new Promise<void>((_resolve) => {
const resolved: { [key: string]: boolean } = { client: false, server: false }
@ -110,10 +110,10 @@ describe("SocketProxyProvider", () => {
provider.stop() // We don't need more proxies.
proxy.write("server proxy->client")
const dataFromServerToClient = await (await getData(fromServerToClient)).toString()
const dataFromServerToClient = (await getData(fromServerToClient)).toString()
expect(dataFromServerToClient).toBe("server proxy->client")
client.write("client->server proxy")
const dataFromClientToProxy = await (await getData(fromClientToProxy)).toString()
const dataFromClientToProxy = (await getData(fromClientToProxy)).toString()
expect(dataFromClientToProxy).toBe("client->server proxy")
expect(errors).toEqual(0)
})

View File

@ -1,4 +1,4 @@
import * as fs from "fs-extra"
import { promises as fs } from "fs"
import * as http from "http"
import * as path from "path"
import { SettingsProvider, UpdateSettings } from "../../src/node/settings"
@ -53,8 +53,8 @@ describe.skip("update", () => {
host: "localhost",
})
})
await fs.remove(path.join(tmpdir, "tests/updates"))
await fs.mkdirp(path.join(tmpdir, "tests/updates"))
await fs.rmdir(path.join(tmpdir, "tests/updates"), { recursive: true })
await fs.mkdir(path.join(tmpdir, "tests/updates"), { recursive: true })
})
afterAll(() => {