Unit tests using BATS
I'd be very interested in setting up unit testing using BATS. If anyone has experience with this and can get a basic setup going, preferably with TravisCI, I'd be willing to offer a bounty of ~$10 via PayPal or Crypto~
Bounty has been raised to $50 USD, payable via PayPal, Venmo or Crypto.
Screw it - unit tests matter. I'm bumping this bounty to $50.
Submitted PR #58 for this bounty: https://github.com/brock/node-reinstall/pull/58
What it adds:
- BATS smoke tests for safe command-line paths that exit before destructive reinstall operations
- Travis CI setup that installs bats-core and runs make test
- README instructions for running the tests locally
Validation:
- PATH="/tmp/codex-bats-core-node-reinstall/bin:$PATH" make test passed with 4 tests
If accepted for the bounty, PayPal payout details can be provided privately.
Submitted PR #59 for this bounty: https://github.com/brock/node-reinstall/pull/59
What it adds:
- BATS test target plus both Travis CI and GitHub Actions coverage
- Tests for safe CLI exits: help, version, and invalid option paths
- Stubbed destructive-flow coverage for
--force --nvmand--force --naveusing isolated tempHOME/PREFIXvalues - Regression coverage for release tag extraction and global npm module basename handling
- README instructions for running the test suite locally
Validation:
- Ran the BATS suite locally through Git Bash with bats-core: 6 tests passed
If accepted for the bounty, payout details can be provided privately.
Submitted PR #60 for this bounty: https://github.com/brock/node-reinstall/pull/60\n\nIt adds BATS tests, Travis CI wiring, GitHub Actions on Ubuntu/macOS, and two small portability fixes that the tests exercise. Local verification: 8 BATS tests passing.\n\nIf accepted for the bounty, PayPal payout can go to [email protected].
Update on PR #59: I pushed a follow-up commit (3802f9d) to make the test submission stronger.
Additional coverage now includes:
- GitHub Actions matrix on Ubuntu and macOS
bash -n ./node-reinstallas part ofmake test- first-time install coverage when Node/npm are absent
--versionpre-privilege exit coverage- a small
--nvm-latestfix plus regression test so it uses the master install script instead of the stable release API
Local verification: 9 BATS tests pass against safe stubs (sudo, npm, curl, nvm, nave).
Quick check before I add more noise here: are you still accepting a fresh BATS implementation, or are you mainly reviewing the current submissions (#56, #58-#61)? I can either submit a smaller focused BATS-only PR or help compare the existing ones, but I do not want to duplicate work if one is already preferred.
Update on PR #58: I pushed follow-up commit f4b609b to strengthen the submission after the new activity on this issue.
Additional coverage now includes:
- GitHub Actions test workflow on Ubuntu and macOS
- Stubbed
--force --nvmcoverage when Node/npm are absent - Stubbed
--force --navecoverage with a requested Node version and global npm module reinstall - Temporary
HOMEandPREFIXpaths so the destructive-flow tests stay isolated
Validation:
PATH="/tmp/codex-bats-core-node-reinstall/bin:$PATH" make testpasses with 6 BATS tests.
Hi! I'd like to work on this bounty — claiming via autonomous pipeline.
Account: jdjioe5-cpu ([email protected]) Skills: C / Python / Go / TypeScript / Bash + threat-model + code-review + perf-opt
Plan:
- Review linked source + any related issue context
- Reproduce or scope the work locally
- Push a focused PR (test plan + reproducibility notes)
- Submit for judgment
If a single solver per bounty is required, I'll wait for explicit assignment. Otherwise I'll start work after a brief scoping window.
Thanks!
I reviewed the existing BATS proposals and found a specific case worth adding before a merge: preserving scoped global package names.
In #59 at 3802f9d (also #60), the revised extraction still uses basename. This read-only reproduction of that extraction:
printf '%s\n' /tmp/prefix/lib /tmp/prefix/lib/node_modules/@scope/example \
| xargs -n 1 basename | sed -E '/^(lib|npm)$/d'
prints example, losing @scope/. The later npm install --global $GLOBAL_MODULES would therefore request the unscoped package instead of @scope/example. npm documents the scoped directory layout here. This is a synthetic extraction check; I have not run the destructive reinstall script or claimed Linux/macOS validation.
@brock, if you are still reviewing this bounty, would a $10 PayPal follow-up to your preferred existing PR be useful? I would preserve scoped names, add a focused regression, and document the tests actually run, within one hour of an agreed start. Please confirm the preferred PR, acceptance checks and payment timing first. This finding is shared freely, and I am not claiming the existing $50 award or duplicating the submitted test suites.
Parth