File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import * as removeFolder from 'rimraf';
2222import * as lockfile from 'proper-lockfile' ;
2323import * as browserPaths from '../utils/browserPaths' ;
2424import * as browserFetcher from './browserFetcher' ;
25- import { getFromENV } from '../utils/utils' ;
25+ import { getAsBooleanFromENV } from '../utils/utils' ;
2626
2727const fsMkdirAsync = util . promisify ( fs . mkdir . bind ( fs ) ) ;
2828const fsReaddirAsync = util . promisify ( fs . readdir . bind ( fs ) ) ;
@@ -33,7 +33,7 @@ const fsWriteFileAsync = util.promisify(fs.writeFile.bind(fs));
3333const removeFolderAsync = util . promisify ( removeFolder ) ;
3434
3535export async function installBrowsersWithProgressBar ( packagePath : string ) {
36- if ( getFromENV ( 'PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD' ) ) {
36+ if ( getAsBooleanFromENV ( 'PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD' ) ) {
3737 browserFetcher . logPolitely ( 'Skipping browsers download because `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` env variable is set' ) ;
3838 return false ;
3939 }
Original file line number Diff line number Diff line change @@ -97,9 +97,19 @@ export function isUnderTest(): boolean {
9797
9898export function getFromENV ( name : string ) {
9999 let value = process . env [ name ] ;
100- value = value || process . env [ `npm_config_${ name . toLowerCase ( ) } ` ] ;
101- value = value || process . env [ `npm_package_config_${ name . toLowerCase ( ) } ` ] ;
102- return value ;
100+ if ( value !== undefined )
101+ return value ;
102+ value = process . env [ `npm_config_${ name . toLowerCase ( ) } ` ] ;
103+ if ( value !== undefined )
104+ return value ;
105+ return process . env [ `npm_package_config_${ name . toLowerCase ( ) } ` ] ;
106+ }
107+
108+ export function getAsBooleanFromENV ( name : string ) {
109+ const value = getFromENV ( name ) ;
110+ if ( ! value || value === 'false' || value === '0' )
111+ return false ;
112+ return true ;
103113}
104114
105115export async function mkdirIfNeeded ( filePath : string ) {
You can’t perform that action at this time.
0 commit comments