Add BATS test suite
Addresses #49.
This adds a basic bats-core test setup for node-reinstall:
make testrunsbash -n ./node-reinstalland the BATS suite.- The BATS tests run the script with temporary
HOMEandPREFIXpaths. - 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.
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.
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.
No problem at all @brock! Take your time - PayPal email is: [email protected]