mirror of
https://github.com/cypress-io/cypress.git
synced 2025-12-30 19:19:53 -06:00
Pass arch when downloading 559 (#562)
* pass arch= when downloading desktop binary, close #559 * unit test url function
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
exports['latest desktop url 1'] = `
|
||||
https://download.cypress.io/desktop?os=OS&arch=ARCH
|
||||
`
|
||||
|
||||
exports['specific version desktop url 1'] = `
|
||||
https://download.cypress.io/desktop/0.20.2?os=OS&arch=ARCH
|
||||
`
|
||||
|
||||
exports['download status errors 1'] = `
|
||||
Error: The Cypress App could not be downloaded.
|
||||
|
||||
Please check network connectivity and try again:
|
||||
----------
|
||||
|
||||
URL: https://download.cypress.io/desktop?os=mac
|
||||
URL: https://download.cypress.io/desktop?os=OS&arch=ARCH
|
||||
404 - Not Found
|
||||
----------
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
exports['errors individual has the following errors 1'] = [
|
||||
'missingXvfb',
|
||||
'missingApp',
|
||||
'missingDependency',
|
||||
'versionMismatch',
|
||||
'unexpected',
|
||||
'failedDownload',
|
||||
'failedUnzip',
|
||||
"missingXvfb",
|
||||
"missingApp",
|
||||
"missingDependency",
|
||||
"versionMismatch",
|
||||
"unexpected",
|
||||
"failedDownload",
|
||||
"failedUnzip"
|
||||
]
|
||||
|
||||
exports['errors .errors.formErrorText returns fully formed text message 1'] = `
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
exports['exec run .processRunOptions passes --browser option 1'] = [
|
||||
'--run-project',
|
||||
"--run-project",
|
||||
null,
|
||||
'--browser',
|
||||
'test browser',
|
||||
"--browser",
|
||||
"test browser"
|
||||
]
|
||||
|
||||
exports['exec run .processRunOptions passes --record option 1'] = [
|
||||
'--run-project',
|
||||
"--run-project",
|
||||
null,
|
||||
'--record',
|
||||
'my record id',
|
||||
"--record",
|
||||
"my record id"
|
||||
]
|
||||
|
||||
exports['exec run .processRunOptions does not remove --record option when using --browser 1'] = [
|
||||
'--run-project',
|
||||
"--run-project",
|
||||
null,
|
||||
'--record',
|
||||
'foo',
|
||||
'--browser',
|
||||
'test browser',
|
||||
"--record",
|
||||
"foo",
|
||||
"--browser",
|
||||
"test browser"
|
||||
]
|
||||
|
||||
@@ -34,7 +34,10 @@ const getOs = () => {
|
||||
}
|
||||
|
||||
const prepend = (urlPath) => {
|
||||
return `${url.resolve(baseUrl, urlPath)}?os=${getOs()}`
|
||||
const endpoint = url.resolve(baseUrl, urlPath)
|
||||
const osName = getOs()
|
||||
const arch = os.arch()
|
||||
return `${endpoint}?os=${osName}&arch=${arch}`
|
||||
}
|
||||
|
||||
const getUrl = (version) => {
|
||||
@@ -154,4 +157,5 @@ const start = (options) => {
|
||||
|
||||
module.exports = {
|
||||
start,
|
||||
getUrl,
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ require('../../spec_helper')
|
||||
const os = require('os')
|
||||
const nock = require('nock')
|
||||
const snapshot = require('snap-shot-it')
|
||||
const la = require('lazy-ass')
|
||||
const is = require('check-more-types')
|
||||
|
||||
const fs = require(`${lib}/fs`)
|
||||
const logger = require(`${lib}/logger`)
|
||||
@@ -33,6 +35,23 @@ describe('download', function () {
|
||||
stdout.restore()
|
||||
})
|
||||
|
||||
context('download url', () => {
|
||||
it('returns url', () => {
|
||||
const url = download.getUrl()
|
||||
la(is.url(url), url)
|
||||
})
|
||||
|
||||
it('returns latest desktop url', () => {
|
||||
const url = download.getUrl()
|
||||
snapshot('latest desktop url', normalize(url))
|
||||
})
|
||||
|
||||
it('returns specific desktop version url', () => {
|
||||
const url = download.getUrl('0.20.2')
|
||||
snapshot('specific version desktop url', normalize(url))
|
||||
})
|
||||
})
|
||||
|
||||
it('sets options.version to response x-version', function () {
|
||||
nock('https://aws.amazon.com')
|
||||
.get('/some.zip')
|
||||
|
||||
@@ -2,6 +2,7 @@ const stripAnsi = require('strip-ansi')
|
||||
|
||||
const excessWhitespaceRe = /(\s{3,})/
|
||||
const datesRe = /(\d+:\d+:\d+)/g
|
||||
const downloadQueryRe = /(\?os=(mac|linux64|win)&arch=(x64|ia32))/
|
||||
|
||||
module.exports = (str) => {
|
||||
// strip dates and ansi codes
|
||||
@@ -10,5 +11,6 @@ module.exports = (str) => {
|
||||
str
|
||||
.replace(datesRe, 'xx:xx:xx')
|
||||
.replace(excessWhitespaceRe, ' ')
|
||||
.replace(downloadQueryRe, '?os=OS&arch=ARCH')
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user