Skip to content

Commit 3009c41

Browse files
committed
cleanup
1 parent eda98db commit 3009c41

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

index.test.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import {readFileSync, mkdtempSync, readdirSync, mkdirSync} from "node:fs";
55
import {writeFile, readFile, rm} from "node:fs/promises";
66
import {fileURLToPath} from "node:url";
77
import {tmpdir} from "node:os";
8-
import {execPath, versions} from "node:process";
98
import {gzipSync} from "node:zlib";
10-
import type {Server} from "node:http";
119
import {satisfies} from "semver";
1210
import {npmTypes, poetryTypes, uvTypes, goTypes} from "./utils.ts";
1311
import {main} from "./index.ts";
12+
import type {Server} from "node:http";
1413

1514
const testFile = fileURLToPath(new URL("fixtures/npm-test/package.json", import.meta.url));
1615
const emptyFile = fileURLToPath(new URL("fixtures/npm-empty/package.json", import.meta.url));
@@ -24,7 +23,6 @@ const invalidConfigFile = fileURLToPath(new URL("fixtures/invalid-config/package
2423

2524
const testPkg = JSON.parse(readFileSync(testFile, "utf8"));
2625
const testDir = mkdtempSync(join(tmpdir(), "updates-"));
27-
const script = fileURLToPath(new URL("dist/index.js", import.meta.url));
2826

2927
type RouteHandler = (req: any, res: any) => void | Promise<void>;
3028

@@ -206,30 +204,30 @@ async function captureOutput(fn: () => Promise<void>): Promise<{stdout: string,
206204
const originalLog = console.info;
207205
const originalError = console.error;
208206
const originalWarn = console.warn;
209-
207+
210208
let stdout = "";
211209
let stderr = "";
212-
210+
213211
console.info = (...args: any[]) => {
214-
stdout += args.join(" ") + "\n";
212+
stdout += `${args.join(" ")}\n`;
215213
};
216-
214+
217215
console.error = (...args: any[]) => {
218-
stderr += args.join(" ") + "\n";
216+
stderr += `${args.join(" ")}\n`;
219217
};
220-
218+
221219
console.warn = (...args: any[]) => {
222-
stderr += args.join(" ") + "\n";
220+
stderr += `${args.join(" ")}\n`;
223221
};
224-
222+
225223
try {
226224
await fn();
227225
} finally {
228226
console.info = originalLog;
229227
console.error = originalError;
230228
console.warn = originalWarn;
231229
}
232-
230+
233231
return {stdout, stderr};
234232
}
235233

@@ -242,7 +240,7 @@ function makeTest(args: string) {
242240
"--jsrapi", jsrUrl,
243241
"--registry", npmUrl,
244242
];
245-
243+
246244
// Only add default file if none is specified
247245
if (!args.includes("-f") && !args.includes("--file")) {
248246
argsArr.push("-f", join(testDir, "package.json"));

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ export async function main(argv?: Array<string>): Promise<void> {
12191219
if (argv) {
12201220
skipExit = true;
12211221
}
1222-
1222+
12231223
// Parse arguments
12241224
args = parseCliArgs(argv);
12251225

0 commit comments

Comments
 (0)