Fix Vitest command in GitHub Actions#88
Open
anthuanvasquez wants to merge 6 commits into
Open
Conversation
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
There was a problem hiding this comment.
Pull request overview
Updates the GitHub Actions CI workflow to run Vitest via the project’s canonical pnpm test script, fixing a mis-specified command that caused false CI failures.
Changes:
- Replace
pnpm test runwithpnpm testin the CI test job.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
better-sqlite3 is a native addon that fails to load its compiled bindings in the GitHub Actions Linux runner. The @nuxt/content module attempts to initialize SQLite via better-sqlite3 during Vitest environment setup, causing a startup error before any test runs. Add a stub mock (tests/mocks/better-sqlite3.ts) that satisfies the better-sqlite3 API surface and register it as a Vitest alias so the native binary is never loaded in the test environment. Closes #81
The prebuilt binary for better-sqlite3@12.6.2 targets Node 20.20.2 but the GitHub Actions runner may use a different Node 20 patch version, causing the native binding lookup to fail at Vitest startup. Adding an explicit pnpm rebuild step compiles the native addon from source against the exact Node.js version on the runner, eliminating the version mismatch.
@nuxt/content initializes better-sqlite3 (a native addon) during Nuxt module setup, which fails in CI Linux runners because the prebuilt binary does not match the runner's Node.js version. No test in the suite depends on content functionality. Excluding the module via environmentOptions.nuxt.overrides prevents the native addon from loading entirely, eliminating the startup crash. Also reverts the pnpm rebuild step which ran silently with no effect.
better-sqlite3 (native addon used by @nuxt/content) fails to load its prebuilt binary in CI Linux runners due to a Node.js version mismatch. No test in the suite depends on content functionality. Use process.env.VITEST — set automatically by Vitest — to conditionally exclude @nuxt/content from the modules list, preventing the native addon from being initialized during test runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #81
Summary
pnpm test runtopnpm test.vitest run run.Changes
.github/workflows/ci.ymlValidation
pnpm test