Skip to content

fix: stabilize CLI tests on Node 22#8

Merged
ioncache merged 3 commits into
mainfrom
codex/fix-node22-cli-test-flake
Jul 5, 2026
Merged

fix: stabilize CLI tests on Node 22#8
ioncache merged 3 commits into
mainfrom
codex/fix-node22-cli-test-flake

Conversation

@ioncache

@ioncache ioncache commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Stabilize the CLI tests that were flaking on Node 22 in CI.

What Changed

  • allow main in src/gdsx-cli.js to accept an optional injected generateStats dependency for tests
  • update the CLI tests to use direct dependency injection instead of Vitest module mocking

Why

The failing CI job was Node 22 only. The mocked-module CLI test sometimes fell through to the real generateStats implementation, which then ran git diff HEAD~1..HEAD in a repo state where that range was invalid for the test, causing the assertion to fail for the wrong reason.

Impact

  • removes a Node 22-specific test flake
  • leaves normal CLI behavior unchanged
  • makes the CLI tests deterministic across runtimes

Validation

  • npm test
  • npx -y node@22 ./node_modules/vitest/vitest.mjs run

Summary by CodeRabbit

  • Bug Fixes

    • Improved CLI reliability by allowing a custom stats generator to be injected in test and runtime flows.
  • Chores

    • Updated CI to use a specific npm version before validation steps.
    • Refreshed commit message checking to use the current npm execution method.
    • Added commitlint tooling for consistent commit message checks.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cfb227ea-9e8d-4c96-86a7-ce6fae87af64

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-node22-cli-test-flake

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.

@ioncache ioncache marked this pull request as ready for review July 5, 2026 05:17

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 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 @.github/workflows/ci.yml:
- Line 29: The CI workflow currently installs npm using a floating major
version, which can still change unexpectedly. Update the npm install step in the
workflow to use an exact pinned version instead of npm@11, and keep the pin
deliberate when bumping it. Use the existing npm install global step in the CI
workflow as the target to locate and adjust.

In `@package.json`:
- Around line 85-86: Update the Node engine constraint in package.json to match
the requirements of `@commitlint/cli` and `@commitlint/config-conventional` 21.2.0.
Adjust the engines field so local installs don’t permit Node versions below
22.12.0, and verify any related install/runtime checks still align with the new
minimum.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3cc9c78c-38ee-45b8-825c-aa21c9b5ce8e

📥 Commits

Reviewing files that changed from the base of the PR and between 324e939 and 7e02849.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • .husky/commit-msg
  • package.json
  • src/gdsx-cli.js
  • test/gdsx-cli.test.js

Comment thread .github/workflows/ci.yml
Comment thread package.json
@ioncache ioncache merged commit f4f4285 into main Jul 5, 2026
6 checks passed
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.

1 participant