22// Licensed under the MIT license.
33/// <reference types="node" />
44
5- import { execFile } from 'node:child_process' ;
5+ import { exec as execCb } from 'node:child_process' ;
66import * as fs from 'node:fs/promises' ;
77import * as os from 'node:os' ;
88import * as path from 'node:path' ;
99import { fileURLToPath } from 'node:url' ;
1010import { promisify } from 'node:util' ;
1111import { describe , expect , it } from 'vitest' ;
1212
13- const exec = promisify ( execFile ) ;
14- const npmCommand = process . platform === 'win32' ? 'npm.cmd' : 'npm' ;
13+ const exec = promisify ( execCb ) ;
1514const currentFileDir = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
1615const repoRoot = path . resolve ( currentFileDir , '../../..' ) ;
1716
@@ -33,10 +32,14 @@ function normalizePath(filePath: string): string {
3332}
3433
3534async function runNpm ( args : string [ ] ) : Promise < string > {
36- const result = await exec ( npmCommand , args , {
35+ // Use 'npm' with shell so .cmd resolution works on Windows and
36+ // plain 'npm' works on Linux/macOS. Pass args as a single joined string
37+ // to avoid the Node.js v24 DEP0190 deprecation warning about passing
38+ // array args with shell option.
39+ const command = `npm ${ args . join ( ' ' ) } ` ;
40+ const result = await exec ( command , {
3741 cwd : repoRoot ,
3842 timeout : 90_000 ,
39- env : process . env ,
4043 } ) ;
4144
4245 return result . stdout ;
0 commit comments