Skip to content

chore(docs): add test command and configuration for vitest#91

Merged
coryrylan merged 1 commit into
mainfrom
topic-fix-breadcrumb-docs
May 18, 2026
Merged

chore(docs): add test command and configuration for vitest#91
coryrylan merged 1 commit into
mainfrom
topic-fix-breadcrumb-docs

Conversation

@coryrylan
Copy link
Copy Markdown
Collaborator

@coryrylan coryrylan commented May 18, 2026

  • Introduced a new test command in package.json to run tests using vitest.
  • Updated CI configuration to include the test command as a dependency.
  • Modified metadata.js to ensure correct breadcrumb item positioning and generation logic.

Summary by CodeRabbit

  • New Features

    • Site project now runs tests via the build tooling and includes a dedicated test runner configuration.
  • Bug Fixes

    • Breadcrumb structured data now omits non-generated pages and correctly sets positions and item URLs.
  • Tests

    • Added automated tests validating breadcrumb JSON‑LD content and behavior.
  • Chores

    • Test script and test-related dev dependency added to project configuration.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: b465c4a7-b007-4fce-b80d-1175e3a5773c

📥 Commits

Reviewing files that changed from the base of the PR and between 273940d and dece399.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • projects/site/package.json
  • projects/site/src/_11ty/layouts/metadata.js
  • projects/site/src/_11ty/layouts/metadata.test.ts
  • projects/site/vitest.config.ts

📝 Walkthrough

Walkthrough

Adds Vitest configuration and CI wiring for projects/site, refines renderJsonLd breadcrumb construction to skip non-generated pages and use list-length-based positions, and adds Vitest tests validating breadcrumb omission and inclusion behaviors.

Changes

Vitest setup and breadcrumb testing

Layer / File(s) Summary
Vitest configuration and CI integration
projects/site/vitest.config.ts, projects/site/package.json
Adds projects/site/vitest.config.ts with project root and test include; updates package.json to add test to CI wireit dependencies, defines wireit.test running vitest run --config=vitest.config.ts (depends on ../internals/vite:ci), and adds @vitest/coverage-istanbul to devDependencies.
Breadcrumb logic refinement and test coverage
projects/site/src/_11ty/layouts/metadata.js, projects/site/src/_11ty/layouts/metadata.test.ts
renderJsonLd now skips breadcrumb entries when hasGeneratedPage(...) is false and computes position from the current itemListElement.length; adds Vitest tests that assert non-generated pages are omitted and generated pages include item URLs and correct positions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

scope(ci)

Suggested reviewers

  • johnyanarella
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding test command and vitest configuration to the docs project.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch topic-fix-breadcrumb-docs

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/site/src/_11ty/layouts/metadata.test.ts`:
- Around line 3-5: The test sets module-level environment stubs with vi.stubEnv
for ELEMENTS_SITE_URL and PAGES_BASE_URL which persist across suites; add an
afterAll hook in metadata.test.ts that restores those environment variables
(either by calling vi.unstubAllEnvs() if available or by deleting/resetting
process.env.ELEMENTS_SITE_URL and process.env.PAGES_BASE_URL) so the stubs are
cleaned up after tests; reference the existing vi.stubEnv calls to place the
afterAll close to them.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 760ca62d-33d4-4029-95dd-3186fd3f3f5e

📥 Commits

Reviewing files that changed from the base of the PR and between b931ff5 and 273940d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • projects/site/package.json
  • projects/site/src/_11ty/layouts/metadata.js
  • projects/site/src/_11ty/layouts/metadata.test.ts
  • projects/site/vitest.config.ts

Comment thread projects/site/src/_11ty/layouts/metadata.test.ts
- Introduced a new test command in package.json to run tests using vitest.
- Updated CI configuration to include the test command as a dependency.
- Modified metadata.js to ensure correct breadcrumb item positioning and generation logic.

Signed-off-by: Cory Rylan <crylan@nvidia.com>
@coryrylan coryrylan force-pushed the topic-fix-breadcrumb-docs branch from 273940d to dece399 Compare May 18, 2026 13:40
@coryrylan coryrylan merged commit 1e56150 into main May 18, 2026
8 checks passed
@coryrylan coryrylan deleted the topic-fix-breadcrumb-docs branch May 18, 2026 15:37
@coryrylan
Copy link
Copy Markdown
Collaborator Author

🎉 This issue has been resolved in version 0.0.11 🎉

Changelog

@coryrylan
Copy link
Copy Markdown
Collaborator Author

🎉 This issue has been resolved in version 0.1.2 🎉

Changelog

@coryrylan
Copy link
Copy Markdown
Collaborator Author

🎉 This issue has been resolved in version 0.2.0 🎉

Changelog

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants