Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: env to use path params in download url #19523

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/__snapshots__/download_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ https://download.cypress.io/desktop?platform=OS&arch=ARCH
exports['specific version desktop url 1'] = `
https://download.cypress.io/desktop/0.20.2?platform=OS&arch=ARCH
`

exports['desktop url with path params'] = `
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`
3 changes: 2 additions & 1 deletion cli/lib/tasks/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ const getCA = () => {
const prepend = (urlPath) => {
const endpoint = url.resolve(getBaseUrl(), urlPath)
const platform = os.platform()
const pathParams = util.getEnv('CYPRESS_DOWNLOAD_PATH_PARAMS')

return `${endpoint}?platform=${platform}&arch=${arch()}`
return pathParams ? `${endpoint}/${platform}-${arch()}/cypress.zip` : `${endpoint}?platform=${platform}&arch=${arch()}`;
}

const getUrl = (version) => {
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 @@ -65,6 +65,13 @@ describe('lib/tasks/download', function () {
snapshot('specific version desktop url 1', normalize(url))
})

it('returns url with path params', () => {
process.env.CYPRESS_DOWNLOAD_PATH_PARAMS = 'true'
const url = download.getUrl('0.20.2')

snapshot('desktop url with path params', normalize(url))
})

it('returns input if it is already an https link', () => {
const url = 'https://somewhere.com'
const result = download.getUrl(url)
Expand Down