mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-04 13:39:52 -06:00
Remove @cypress/get-windows-proxy from CLI (#3898)
This commit is contained in:
committed by
Brian Mann
parent
36627fa68d
commit
cd4156f166
@@ -75,12 +75,6 @@ module.exports = {
|
||||
const overrides = util.getEnvOverrides()
|
||||
const node11WindowsFix = isPlatform('win32')
|
||||
|
||||
const proxySource = util.loadSystemProxySettings()
|
||||
|
||||
if (proxySource) {
|
||||
args.push(`--proxy-source="${proxySource}"`)
|
||||
}
|
||||
|
||||
debug('spawning Cypress with executable: %s', executable)
|
||||
debug('spawn forcing env overrides %o', overrides)
|
||||
debug('spawn args %o %o', args, _.omit(options, 'env'))
|
||||
|
||||
@@ -150,8 +150,6 @@ const start = ({ version, downloadDestination, progress }) => {
|
||||
} }
|
||||
}
|
||||
|
||||
util.loadSystemProxySettings()
|
||||
|
||||
const url = getUrl(version)
|
||||
|
||||
progress.throttle = 100
|
||||
|
||||
@@ -9,7 +9,6 @@ const getos = require('getos')
|
||||
const chalk = require('chalk')
|
||||
const Promise = require('bluebird')
|
||||
const cachedir = require('cachedir')
|
||||
const getWindowsProxy = require('@cypress/get-windows-proxy')
|
||||
const executable = require('executable')
|
||||
const supportsColor = require('supports-color')
|
||||
const isInstalledGlobally = require('is-installed-globally')
|
||||
@@ -89,30 +88,6 @@ const util = {
|
||||
}
|
||||
},
|
||||
|
||||
_getWindowsProxy () {
|
||||
return getWindowsProxy()
|
||||
},
|
||||
|
||||
loadSystemProxySettings () {
|
||||
// load user's OS-specific proxy settings in to environment vars
|
||||
if (!_.isUndefined(process.env.HTTP_PROXY) || !_.isUndefined(process.env.http_proxy)) {
|
||||
// user has set proxy explicitly in environment vars, don't mess with it
|
||||
return
|
||||
}
|
||||
|
||||
if (os.platform() === 'win32') {
|
||||
const proxy = this._getWindowsProxy()
|
||||
|
||||
if (proxy) {
|
||||
// environment variables are the only way to make request lib use NO_PROXY
|
||||
process.env.HTTP_PROXY = process.env.HTTPS_PROXY = proxy.httpProxy
|
||||
process.env.NO_PROXY = process.env.NO_PROXY || proxy.noProxy
|
||||
}
|
||||
|
||||
return 'win32'
|
||||
}
|
||||
},
|
||||
|
||||
isTty (fd) {
|
||||
return tty.isatty(fd)
|
||||
},
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
},
|
||||
"types": "types",
|
||||
"dependencies": {
|
||||
"@cypress/get-windows-proxy": "1.5.4",
|
||||
"@cypress/listr-verbose-renderer": "0.4.1",
|
||||
"@cypress/xvfb": "1.2.4",
|
||||
"bluebird": "3.5.0",
|
||||
|
||||
@@ -133,41 +133,6 @@ describe('lib/exec/spawn', function () {
|
||||
})
|
||||
})
|
||||
|
||||
context('proxy', function () {
|
||||
beforeEach(function () {
|
||||
this.oldEnv = Object.assign({}, process.env)
|
||||
process.env.HTTP_PROXY = process.env.HTTPS_PROXY = process.env.NO_PROXY = undefined
|
||||
})
|
||||
|
||||
it('loads proxy settings from Windows registry', function () {
|
||||
this.spawnedProcess.on.withArgs('close').yieldsAsync(0)
|
||||
os.platform.returns('win32')
|
||||
sinon.stub(util, '_getWindowsProxy').returns({
|
||||
httpProxy: 'http://foo-bar.baz',
|
||||
noProxy: 'a,b,c',
|
||||
})
|
||||
|
||||
return spawn.start([], {})
|
||||
.then(() => {
|
||||
return expect(cp.spawn).to.be.calledWithMatch('/path/to/cypress', [
|
||||
'--cwd',
|
||||
cwd,
|
||||
'--proxy-source="win32"',
|
||||
], {
|
||||
env: {
|
||||
'HTTP_PROXY': 'http://foo-bar.baz',
|
||||
'HTTPS_PROXY': 'http://foo-bar.baz',
|
||||
'NO_PROXY': 'a,b,c',
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
Object.assign(process.env, this.oldEnv)
|
||||
})
|
||||
})
|
||||
|
||||
it('unrefs if options.detached is true', function () {
|
||||
this.spawnedProcess.on.withArgs('close').yieldsAsync(0)
|
||||
|
||||
|
||||
@@ -203,15 +203,4 @@ describe('lib/tasks/download', function () {
|
||||
return snapshot('download status errors 1', normalize(ctx.stdout.toString()))
|
||||
})
|
||||
})
|
||||
|
||||
it('calls loadSystemProxySettings before downloading', function () {
|
||||
sinon.stub(fs, 'ensureDirAsync').rejects({ type: 'FAKE_ERR' })
|
||||
sinon.spy(util, 'loadSystemProxySettings')
|
||||
|
||||
return download.start(this.options)
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
expect(util.loadSystemProxySettings).to.be.calledOnce
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user