Skip to content

Add BATS test suite#56

Open
adamsardo wants to merge 1 commit into
brock:masterfrom
adamsardo:adamsardo/issue-49-bats-tests
Open

Add BATS test suite#56
adamsardo wants to merge 1 commit into
brock:masterfrom
adamsardo:adamsardo/issue-49-bats-tests

Conversation

@adamsardo
Copy link
Copy Markdown

Addresses #49.

This adds a basic bats-core test setup for node-reinstall:

  • make test runs bash -n ./node-reinstall and the BATS suite.
  • The BATS tests run the script with temporary HOME and PREFIX paths.
  • Destructive/external commands (sudo, rm, curl, node, npm, nvm, nave) are shadowed by mocks, so the tests can exercise the reinstall paths without deleting or installing anything.
  • The suite covers help/version/unknown option handling, default NVM install flow, requested version handling, installed-version reuse, Nave mode, and global npm module reinstall.
  • GitHub Actions runs the suite on Ubuntu and macOS.

Verified locally:

make test

Result: 7 BATS tests passing.

If the bounty on #49 is still active, happy to coordinate payout however you prefer after review.

@adamsardo
Copy link
Copy Markdown
Author

CI note: the new test workflow has not actually run yet. GitHub shows the pull-request workflow run as action_required with zero jobs, so it likely needs maintainer approval for a first-time/fork workflow run.

Local verification still passes here:

make test

That runs bash -n ./node-reinstall plus 7 BATS tests. The tests shadow sudo, rm, curl, node, npm, nvm, and nave, and use temporary HOME/PREFIX paths so the destructive reinstall paths are exercised without touching the real machine.

@brock
Copy link
Copy Markdown
Owner

brock commented May 11, 2026

Thanks @adamsardo for putting this together. It's been a while since I worked on this project, but I'll work through this PR today and get back up to speed. Please let me know a PayPal or Venmo address where I can pay the bounty.

@adamsardo
Copy link
Copy Markdown
Author

No problem at all @brock! Take your time - PayPal email is: adam@medreport.ai

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.

3 participants