Skip to content

test: add integration tests for the shipped action - #766

Merged
EndBug merged 2 commits into
mainfrom
cursor/add-integration-tests
Aug 9, 2026
Merged

test: add integration tests for the shipped action#766
EndBug merged 2 commits into
mainfrom
cursor/add-integration-tests

Conversation

@EndBug

@EndBug EndBug commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Jest integration tests that spawn lib/index.js against temporary git fixtures with local bare remotes (covers commit, tag, push, new branch, remove, selective add).
  • Keep fixtures under os.tmpdir() with an allowlisted spawn env so CI never pushes to GitHub or touches the checked-out repo.
  • Update CONTRIBUTING to run npm test instead of manually testing in a separate repo.

Closes #479

Test plan

  • npm test (unit + integration + lint) passes locally
  • CI Test workflow is green on this PR
  • Spot-check that push scenarios only hit the local bare remote (no network)

Made with Cursor

Summary by CodeRabbit

  • Tests

    • Added comprehensive integration coverage for committing, tagging, pushing, branching, author settings, and selective file changes.
    • Added isolated Git test fixtures and validation helpers to improve reliability of action testing.
  • Documentation

    • Updated contribution instructions to require running tests after building, including unit and integration tests.

Cover commit, tag, push, and pathspec flows against temp git fixtures with local bare remotes (#479).

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d69ee7d-e12a-4313-a324-7c5e1a2c1b00

📥 Commits

Reviewing files that changed from the base of the PR and between 75ed20e and 360a98f.

📒 Files selected for processing (1)
  • test/integration/helpers.ts

📝 Walkthrough

Walkthrough

Adds isolated Git fixtures and helpers for running the built action. Adds integration tests for commits, no-ops, identities, tags, pushes, branches, and pathspec behavior. Updates contribution instructions to run unit and integration tests after building.

Changes

Integration testing

Layer / File(s) Summary
Fixture and action harness
test/integration/helpers.ts
Creates temporary Git repositories, runs the built action with controlled inputs, parses outputs, and provides Git inspection helpers.
Action behavior integration coverage
test/integration/action.test.ts, CONTRIBUTING.md
Tests commit, no-op, identity, tag, push, branch, removal, and selective-addition behavior. Updates the required test command.

Estimated code review effort: 3 (Moderate) | ~30 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change: adding integration tests for the shipped action.
Linked Issues check ✅ Passed The changes satisfy issue #479 by testing commit creation and push behavior with isolated local Git fixtures.
Out of Scope Changes check ✅ Passed All changes support the testing objective, including test documentation, fixtures, helpers, and action integration coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 cursor/add-integration-tests

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.

@EndBug
EndBug marked this pull request as ready for review August 9, 2026 21:02

@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: 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 `@test/integration/helpers.ts`:
- Around line 61-80: Update the default-branch lookup in the fixture setup to
handle a missing init.defaultBranch without letting git config failure abort
execution, using the intended fallback branch. Ensure the seed checkout and push
use that resolved branch, then explicitly set the bare remote’s HEAD to it after
the push so the remote default matches the fixture branch.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9519cf21-2810-4633-b120-97cc22511562

📥 Commits

Reviewing files that changed from the base of the PR and between df70d11 and 75ed20e.

📒 Files selected for processing (3)
  • CONTRIBUTING.md
  • test/integration/action.test.ts
  • test/integration/helpers.ts

Comment thread test/integration/helpers.ts
GitHub runners often have no init.defaultBranch set, so git config --get exits 1 and broke fixture setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EndBug
EndBug merged commit f958857 into main Aug 9, 2026
11 checks passed
@EndBug
EndBug deleted the cursor/add-integration-tests branch August 9, 2026 21:09
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.

Add integration tests

1 participant