Skip to content

Commit 9fe41d3

Browse files
Fix formatting
1 parent 78712c9 commit 9fe41d3

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

nodejs/src/acquisition.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
*--------------------------------------------------------------------------------------------*/
44

5-
import { createWriteStream, existsSync, mkdirSync, readdirSync, rmSync, chmodSync, copyFileSync } from "node:fs";
5+
import {
6+
createWriteStream,
7+
existsSync,
8+
mkdirSync,
9+
readdirSync,
10+
rmSync,
11+
chmodSync,
12+
copyFileSync,
13+
} from "node:fs";
614
import { rename, rm } from "node:fs/promises";
715
import { homedir, platform, arch, tmpdir } from "node:os";
816
import { join, dirname, resolve } from "node:path";
@@ -164,7 +172,10 @@ async function downloadCli(
164172
): Promise<string> {
165173
const url = getDownloadUrl(version);
166174
const versionDir = join(downloadDir, `copilot-${version}`);
167-
const tempDir = join(tmpdir(), `copilot-download-${Date.now()}-${Math.random().toString(36).slice(2)}`);
175+
const tempDir = join(
176+
tmpdir(),
177+
`copilot-download-${Date.now()}-${Math.random().toString(36).slice(2)}`
178+
);
168179

169180
mkdirSync(downloadDir, { recursive: true });
170181
mkdirSync(tempDir, { recursive: true });
@@ -173,7 +184,9 @@ async function downloadCli(
173184
const response = await fetch(url, { redirect: "follow" });
174185

175186
if (!response.ok) {
176-
throw new Error(`Failed to download CLI v${version}: ${response.status} ${response.statusText}`);
187+
throw new Error(
188+
`Failed to download CLI v${version}: ${response.status} ${response.statusText}`
189+
);
177190
}
178191

179192
const contentLength = parseInt(response.headers.get("content-length") || "0", 10);
@@ -254,7 +267,10 @@ async function extractArchive(archivePath: string, destDir: string): Promise<voi
254267
proc.on("error", reject);
255268
proc.on("exit", (code) => {
256269
if (code === 0) resolve();
257-
else reject(new Error(`Archive extraction failed for ${archivePath} (exit code ${code})`));
270+
else
271+
reject(
272+
new Error(`Archive extraction failed for ${archivePath} (exit code ${code})`)
273+
);
258274
});
259275
});
260276
}

nodejs/src/client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,15 @@ export class CopilotClient {
155155
}
156156

157157
if (options.cliPath && options.acquisition) {
158-
throw new Error("cliPath is mutually exclusive with acquisition (acquisition auto-determines the CLI path)");
158+
throw new Error(
159+
"cliPath is mutually exclusive with acquisition (acquisition auto-determines the CLI path)"
160+
);
159161
}
160162

161163
if (options.cliUrl && options.acquisition) {
162-
throw new Error("cliUrl is mutually exclusive with acquisition (external server doesn't need local CLI)");
164+
throw new Error(
165+
"cliUrl is mutually exclusive with acquisition (external server doesn't need local CLI)"
166+
);
163167
}
164168

165169
// Validate auth options with external server

nodejs/test/acquisition.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ describe("acquisition", () => {
1212
let testDir: string;
1313

1414
beforeEach(() => {
15-
testDir = join(tmpdir(), `copilot-acquisition-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
15+
testDir = join(
16+
tmpdir(),
17+
`copilot-acquisition-test-${Date.now()}-${Math.random().toString(36).slice(2)}`
18+
);
1619
mkdirSync(testDir, { recursive: true });
1720
});
1821

nodejs/test/e2e/acquisition.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ describe("CLI Acquisition E2E", () => {
1313
let testDir: string;
1414

1515
beforeEach(() => {
16-
testDir = join(tmpdir(), `copilot-acquisition-e2e-${Date.now()}-${Math.random().toString(36).slice(2)}`);
16+
testDir = join(
17+
tmpdir(),
18+
`copilot-acquisition-e2e-${Date.now()}-${Math.random().toString(36).slice(2)}`
19+
);
1720
mkdirSync(testDir, { recursive: true });
1821
});
1922

@@ -47,7 +50,7 @@ describe("CLI Acquisition E2E", () => {
4750

4851
// Verify CLI was downloaded
4952
const entries = readdirSync(testDir);
50-
expect(entries.some(e => e.startsWith("copilot-"))).toBe(true);
53+
expect(entries.some((e) => e.startsWith("copilot-"))).toBe(true);
5154

5255
// Verify progress was reported (at least some bytes downloaded)
5356
expect(progressUpdates.length).toBeGreaterThan(0);
@@ -103,7 +106,9 @@ describe("CLI Acquisition E2E", () => {
103106
logLevel: "error",
104107
});
105108

106-
await expect(client.start()).rejects.toThrow("reserved for the global Copilot CLI installation");
109+
await expect(client.start()).rejects.toThrow(
110+
"reserved for the global Copilot CLI installation"
111+
);
107112
});
108113

109114
it("should clean up old versions after acquisition", async () => {

0 commit comments

Comments
 (0)