Skip to content

Commit

Permalink
fix: Add optional regex check for comma preceding 'but' in assertions…
Browse files Browse the repository at this point in the history
… for command formatting (#29517)

* fix: Add optional regex check for comma preceding 'but' in assertions for command formatting

* empty commit

* changelog entry
  • Loading branch information
jennifer-shehane authored May 20, 2024
1 parent 9c11188 commit 297abbb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ _Released 5/21/2024 (PENDING)_
**Bugfixes:**

- Fixed an issue where orphaned Electron processes were inadvertently terminating the browser's CRI client. Fixes [#28397](https://github.com/cypress-io/cypress/issues/28397). Fixed in [#29515](https://github.com/cypress-io/cypress/pull/29515).
- Fixed an issue where Cypress was unable to search in the Specs list for files or folders containing numbers. Fixes [#29034](https://github.com/cypress-io/cypress/issues/29034).
- Fixed an issue where Cypress would use the wrong URL to upload Test Replay recordings when it wasn't able to determine the upload URL. It now displays an error when the upload URL cannot be determined, rather than a "Request Entity Too Large" error. Addressed in [#29512](https://github.com/cypress-io/cypress/pull/29512).
- Fixed an issue where Cypress was unable to search in the Specs list for files or folders containing numbers. Fixes [#29034](https://github.com/cypress-io/cypress/issues/29034).
- Fixed the display of some command assertions. Fixed in [#29517](https://github.com/cypress-io/cypress/pull/29517).

**Dependency Updates:**

Expand Down
7 changes: 7 additions & 0 deletions packages/reporter/cypress/e2e/unit/formatted_message.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ describe('formattedMessage', () => {
expect(result).to.equal('expected <strong>span</strong> to have CSS property <strong>background-color</strong> with the value <strong>rgb(0, 0, 0)</strong>, but the value was <strong>rgba(0, 0, 0, 0)</strong>')
})

it('bolds asterisks with "but" without comma', () => {
const specialMessage = 'expected **foo** to have length above **1** but got **0**'
const result = formattedMessage(specialMessage)

expect(result).to.equal('expected <strong>foo</strong> to have length above <strong>1</strong> but got <strong>0</strong>')
})

it('bolds asterisks with simple assertions', () => {
const specialMessage = 'expected **dom** to be visible'
const result = formattedMessage(specialMessage, 'assert')
Expand Down
3 changes: 2 additions & 1 deletion packages/reporter/src/commands/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ const asterisksRegex = /^\*\*(.+?)\*\*$/gs
// 'expected **<span>** to exist in the DOM'
// `expected **glob*glob** to contain *****`
// `expected **<span>** to have CSS property **background-color** with the value **rgb(0, 0, 0)**, but the value was **rgba(0, 0, 0, 0)**`
// `expected **foo** to have length above **1** but got **0**`
// `Custom message expected **<span>** to exist in the DOM`
const assertionRegex = /^.*?expected | to[^\*]+| not[^\*]+| with[^\*]+|, but[^\*]+/g
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)
Expand Down

5 comments on commit 297abbb

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 297abbb May 20, 2024

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/13.9.1/linux-x64/develop-297abbbd52fd93b326074f914c7ae751f3ee7cb7/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 297abbb May 20, 2024

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/13.9.1/linux-arm64/develop-297abbbd52fd93b326074f914c7ae751f3ee7cb7/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 297abbb May 20, 2024

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/13.9.1/darwin-arm64/develop-297abbbd52fd93b326074f914c7ae751f3ee7cb7/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 297abbb May 20, 2024

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/13.9.1/win32-x64/develop-297abbbd52fd93b326074f914c7ae751f3ee7cb7/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 297abbb May 20, 2024

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/13.9.1/darwin-x64/develop-297abbbd52fd93b326074f914c7ae751f3ee7cb7/cypress.tgz

Please sign in to comment.