Skip to content

test(config): migrate normalize tests to vitest - #7155

Open
43081j wants to merge 2 commits into
netlify:mainfrom
43081j:jg/config-vitest-normalize
Open

test(config): migrate normalize tests to vitest#7155
43081j wants to merge 2 commits into
netlify:mainfrom
43081j:jg/config-vitest-normalize

Conversation

@43081j

@43081j 43081j commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This migrates the normalize tests to vitest.

As part of that, it drops omit.js since it can't load without some funkiness in vitest and is redundant anyway.

The snapshots were diffed locally and appear to be equal (via a script i had claude make).


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

43081j added 2 commits July 31, 2026 18:50
Migrates the `normalize.js` tests to vitest.

Snapshots have been compared and are equal.
@43081j
43081j requested a review from a team as a code owner August 5, 2026 15:07
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 54180d14-05c7-4dc9-8723-18bb3d12b246

📥 Commits

Reviewing files that changed from the base of the PR and between f34dd81 and 5254143.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json
  • packages/config/tests/normalize/__snapshots__/normalize.test.js.snap is excluded by !**/*.snap
  • packages/config/tests/normalize/snapshots/tests.js.snap is excluded by !**/*.snap
📒 Files selected for processing (8)
  • eslint_temporary_suppressions.js
  • packages/config/package.json
  • packages/config/src/bin/main.js
  • packages/config/src/env/main.ts
  • packages/config/tests/normalize/normalize.test.js
  • packages/config/tests/normalize/snapshots/tests.js.md
  • packages/config/tests/normalize/tests.js
  • packages/config/vitest.config.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)
💤 Files with no reviewable changes (1)
  • packages/config/tests/normalize/tests.js

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of sensitive configuration and environment values when producing CLI output.
    • Increased resilience when processing missing or empty environment configuration.
  • Tests

    • Expanded configuration normalization coverage, including commands, defaults, functions, plugins, contexts, and included files.
    • Added Vitest coverage alongside existing test suites for more reliable validation.

Walkthrough

This PR updates packages/config to run Vitest with AVA, adds a Vitest config, and moves normalization snapshot coverage into normalize.test.js. It removes omit.js from the package and replaces its use in CLI output filtering and environment cleanup with Object.entries(...).filter(...) and Object.fromEntries(...). It also expands the temporary ESLint missing-import suppression globs to include .test.js files in packages/build/tests and packages/config/tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • netlify/build#7137: Both PRs affect the packages/config test migration path and the Fixture-based tests used without AVA.
  • netlify/build#7141: Both PRs connect to test infrastructure updates that require broader .test.js ESLint suppression coverage.
  • netlify/build#7095: Both PRs modify eslint_temporary_suppressions.js for n/no-missing-import suppression in test files.

Suggested labels: Adds or modifies js files

Suggested reviewers: serhalp

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the migration of normalize tests to Vitest.
Description check ✅ Passed The description explains the migration, dependency removal, snapshot validation, and checklist status with sufficient context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

e18e dependency analysis

No dependency warnings found.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@netlify/build

npm i https://pkg.pr.new/@netlify/build@7155

@netlify/build-info

npm i https://pkg.pr.new/@netlify/build-info@7155

@netlify/cache-utils

npm i https://pkg.pr.new/@netlify/cache-utils@7155

@netlify/config

npm i https://pkg.pr.new/@netlify/config@7155

@netlify/edge-bundler

npm i https://pkg.pr.new/@netlify/edge-bundler@7155

@netlify/functions-utils

npm i https://pkg.pr.new/@netlify/functions-utils@7155

@netlify/git-utils

npm i https://pkg.pr.new/@netlify/git-utils@7155

@netlify/headers-parser

npm i https://pkg.pr.new/@netlify/headers-parser@7155

@netlify/api

npm i https://pkg.pr.new/@netlify/api@7155

@netlify/nock-udp

npm i https://pkg.pr.new/@netlify/nock-udp@7155

@netlify/opentelemetry-sdk-setup

npm i https://pkg.pr.new/@netlify/opentelemetry-sdk-setup@7155

@netlify/opentelemetry-utils

npm i https://pkg.pr.new/@netlify/opentelemetry-utils@7155

@netlify/redirect-parser

npm i https://pkg.pr.new/@netlify/redirect-parser@7155

@netlify/run-utils

npm i https://pkg.pr.new/@netlify/run-utils@7155

@netlify/zip-it-and-ship-it

npm i https://pkg.pr.new/@netlify/zip-it-and-ship-it@7155

commit: 5254143

@serhalp serhalp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks! Just one request inline please 🙏🏼

restoreMocks: true,
environment: 'node',
testTimeout: 100_000,
include: ['tests/**/*.test.js'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I fear we'll quietly not run new/ported tests in the future:

Suggested change
include: ['tests/**/*.test.js'],
include: ['tests/**/*.test.{js,ts}'],

"indent-string": "^5.0.0",
"is-plain-obj": "^4.0.0",
"map-obj": "^5.0.0",
"omit.js": "^2.0.2",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🙏🏼 could you split this change out into a separate PR so we can mark it as fix(deps) and keep this one as a pure chore?

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