mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-03 05:20:38 -05:00
fix: get correct env from npm config (#24664)
* fix: get correct env from npm config `npm config set VAR VAL` will inject `npm_config_var=val` environment variable. This commit will solve this issue Closes: #24556 * Disable commercial recommendations for system tests. * Disable commercial recommendations * Update system-tests/lib/system-tests.ts * Revert changes * Update cli/test/lib/util_spec.js * Update cli/test/lib/util_spec.js Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
This commit is contained in:
@@ -533,6 +533,7 @@ const util = {
|
||||
la(is.unemptyString(varName), 'expected environment variable name, not', varName)
|
||||
|
||||
const configVarName = `npm_config_${varName}`
|
||||
const configVarNameLower = configVarName.toLowerCase()
|
||||
const packageConfigVarName = `npm_package_config_${varName}`
|
||||
|
||||
let result
|
||||
@@ -545,6 +546,10 @@ const util = {
|
||||
debug(`Using ${varName} from npm config`)
|
||||
|
||||
result = process.env[configVarName]
|
||||
} else if (process.env.hasOwnProperty(configVarNameLower)) {
|
||||
debug(`Using ${varName.toLowerCase()} from npm config`)
|
||||
|
||||
result = process.env[configVarNameLower]
|
||||
} else if (process.env.hasOwnProperty(packageConfigVarName)) {
|
||||
debug(`Using ${varName} from package.json config`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user