Skip to content

Commit

Permalink
fix: updated CYPRESS_DOWNLOAD_PATH_TEMPLATE regex to allow multiple r…
Browse files Browse the repository at this point in the history
…eplacements (#25531)
  • Loading branch information
mahdikhashan committed May 5, 2023
1 parent 1d7ae10 commit 63be85f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@ _Released 05/09/2023 (PENDING)_

- Fixed an issue in Electron where devtools gets out of sync with the DOM occasionally. Addresses [#15932](https://github.com/cypress-io/cypress/issues/15932).
- Updated the Chromium renderer process crash message to be more terse. Addressed in [#26597](https://github.com/cypress-io/cypress/pull/26597).
- Fixed an issue with `CYPRESS_DOWNLOAD_PATH_TEMPLATE` regex to allow multiple replacements. Addresses [#23670](https://github.com/cypress-io/cypress/issues/23670).

**Dependency Updates:**

Expand Down
4 changes: 4 additions & 0 deletions cli/__snapshots__/download_spec.js
Expand Up @@ -60,3 +60,7 @@ https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
exports['desktop url from template with escaped dollar sign wrapped in quote'] = `
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`

exports['desktop url from template with multiple replacements'] = `
https://download.cypress.io/desktop/0.20.2/OS/ARCH/cypress-0.20.2-OS-ARCH.zip?referrer=https://download.cypress.io/desktop/0.20.2&version=0.20.2
`
8 changes: 4 additions & 4 deletions cli/lib/tasks/download.js
Expand Up @@ -64,10 +64,10 @@ const prepend = (arch, urlPath, version) => {
return pathTemplate
? (
pathTemplate
.replace(/\\?\$\{endpoint\}/, endpoint)
.replace(/\\?\$\{platform\}/, platform)
.replace(/\\?\$\{arch\}/, arch)
.replace(/\\?\$\{version\}/, version)
.replace(/\\?\$\{endpoint\}/g, endpoint)
.replace(/\\?\$\{platform\}/g, platform)
.replace(/\\?\$\{arch\}/g, arch)
.replace(/\\?\$\{version\}/g, version)
)
: `${endpoint}?platform=${platform}&arch=${arch}`
}
Expand Down
7 changes: 7 additions & 0 deletions cli/test/lib/tasks/download_spec.js
Expand Up @@ -81,6 +81,13 @@ describe('lib/tasks/download', function () {
snapshot('desktop url from template with version', normalize(url))
})

it('returns custom url from template with multiple replacements', () => {
process.env.CYPRESS_DOWNLOAD_PATH_TEMPLATE = '${endpoint}/${platform}/${arch}/cypress-${version}-${platform}-${arch}.zip?referrer=${endpoint}&version=${version}'
const url = download.getUrl('ARCH', '0.20.2')

snapshot('desktop url from template with multiple replacements', 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

5 comments on commit 63be85f

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 63be85f May 5, 2023

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.11.1/linux-arm64/develop-63be85f465209556caa3bb9515af1989f61b5335/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 63be85f May 5, 2023

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.11.1/linux-x64/develop-63be85f465209556caa3bb9515af1989f61b5335/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 63be85f May 5, 2023

Choose a reason for hiding this comment

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

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

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.11.1/darwin-x64/develop-63be85f465209556caa3bb9515af1989f61b5335/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 63be85f May 5, 2023

Choose a reason for hiding this comment

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

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

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.11.1/darwin-arm64/develop-63be85f465209556caa3bb9515af1989f61b5335/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 63be85f May 5, 2023

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.11.1/win32-x64/develop-63be85f465209556caa3bb9515af1989f61b5335/cypress.tgz

Please sign in to comment.