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

fix: don't inherit default message for request logging #28411

Merged
merged 8 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
7 changes: 7 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 13.6.1

_Released 12/5/2023 (PENDING)_

**Bugfixes:**
- Fixed an issue where request logging would default the `message` to the `args` of the currently running command even though those `args` would not apply to the request log and are not displayed. If the `args` are sufficiently large (e.g. when running the `cy.task` from the [code-coverage](https://github.com/cypress-io/code-coverage/) plugin) there could be performance/memory implications. Addressed in [#28411](https://github.com/cypress-io/cypress/pull/28411).
Copy link
Member

Choose a reason for hiding this comment

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

This is a little confusing. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to suggestions :)


## 13.6.0

_Released 11/21/2023_
Expand Down
21 changes: 21 additions & 0 deletions packages/driver/cypress/e2e/cypress/proxy-logging.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,27 @@ describe('Proxy Logging', () => {
img.src = `/fixtures/media/cypress.png?${Date.now()}`
})

it('does not inherit the message of the currently running command', () => {
const logs: any[] = []

cy.on('log:added', (log) => {
if (log.name !== 'request') return

logs.push(log)
})

// delay the fetch call by 100ms to ensure it gets
// triggered during the cy.wait() below
setTimeout(() => {
fetch('/some-url')
}, 100)

cy.wait(200).then(() => {
expect(logs).to.have.length(1)
expect(logs[0].message).to.eq('')
})
})

context('with cy.intercept()', () => {
it('shows non-xhr/fetch log if intercepted', (done) => {
const src = `/fixtures/media/cypress.png?${Date.now()}`
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cypress/proxy-logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function getRequestLogConfig (req: Omit<ProxyRequest, 'log'>): Partial<Cypress.I
url: req.preRequest.url,
method: req.preRequest.method,
timeout: 0,
message: '', // set to empty string so that we don't inherit the default message
consoleProps: () => req.consoleProps,
renderProps: () => {
function getIndicator (): 'aborted' | 'pending' | 'successful' | 'bad' {
Expand Down
Loading