From 9b0abdd612d84feba5fd82d51b01c215da3154ad Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Thu, 18 Apr 2024 15:14:26 -0400 Subject: [PATCH 1/6] fix: Update regex for formatting assertion messages to avoid catastrophic backtracking (#29353) * fix: Revert addition of .* into regex and reformat code to escape early before regex runs * Add changelog * fix: Actually fix the problem with the plugin messages * changelog update --- cli/CHANGELOG.md | 4 +++ packages/reporter/src/commands/command.tsx | 32 +++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 6e9d295fcb7c..dea9af7d9472 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -7,6 +7,10 @@ _Released 4/23/2024 (PENDING)_ - Added support for `webpack-dev-server` `v5` to `@cypress/webpack-dev-server`. Addresses [#29305](https://github.com/cypress-io/cypress/issues/29305). +**Bugfixes:** + +- We fixed a regression introduced in [`13.7.3`](https://docs.cypress.io/guides/references/changelog#13-7-3) where Cypress could hang handling long assertion messages. Fixes [#29350](https://github.com/cypress-io/cypress/issues/29350). + **Misc:** - We now capture the [Semaphore](https://semaphoreci.com/) CI provider's environment variable [`SEMAPHORE_GIT_PR_NUMBER`](https://docs.semaphoreci.com/ci-cd-environment/environment-variables/#semaphore_git_pr_number) to display the linked PR number in the Cloud. Addressed in [#29314](https://github.com/cypress-io/cypress/pull/29314). diff --git a/packages/reporter/src/commands/command.tsx b/packages/reporter/src/commands/command.tsx index 36a019cdeb00..76ee5b1d9c9a 100644 --- a/packages/reporter/src/commands/command.tsx +++ b/packages/reporter/src/commands/command.tsx @@ -35,7 +35,8 @@ const asterisksRegex = /^\*\*(.+?)\*\*$/gs // 'expected **** to exist in the DOM' // `expected **glob*glob** to contain *****` // `expected **** to have CSS property **background-color** with the value **rgb(0, 0, 0)**, but the value was **rgba(0, 0, 0, 0)**` -const assertionRegex = /.*expected | to[^\*]+| not[^\*]+| with[^\*]+|, but[^\*]+/g +// `Custom message expected **** to exist in the DOM` +const assertionRegex = /^.*?expected | to[^\*]+| not[^\*]+| with[^\*]+|, but[^\*]+/g // used to format the display of command messages and error messages // we use markdown syntax within our error messages (code ticks, urls, etc) @@ -43,24 +44,28 @@ const assertionRegex = /.*expected | to[^\*]+| not[^\*]+| with[^\*]+|, but[^\*]+ export const formattedMessage = (message: string, name?: string) => { if (!message) return '' + // if the command has url args, don't format those chars like __ and ~~ + if (name === 'visit' || name === 'request' || name === 'origin') { + return message + } + // the command message is formatted as '(Optional Custom Msg:) expected to {assertion} ' const assertionArray = message.match(assertionRegex) - const expectedActualArray = () => { + if (name === 'assert' && assertionArray) { + const expectedActualArray = () => { // get the expected and actual values of assertions - const splitTrim = message.split(assertionRegex).filter(Boolean).map((s) => s.trim()) + const splitTrim = message.split(assertionRegex).filter(Boolean).map((s) => s.trim()) - // replace outside double asterisks with strong tags - return splitTrim.map((s) => { + // replace outside double asterisks with strong tags + return splitTrim.map((s) => { // we want to escape HTML chars so that they display // correctly in the command log:

-> <p> - const HTMLEscapedString = mdOnlyHTML.renderInline(s) - - return HTMLEscapedString.replace(asterisksRegex, `$1`) - }) - } + const HTMLEscapedString = mdOnlyHTML.renderInline(s) - if (name === 'assert' && assertionArray) { + return HTMLEscapedString.replace(asterisksRegex, `$1`) + }) + } // for assertions print the exact text so that characters like _ and * // are not escaped in the assertion display when comparing values const result = assertionArray.flatMap((s, index) => [s, expectedActualArray()[index]]) @@ -68,11 +73,6 @@ export const formattedMessage = (message: string, name?: string) => { return result.join('') } - // if the command has url args, don't format those chars like __ and ~~ - if (name === 'visit' || name === 'request' || name === 'origin') { - return message - } - // format markdown for everything else return md.renderInline(message) } From 32438505506d8a03b191389a7dc56e3ebb2c01ed Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Thu, 18 Apr 2024 15:28:43 -0400 Subject: [PATCH 2/6] chore: release 13.8.0 (#29358) --- cli/CHANGELOG.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index dea9af7d9472..6060983c61af 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,7 +1,7 @@ ## 13.8.0 -_Released 4/23/2024 (PENDING)_ +_Released 4/18/2024_ **Features:** diff --git a/package.json b/package.json index c86fc944d49c..62603e7b4d6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cypress", - "version": "13.7.3", + "version": "13.8.0", "description": "Cypress is a next generation front end testing tool built for the modern web", "private": true, "scripts": { From c040fc46347f0e76229239b72807ae094e0dca7c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 18 Apr 2024 16:32:07 -0400 Subject: [PATCH 3/6] chore: release @cypress/webpack-dev-server-v3.8.0 [skip ci] --- npm/webpack-dev-server/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npm/webpack-dev-server/CHANGELOG.md b/npm/webpack-dev-server/CHANGELOG.md index d99cba5a8b6c..00f957ad2222 100644 --- a/npm/webpack-dev-server/CHANGELOG.md +++ b/npm/webpack-dev-server/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/webpack-dev-server-v3.8.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v3.7.4...@cypress/webpack-dev-server-v3.8.0) (2024-04-18) + + +### Features + +* support webpack-dev-server v5 in @cypress/webpack-dev-server ([#29306](https://github.com/cypress-io/cypress/issues/29306)) ([d7e9d60](https://github.com/cypress-io/cypress/commit/d7e9d6068c6ab01ab58f9959ea7ad6a361087764)) + # [@cypress/webpack-dev-server-v3.7.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v3.7.3...@cypress/webpack-dev-server-v3.7.4) (2024-01-30) From dd80aedcc7beda9c99c2092e25e44353f17b96ff Mon Sep 17 00:00:00 2001 From: Bill Glesias Date: Fri, 19 Apr 2024 10:30:18 -0400 Subject: [PATCH 4/6] chore: clean up changelog (#29365) --- cli/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 6060983c61af..82a432c0b850 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -9,11 +9,11 @@ _Released 4/18/2024_ **Bugfixes:** -- We fixed a regression introduced in [`13.7.3`](https://docs.cypress.io/guides/references/changelog#13-7-3) where Cypress could hang handling long assertion messages. Fixes [#29350](https://github.com/cypress-io/cypress/issues/29350). +- Fixed a regression introduced in [`13.7.3`](https://docs.cypress.io/guides/references/changelog#13-7-3) where Cypress could hang handling long assertion messages. Fixes [#29350](https://github.com/cypress-io/cypress/issues/29350). **Misc:** -- We now capture the [Semaphore](https://semaphoreci.com/) CI provider's environment variable [`SEMAPHORE_GIT_PR_NUMBER`](https://docs.semaphoreci.com/ci-cd-environment/environment-variables/#semaphore_git_pr_number) to display the linked PR number in the Cloud. Addressed in [#29314](https://github.com/cypress-io/cypress/pull/29314). +- The [`SEMAPHORE_GIT_PR_NUMBER`](https://docs.semaphoreci.com/ci-cd-environment/environment-variables/#semaphore_git_pr_number) environment variable from [Semaphore](https://semaphoreci.com/) CI is now captured to display the linked PR number in the Cloud. Addressed in [#29314](https://github.com/cypress-io/cypress/pull/29314). ## 13.7.3 From e007e61b1896cd075b401aed15ef8bc27d0b6231 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 10:30:46 -0400 Subject: [PATCH 5/6] chore: Update v8 snapshot cache (#29360) * chore: updating v8 snapshot cache * chore: updating v8 snapshot cache --------- Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com> --- .../v8-snapshot/cache/darwin/snapshot-meta.json | 16 ++++++++-------- .../v8-snapshot/cache/linux/snapshot-meta.json | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tooling/v8-snapshot/cache/darwin/snapshot-meta.json b/tooling/v8-snapshot/cache/darwin/snapshot-meta.json index 5d239ffde638..9b198432f864 100644 --- a/tooling/v8-snapshot/cache/darwin/snapshot-meta.json +++ b/tooling/v8-snapshot/cache/darwin/snapshot-meta.json @@ -1482,6 +1482,7 @@ "./node_modules/any-base/src/converter.js", "./node_modules/anymatch/index.js", "./node_modules/arg/index.js", + "./node_modules/array-flatten/array-flatten.js", "./node_modules/array-union/index.js", "./node_modules/asn1/lib/ber/errors.js", "./node_modules/asn1/lib/ber/index.js", @@ -1828,7 +1829,6 @@ "./node_modules/express/lib/router/layer.js", "./node_modules/express/lib/utils.js", "./node_modules/express/lib/view.js", - "./node_modules/express/node_modules/array-flatten/array-flatten.js", "./node_modules/express/node_modules/body-parser/lib/read.js", "./node_modules/express/node_modules/body-parser/lib/types/json.js", "./node_modules/express/node_modules/body-parser/lib/types/raw.js", @@ -2317,12 +2317,6 @@ "./node_modules/json5/lib/util.js", "./node_modules/jsonlint/lib/jsonlint.js", "./node_modules/jsprim/lib/jsprim.js", - "./node_modules/launch-editor/editor-info/linux.js", - "./node_modules/launch-editor/editor-info/osx.js", - "./node_modules/launch-editor/editor-info/windows.js", - "./node_modules/launch-editor/get-args.js", - "./node_modules/launch-editor/guess.js", - "./node_modules/launch-editor/index.js", "./node_modules/lazy-ass/index.js", "./node_modules/load-bmfont/index.js", "./node_modules/load-bmfont/lib/is-binary.js", @@ -3739,6 +3733,12 @@ "./packages/data-context/node_modules/fs-extra/lib/util/stat.js", "./packages/data-context/node_modules/fs-extra/lib/util/utimes.js", "./packages/data-context/node_modules/get-stream/index.js", + "./packages/data-context/node_modules/launch-editor/editor-info/linux.js", + "./packages/data-context/node_modules/launch-editor/editor-info/osx.js", + "./packages/data-context/node_modules/launch-editor/editor-info/windows.js", + "./packages/data-context/node_modules/launch-editor/get-args.js", + "./packages/data-context/node_modules/launch-editor/guess.js", + "./packages/data-context/node_modules/launch-editor/index.js", "./packages/data-context/node_modules/micromatch/index.js", "./packages/data-context/node_modules/path-key/index.js", "./packages/data-context/node_modules/prettier/doc.js", @@ -4346,5 +4346,5 @@ "./tooling/v8-snapshot/cache/darwin/snapshot-entry.js" ], "deferredHashFile": "yarn.lock", - "deferredHash": "ce87acfb4746797260125a1a730fce2f773b95daaad4ed37bd765aaf4974de18" + "deferredHash": "5fadac7ce0b5d51a531e13c3ecb4083f1e0bac1f95e58caa21717eb285102252" } \ No newline at end of file diff --git a/tooling/v8-snapshot/cache/linux/snapshot-meta.json b/tooling/v8-snapshot/cache/linux/snapshot-meta.json index 9b598aa26f28..24c891a199df 100644 --- a/tooling/v8-snapshot/cache/linux/snapshot-meta.json +++ b/tooling/v8-snapshot/cache/linux/snapshot-meta.json @@ -1481,6 +1481,7 @@ "./node_modules/any-base/src/converter.js", "./node_modules/anymatch/index.js", "./node_modules/arg/index.js", + "./node_modules/array-flatten/array-flatten.js", "./node_modules/array-union/index.js", "./node_modules/asn1/lib/ber/errors.js", "./node_modules/asn1/lib/ber/index.js", @@ -1827,7 +1828,6 @@ "./node_modules/express/lib/router/layer.js", "./node_modules/express/lib/utils.js", "./node_modules/express/lib/view.js", - "./node_modules/express/node_modules/array-flatten/array-flatten.js", "./node_modules/express/node_modules/body-parser/lib/read.js", "./node_modules/express/node_modules/body-parser/lib/types/json.js", "./node_modules/express/node_modules/body-parser/lib/types/raw.js", @@ -2316,12 +2316,6 @@ "./node_modules/json5/lib/util.js", "./node_modules/jsonlint/lib/jsonlint.js", "./node_modules/jsprim/lib/jsprim.js", - "./node_modules/launch-editor/editor-info/linux.js", - "./node_modules/launch-editor/editor-info/osx.js", - "./node_modules/launch-editor/editor-info/windows.js", - "./node_modules/launch-editor/get-args.js", - "./node_modules/launch-editor/guess.js", - "./node_modules/launch-editor/index.js", "./node_modules/lazy-ass/index.js", "./node_modules/load-bmfont/index.js", "./node_modules/load-bmfont/lib/is-binary.js", @@ -3738,6 +3732,12 @@ "./packages/data-context/node_modules/fs-extra/lib/util/stat.js", "./packages/data-context/node_modules/fs-extra/lib/util/utimes.js", "./packages/data-context/node_modules/get-stream/index.js", + "./packages/data-context/node_modules/launch-editor/editor-info/linux.js", + "./packages/data-context/node_modules/launch-editor/editor-info/osx.js", + "./packages/data-context/node_modules/launch-editor/editor-info/windows.js", + "./packages/data-context/node_modules/launch-editor/get-args.js", + "./packages/data-context/node_modules/launch-editor/guess.js", + "./packages/data-context/node_modules/launch-editor/index.js", "./packages/data-context/node_modules/micromatch/index.js", "./packages/data-context/node_modules/path-key/index.js", "./packages/data-context/node_modules/prettier/doc.js", @@ -4345,5 +4345,5 @@ "./tooling/v8-snapshot/cache/linux/snapshot-entry.js" ], "deferredHashFile": "yarn.lock", - "deferredHash": "ce87acfb4746797260125a1a730fce2f773b95daaad4ed37bd765aaf4974de18" + "deferredHash": "5fadac7ce0b5d51a531e13c3ecb4083f1e0bac1f95e58caa21717eb285102252" } \ No newline at end of file From ca19778e0a446f73687b8c274bb86950830286fc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 10:31:38 -0400 Subject: [PATCH 6/6] chore: Update Chrome (stable) to 124.0.6367.60 and Chrome (beta) to 125.0.6422.4 (#29258) * chore: Update Chrome (stable) to 123.0.6312.105 * chore: Update Chrome (stable) to 123.0.6312.105 and Chrome (beta) to 124.0.6367.29 * chore: Update Chrome (stable) to 123.0.6312.122 and Chrome (beta) to 124.0.6367.29 * chore: Update Chrome (stable) to 123.0.6312.122 and Chrome (beta) to 124.0.6367.49 * chore: Update Chrome (stable) to 123.0.6312.122 and Chrome (beta) to 124.0.6367.60 * chore: Update Chrome (stable) to 124.0.6367.60 and Chrome (beta) to 124.0.6367.60 * chore: Update Chrome (stable) to 124.0.6367.60 and Chrome (beta) to 125.0.6422.4 --------- Co-authored-by: cypress-bot[bot] <41898282+cypress-bot[bot]@users.noreply.github.com> Co-authored-by: Jennifer Shehane --- browser-versions.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser-versions.json b/browser-versions.json index 923740c288f1..7d04494813a1 100644 --- a/browser-versions.json +++ b/browser-versions.json @@ -1,5 +1,5 @@ { - "chrome:beta": "124.0.6367.18", - "chrome:stable": "123.0.6312.86", + "chrome:beta": "125.0.6422.4", + "chrome:stable": "124.0.6367.60", "chrome:minimum": "64.0.3282.0" }