@@ -5,12 +5,11 @@ import {readFileSync, mkdtempSync, readdirSync, mkdirSync} from "node:fs";
55import { writeFile , readFile , rm } from "node:fs/promises" ;
66import { fileURLToPath } from "node:url" ;
77import { tmpdir } from "node:os" ;
8- import { execPath , versions } from "node:process" ;
98import { gzipSync } from "node:zlib" ;
10- import type { Server } from "node:http" ;
119import { satisfies } from "semver" ;
1210import { npmTypes , poetryTypes , uvTypes , goTypes } from "./utils.ts" ;
1311import { main } from "./index.ts" ;
12+ import type { Server } from "node:http" ;
1413
1514const testFile = fileURLToPath ( new URL ( "fixtures/npm-test/package.json" , import . meta. url ) ) ;
1615const 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
2524const testPkg = JSON . parse ( readFileSync ( testFile , "utf8" ) ) ;
2625const testDir = mkdtempSync ( join ( tmpdir ( ) , "updates-" ) ) ;
27- const script = fileURLToPath ( new URL ( "dist/index.js" , import . meta. url ) ) ;
2826
2927type 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" ) ) ;
0 commit comments