Skip to content

Commit

Permalink
feat: including version in CYPRESS_DOWNLOAD_PATH_TEMPLATE (refs #5141 #…
Browse files Browse the repository at this point in the history
…16976 #22864) (#23194)

Co-authored-by: Blue F <blue@cypress.io>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
  • Loading branch information
3 people authored Aug 16, 2022
1 parent 7dd4a14 commit 7489561
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cli/__snapshots__/download_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ exports['desktop url from template'] = `
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`

exports['desktop url from template with version'] = `
https://mycompany/0.20.2/OS-ARCH/cypress.zip
`

exports['desktop url from template with escaped dollar sign'] = `
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`
Expand Down
7 changes: 5 additions & 2 deletions cli/lib/tasks/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const getCA = () => {
})
}

const prepend = (arch, urlPath) => {
const prepend = (arch, urlPath, version) => {
const endpoint = url.resolve(getBaseUrl(), urlPath)
const platform = os.platform()
const pathTemplate = util.getEnv('CYPRESS_DOWNLOAD_PATH_TEMPLATE', true)
Expand All @@ -71,6 +71,7 @@ const prepend = (arch, urlPath) => {
.replace(/\\?\$\{endpoint\}/, endpoint)
.replace(/\\?\$\{platform\}/, platform)
.replace(/\\?\$\{arch\}/, arch)
.replace(/\\?\$\{version\}/, version)
)
: `${endpoint}?platform=${platform}&arch=${arch}`
}
Expand All @@ -82,7 +83,9 @@ const getUrl = (arch, version) => {
return version
}

return version ? prepend(arch, `desktop/${version}`) : prepend(arch, 'desktop')
const urlPath = version ? `desktop/${version}` : 'desktop'

return prepend(arch, urlPath, version)
}

const statusMessage = (err) => {
Expand Down
7 changes: 7 additions & 0 deletions cli/test/lib/tasks/download_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ describe('lib/tasks/download', function () {
snapshot('desktop url from template', normalize(url))
})

it('returns custom url from template with version', () => {
process.env.CYPRESS_DOWNLOAD_PATH_TEMPLATE = 'https://mycompany/${version}/${platform}-${arch}/cypress.zip'
const url = download.getUrl('ARCH', '0.20.2')

snapshot('desktop url from template with version', normalize(url))
})

it('returns custom url from template with escaped dollar sign', () => {
process.env.CYPRESS_DOWNLOAD_PATH_TEMPLATE = '\\${endpoint}/\\${platform}-\\${arch}/cypress.zip'
const url = download.getUrl('ARCH', '0.20.2')
Expand Down

3 comments on commit 7489561

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7489561 Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.6.0/linux-x64/develop-7489561fbfb676a8948eff89730b99bf4d4fc63e/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7489561 Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.6.0/linux-arm64/develop-7489561fbfb676a8948eff89730b99bf4d4fc63e/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7489561 Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.6.0/win32-x64/develop-7489561fbfb676a8948eff89730b99bf4d4fc63e/cypress.tgz

Please sign in to comment.