Skip to content

Commit

Permalink
perf: optimize reduce in wrapConsoleProps (#29501)
Browse files Browse the repository at this point in the history
* fix: optimize reduce in wrapConsoleProps

* Added changelog notes

* Update changelog entry

---------

Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
  • Loading branch information
3 people committed Jun 3, 2024
1 parent 41faa7e commit f2894c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ _Released 6/4/2024 (PENDING)_

- Added support for [Next.js 14](https://nextjs.org/blog/next-14) for component testing. Addresses [#28185](https://github.com/cypress-io/cypress/issues/28185).

**Performance:**

- Improved performance when setting console props within `Cypress.log`. Addressed in [#29501](https://github.com/cypress-io/cypress/pull/29501).

**Bugfixes:**

- Pre-emptively fix behavior with Chrome for when `unload` events are forcefully deprecated by using `pagehide` as a proxy. Fixes [#29241](https://github.com/cypress-io/cypress/issues/29241).
Expand Down
6 changes: 5 additions & 1 deletion packages/driver/src/cypress/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,11 @@ export class Log {
const expectedProperties = ['name', 'type', 'error', 'snapshot', 'args', 'groups', 'table', 'props']
const expectedPropertiesObj = _.reduce(_.pick(consoleObjResult, expectedProperties), (memo, value, key) => {
// don't include properties with undefined values
return value === undefined ? memo : _.extend(memo, { [key]: value })
if (value !== undefined) {
memo[key] = value
}

return memo
}, consoleObj)
// any other key/value pairs need to be added to the `props` property
const rest = _.omit(consoleObjResult, expectedProperties)
Expand Down

4 comments on commit f2894c4

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f2894c4 Jun 3, 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.11.0/linux-arm64/develop-f2894c474010625050f1b417c6b4586b72a53a1f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f2894c4 Jun 3, 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.11.0/linux-x64/develop-f2894c474010625050f1b417c6b4586b72a53a1f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f2894c4 Jun 3, 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.11.0/win32-x64/develop-f2894c474010625050f1b417c6b4586b72a53a1f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f2894c4 Jun 3, 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.11.0/darwin-arm64/develop-f2894c474010625050f1b417c6b4586b72a53a1f/cypress.tgz

Please sign in to comment.