@@ -136,15 +136,6 @@ const itWithMockNpmRegistry = it.extend<{ registry: { address: string; cwd: stri
136136 } ,
137137} )
138138
139- const doesPackageManagerExist = ( packageManager : string ) : boolean => {
140- try {
141- execSync ( `${ packageManager } --version` )
142- return true
143- } catch {
144- return false
145- }
146- }
147-
148139const tests : [ packageManager : string , config : { install : [ cmd : string , args : string [ ] ] ; lockfile : string } ] [ ] = [
149140 [
150141 'npm' ,
@@ -170,29 +161,26 @@ const tests: [packageManager: string, config: { install: [cmd: string, args: str
170161]
171162
172163describe . each ( tests ) ( '%s → installs the cli and runs the help command without error' , ( packageManager , config ) => {
173- itWithMockNpmRegistry . runIf ( doesPackageManagerExist ( packageManager ) ) (
174- 'installs the cli and runs the help command without error' ,
175- async ( { registry } ) => {
176- const cwd = registry . cwd
177- await execa ( ...config . install , {
178- cwd,
179- env : { npm_config_registry : registry . address } ,
180- stdio : debug . enabled ? 'inherit' : 'ignore' ,
181- } )
164+ itWithMockNpmRegistry ( 'installs the cli and runs the help command without error' , async ( { registry } ) => {
165+ const cwd = registry . cwd
166+ await execa ( ...config . install , {
167+ cwd,
168+ env : { npm_config_registry : registry . address } ,
169+ stdio : debug . enabled ? 'inherit' : 'ignore' ,
170+ } )
182171
183- expect (
184- existsSync ( path . join ( cwd , config . lockfile ) ) ,
185- `Generated lock file ${ config . lockfile } does not exist in ${ cwd } ` ,
186- ) . toBe ( true )
172+ expect (
173+ existsSync ( path . join ( cwd , config . lockfile ) ) ,
174+ `Generated lock file ${ config . lockfile } does not exist in ${ cwd } ` ,
175+ ) . toBe ( true )
187176
188- const binary = path . resolve ( path . join ( cwd , `./node_modules/.bin/netlify${ platform ( ) === 'win32' ? '.cmd' : '' } ` ) )
189- const { stdout } = await execa ( binary , [ 'help' ] , { cwd } )
177+ const binary = path . resolve ( path . join ( cwd , `./node_modules/.bin/netlify${ platform ( ) === 'win32' ? '.cmd' : '' } ` ) )
178+ const { stdout } = await execa ( binary , [ 'help' ] , { cwd } )
190179
191- expect ( stdout . trim ( ) , `Help command does not start with 'VERSION':\n\n${ stdout } ` ) . toMatch ( / ^ V E R S I O N / )
192- expect ( stdout , `Help command does not include 'netlify-cli/${ pkg . version } ':\n\n${ stdout } ` ) . toContain (
193- `netlify-cli/${ pkg . version } ` ,
194- )
195- expect ( stdout , `Help command does not include '$ netlify [COMMAND]':\n\n${ stdout } ` ) . toMatch ( '$ netlify [COMMAND]' )
196- } ,
197- )
180+ expect ( stdout . trim ( ) , `Help command does not start with 'VERSION':\n\n${ stdout } ` ) . toMatch ( / ^ V E R S I O N / )
181+ expect ( stdout , `Help command does not include 'netlify-cli/${ pkg . version } ':\n\n${ stdout } ` ) . toContain (
182+ `netlify-cli/${ pkg . version } ` ,
183+ )
184+ expect ( stdout , `Help command does not include '$ netlify [COMMAND]':\n\n${ stdout } ` ) . toMatch ( '$ netlify [COMMAND]' )
185+ } )
198186} )
0 commit comments