Skip to content

Commit

Permalink
Merge branch 'develop' into issue-28374-build-arm-sqlite3
Browse files Browse the repository at this point in the history
  • Loading branch information
jsamuel1 authored Dec 13, 2023
2 parents 0358309 + b71ce44 commit 818d19b
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 30 deletions.
8 changes: 8 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 13.6.2

_Released 12/19/2023 (PENDING)_

**Bugfixes:**

- Fixed a regression in [`12.4.0`](https://docs.cypress.io/guides/references/changelog/12.4.0) where erroneous `<br>` tags were displaying in error messages in the Command Log making them less readable. Fixes [#28452](https://github.com/cypress-io/cypress/issues/28452).

## 13.6.1

_Released 12/5/2023_
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"fs-extra": "9.1.0",
"getenv": "^1.0.0",
"glob": "7.1.6",
"got": "11.8.5",
"got": "11.8.6",
"graphql": "^15.5.1",
"graphql-executor": "0.0.23",
"gulp": "4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {},
"devDependencies": {
"@cypress-design/vue-button": "^0.10.1",
"@cypress-design/vue-button": "^0.10.2",
"@cypress-design/vue-icon": "^0.26.0",
"@cypress-design/vue-statusicon": "^0.5.0",
"@cypress-design/vue-tabs": "^0.5.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/reporter/cypress/e2e/test_errors.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ describe('test errors', () => {
cy.wrap(runner.emit).should('be.calledWith', 'external:open', 'https://on.cypress.io/type')
})

// https://github.com/cypress-io/cypress/issues/28452
it('does not show br tags in formatted error message', () => {
setError(commandErr)

cy.spy(runner, 'emit')

cy.get('.runnable-err-message').find('br').should('not.exist')
})

// NOTE: still needs to be implemented
it.skip('renders and escapes markdown with leading/trailing whitespace', () => {
setError(commandErr)
Expand Down
2 changes: 1 addition & 1 deletion packages/reporter/cypress/fixtures/command_error.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CommandError",
"message": "`foo` \\`bar\\` **baz** *fizz* ** buzz **",
"message": "`foo` \\`bar\\` \n**baz** *fizz* ** buzz **",
"stack": "Some Error\n at foo.bar (my/app.js:2:7)\n at baz.qux (cypress/integration/foo_spec.js:5:2)\n at space (cypress/integration/a b.js:34:99)\n From previous event:\n at bar.baz (my/app.js:8:11)\n ",
"parsedStack": [
{
Expand Down
10 changes: 6 additions & 4 deletions packages/reporter/src/commands/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ import HiddenIcon from '@packages/frontend-shared/src/assets/icons/general-eye-c
import PinIcon from '@packages/frontend-shared/src/assets/icons/object-pin_x16.svg'
import RunningIcon from '@packages/frontend-shared/src/assets/icons/status-running_x16.svg'

const md = new Markdown({ breaks: true })

const displayName = (model: CommandModel) => model.displayName || model.name
const nameClassName = (name: string) => name.replace(/(\s+)/g, '-')

export const formattedMessage = (message: string) => {
const mdBreaks = new Markdown({ breaks: true })
const md = new Markdown()

export const formattedMessage = (message: string, type: string) => {
if (!message) return ''

const searchText = ['to match', 'to equal']
Expand All @@ -38,7 +39,8 @@ export const formattedMessage = (message: string) => {
const matchingText = searchText.find((text) => message.includes(text))
const textToConvert = [split[0].trim(), ...(matchingText ? [matchingText] : [])].join(' ')
const spaceEscapedText = textToConvert.replace(/^ +/gm, (initialSpaces) => '&#32;'.repeat(initialSpaces.length)) // &#32 is the HTML entity for a space
const converted = md.renderInline(spaceEscapedText)
// we don't want <br> in our error messages, but allow it in Cypress.log
const converted = type === 'error' ? md.renderInline(spaceEscapedText) : mdBreaks.renderInline(spaceEscapedText)
const assertion = (split[1] && [`<strong>${split[1].trim()}</strong>`]) || []

return [converted, ...assertion].join(' ')
Expand Down
2 changes: 1 addition & 1 deletion packages/reporter/src/errors/test-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const TestError = (props: TestErrorProps) => {
{groupPlaceholder}
<div className='runnable-err-content'>
<div className='runnable-err-message'>
<span dangerouslySetInnerHTML={{ __html: formattedMessage(err.message) }} />
<span dangerouslySetInnerHTML={{ __html: formattedMessage(err.message, 'error') }} />
<DocsUrl url={err.docsUrl} />
</div>
{codeFrame && <ErrorCodeFrame codeFrame={codeFrame} />}
Expand Down
27 changes: 5 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2306,10 +2306,10 @@
dependencies:
"@cypress-design/css" "^0.15.1"

"@cypress-design/vue-button@^0.10.1":
version "0.10.1"
resolved "https://registry.yarnpkg.com/@cypress-design/vue-button/-/vue-button-0.10.1.tgz#5dd3ca6469aad493c77a45a0d1401da0b8ac4540"
integrity sha512-inzTmkO5Vvw288vdVFKlKUEWJO2g1EvzUMCQMPZ1xZ7wLBl4FtkdEvRBYINiTs+O211FunHuxIjNwRjWkQhOHA==
"@cypress-design/vue-button@^0.10.2":
version "0.10.2"
resolved "https://registry.yarnpkg.com/@cypress-design/vue-button/-/vue-button-0.10.2.tgz#40ca760dc76ed9516a2add4c59f06f3d5da96986"
integrity sha512-PwwdLiY3gT0qqtkfY2NJw02/nu9/U3Cea2RxdCJvq0xgVSag9w5idWe1puh6BzSNlHrjsAgdtuL+WOByGNwHJg==
dependencies:
"@cypress-design/constants-button" "*"

Expand Down Expand Up @@ -16339,24 +16339,7 @@ gopd@^1.0.1:
dependencies:
get-intrinsic "^1.1.3"

[email protected]:
version "11.8.5"
resolved "https://registry.yarnpkg.com/got/-/got-11.8.5.tgz#ce77d045136de56e8f024bebb82ea349bc730046"
integrity sha512-o0Je4NvQObAuZPHLFoRSkdG2lTgtcynqymzg2Vupdx6PorhaT5MCbIyXG6d4D94kk8ZG57QeosgdiqfJWhEhlQ==
dependencies:
"@sindresorhus/is" "^4.0.0"
"@szmarczak/http-timer" "^4.0.5"
"@types/cacheable-request" "^6.0.1"
"@types/responselike" "^1.0.0"
cacheable-lookup "^5.0.3"
cacheable-request "^7.0.2"
decompress-response "^6.0.0"
http2-wrapper "^1.0.0-beta.5.2"
lowercase-keys "^2.0.0"
p-cancelable "^2.0.0"
responselike "^2.0.0"

got@^11.7.0, got@^11.8.5:
[email protected], got@^11.7.0, got@^11.8.5:
version "11.8.6"
resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a"
integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==
Expand Down

0 comments on commit 818d19b

Please sign in to comment.