mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-03 05:20:38 -05:00
fix(cli): support to unset an env variable with an empty value (#8596)
Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
This commit is contained in:
@@ -481,12 +481,24 @@ describe('util', () => {
|
||||
expect(util.getEnv('CYPRESS_FOO')).to.eql('bar')
|
||||
})
|
||||
|
||||
it('prefers env var over .npmrc config even if it\'s an empty string', () => {
|
||||
process.env.CYPRESS_FOO = ''
|
||||
process.env.npm_config_CYPRESS_FOO = 'baz'
|
||||
expect(util.getEnv('CYPRESS_FOO')).to.eql('')
|
||||
})
|
||||
|
||||
it('prefers .npmrc config over package config', () => {
|
||||
process.env.npm_package_config_CYPRESS_FOO = 'baz'
|
||||
process.env.npm_config_CYPRESS_FOO = 'bloop'
|
||||
expect(util.getEnv('CYPRESS_FOO')).to.eql('bloop')
|
||||
})
|
||||
|
||||
it('prefers .npmrc config over package config even if it\'s an empty string', () => {
|
||||
process.env.npm_package_config_CYPRESS_FOO = 'baz'
|
||||
process.env.npm_config_CYPRESS_FOO = ''
|
||||
expect(util.getEnv('CYPRESS_FOO')).to.eql('')
|
||||
})
|
||||
|
||||
it('throws on non-string name', () => {
|
||||
expect(() => {
|
||||
util.getEnv()
|
||||
|
||||
Reference in New Issue
Block a user