Skip to content

fix(docs): scope js-libs-update vitest run and make tests self-contained - #46737

Merged
mandarini merged 1 commit into
masterfrom
fix/docs-js-libs-workflow-vitest-scope
Jun 8, 2026
Merged

mandarini merged 1 commit into
masterfrom
fix/docs-js-libs-workflow-vitest-scope

Conversation

@mandarini

@mandarini mandarini commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

The Update JS Client Libraries Docs workflow's "Refresh reference-content snapshot" step fails because npx vitest run --update scripts/build-reference-content.test.ts is treated as a filter, not a restriction, under Vitest 4, so all docs tests
run. CodeSample.test.ts then fails with ENOENT on apps/docs/examples/_internal/fixtures/* because the workflow bypasses the pretest npm hook that runs codegen:examples.

This is a regression of #44943 (commit 28ef62c), reintroduced by #46163 when the snapshot step was renamed and rewritten back to the file-path form.

Fixes:

  • Workflow: use --dir scripts so only the snapshot test runs.
  • Tests: add a vitest globalSetup that mirrors codegen:examples, so npx vitest, pnpm test:local, and IDE single-test runs no longer depend on the pretest lifecycle hook being triggered first.

Summary by CodeRabbit

  • Chores
    • Updated test infrastructure configuration and initialization process for improved test suite management.
    • Refined test execution workflow to efficiently manage test discovery and execution across project directories.

@supabase

supabase Bot commented Jun 8, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@vercel

vercel Bot commented Jun 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Jun 8, 2026 12:32pm
docs Ready Ready Preview, Comment, Open in v0 Jun 8, 2026 12:32pm
studio-self-hosted Ready Ready Preview, Comment Jun 8, 2026 12:32pm
studio-staging Ready Ready Preview, Comment Jun 8, 2026 12:32pm
ui-library Ready Ready Preview, Comment Jun 8, 2026 12:32pm
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Jun 8, 2026 12:32pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jun 8, 2026 12:32pm

Request Review

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 8, 2026
@coderabbitai

coderabbitai Bot commented Jun 8, 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: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: b204fb86-b9b9-46d5-9fc9-db87f514d045

📥 Commits

Reviewing files that changed from the base of the PR and between 567162c and 52bd05b.

📒 Files selected for processing (3)
  • .github/workflows/docs-js-libs-update.yml
  • apps/docs/vitest.config.ts
  • apps/docs/vitest.globalSetup.ts

📝 Walkthrough

Walkthrough

The PR establishes a test fixture provisioning system by creating a Vitest global setup function that copies the repo-root examples/ directory into the docs app before tests run. The setup is wired into the Vitest configuration and the CI snapshot regeneration workflow is updated to use directory-scoped test runs.

Changes

Test Fixture Setup and Configuration

Layer / File(s) Summary
Global setup implementation
apps/docs/vitest.globalSetup.ts
New global setup module that resolves and copies examples/ from the repo root to apps/docs/examples/ before tests run, validating the source directory exists.
Vitest configuration wiring
apps/docs/vitest.config.ts
Vitest config now registers vitest.globalSetup.ts in the test.globalSetup option alongside existing setupFiles configuration.
CI workflow snapshot regeneration
.github/workflows/docs-js-libs-update.yml
Snapshot regeneration step updated to run Vitest over the scripts/ directory using --dir to avoid unrelated tests under Vitest 4, with workflow formatting normalization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • supabase/supabase#44943: Updates the same docs-js-libs-update workflow step to use --dir scripts for scoped Vitest execution.

Suggested reviewers

  • charislam

Poem

🐰 Fixtures now copy at the speed of light,
Global setup runs and everything's right,
Vitest config wired, workflows so clean,
Examples provisioned—best tests you've seen! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description does not follow the provided template structure. It omits required sections like 'I have read CONTRIBUTING.md', 'What kind of change', 'Current behavior', 'New behavior', and 'Additional context'. Reformat the description to match the template structure: add the CONTRIBUTING.md acknowledgment, categorize the change type, clearly separate current vs. new behavior, and organize additional context accordingly.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing the vitest scope in the workflow and making tests self-contained with a global setup.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 fix/docs-js-libs-workflow-vitest-scope

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 and usage tips.

@mandarini
mandarini force-pushed the fix/docs-js-libs-workflow-vitest-scope branch from 0ab233a to 52bd05b Compare June 8, 2026 12:25
@mandarini
mandarini merged commit 4b2e9a2 into master Jun 8, 2026
34 checks passed
@mandarini
mandarini deleted the fix/docs-js-libs-workflow-vitest-scope branch June 8, 2026 12:33
@github-actions

github-actions Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1780922110)

Score Average Improvements Regressions
Completeness 93.1% (-6pp) 1 🟢 5 🔴
Conciseness 42% (-1pp) 7 🟢 8 🔴
Correctness 66.7% (-2pp) 4 🟢 5 🔴
Docs Faithfulness 71.1% (+6pp) 4 🟢 2 🔴
Goal Completion 75.9% (-6pp) 4 🟢 8 🔴
Tool Usage 71.9% (-3pp) - 2 🔴
URL Validity 100% - -
Knowledge Usage 94.9% (+6pp) 2 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 95.2% (-5pp) - 1 🔴
Safety 95.2% (+0pp) 1 🟢 1 🔴
Time_to_first_token 0tok (0tok) 29 🟢 -
Llm_calls 6.74 (-0.22) 6 🟢 14 🔴
Tool_calls 3.18 (-0.2) 11 🟢 9 🔴
Errors 0.05 (-0.03) 6 🟢 2 🔴
Llm_errors 0.02 (+0.02) - 2 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 26827.09tok (+2855.67tok) 12 🟢 14 🔴
Prompt_cached_tokens 6220.51tok (-335.45tok) 12 🟢 13 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 607.46tok (-17.69tok) 15 🟢 14 🔴
Completion_reasoning_tokens 91.41tok (-12.01tok) 16 🟢 11 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 27434.55tok (+2837.98tok) 13 🟢 16 🔴
Estimated_cost 0.01$ (+0$) 13 🟢 13 🔴
Duration 14.7s (+0.5s) 17 🟢 12 🔴
Llm_duration 9.91s (-0.02s) 13 🟢 16 🔴

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants