Skip to content

fix: correctly remove undefined values in options#8487

Closed
TrevorBurnham wants to merge 1 commit intovitest-dev:mainfrom
TrevorBurnham:remove-undefined-values-fix
Closed

fix: correctly remove undefined values in options#8487
TrevorBurnham wants to merge 1 commit intovitest-dev:mainfrom
TrevorBurnham:remove-undefined-values-fix

Conversation

@TrevorBurnham
Copy link
Copy Markdown
Contributor

@TrevorBurnham TrevorBurnham commented Aug 27, 2025

Description

This removeUndefinedValues utility function was added by #2281. However, there's a bug in the implementation: It performs an in loop over the array returned by Object.keys, which means that it iterates over the array indices 1, 2, 3... instead of the actual object keys. That makes it effectively a no-op.

Since no one has noticed this in 3 years, simply removing the function would be one option. It's not clear to me why the TypeError described in #2153 occurred. However, this PR goes with the other option: Implementing the intended behavior by removing the Object.keys so that in iterates over the object's keys.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it. (Author note: Unfortunately, there's no existing test coverage for this part of the codebase.)
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 27, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b35961c
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/68af5690d44d2a0008a8e500
😎 Deploy Preview https://deploy-preview-8487--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sheremet-va
Copy link
Copy Markdown
Member

This is really funny, let's just remove the call altogether to keep the current behavior.

@TrevorBurnham
Copy link
Copy Markdown
Contributor Author

This is really funny, let's just remove the call altogether to keep the current behavior.

Roger that! Closing in favor of #8501.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants