mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-09-08 00:00:07 +08:00
The presence checks used `command -v`, which finds executables as readily as functions, and this test file is itself an executable named `nvm_print_color_legend`. Whenever its own directory is on `PATH`, as it is under CI, `command -v` kept resolving to the file long after `nvm unload` had removed the function, so the unload assertion could never pass there and the "is it defined" guard could never fail. `command -v` prints a bare name for a function and a path for an executable, in sh, bash, dash, zsh, and ksh alike, so requiring the result to contain no slash distinguishes the two. Verified both ways round: with the test's directory on `PATH` the suite passes in all four shells, and removing `nvm_print_color_legend` from `nvm unload`'s list is still caught in all four.