Skip to content

Fix Vitest command in GitHub Actions#88

Open
anthuanvasquez wants to merge 6 commits into
masterfrom
fix/81
Open

Fix Vitest command in GitHub Actions#88
anthuanvasquez wants to merge 6 commits into
masterfrom
fix/81

Conversation

@anthuanvasquez

Copy link
Copy Markdown
Owner

Closes #81

Summary

  • Update CI test command from pnpm test run to pnpm test.
  • Prevent false failures caused by vitest run run.

Changes

File Change
.github/workflows/ci.yml Replace invalid test command with valid one

Validation

  • pnpm test

Copilot AI review requested due to automatic review settings April 26, 2026 20:28
@anthuanvasquez anthuanvasquez added bug Something isn't working area:ci CI/CD workflows priority:high Urgent work labels Apr 26, 2026
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 run with pnpm test in 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI/CD workflows bug Something isn't working priority:high Urgent work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Vitest command in GitHub Actions

2 participants