This project demonstrates an issue where ora spinners may interfere with pre-commit hooks.
package.json- Contains ora dependency.pre-commit-config.yaml- Pre-commit configuration with three hookshooks/immediate-echo.sh- Hook that echoes "finished" immediatelyhooks/delayed-echo.sh- Hook that waits 10 seconds then echoes "finished"hooks/spinner-hook.sh- Hook that runs the ora spinnertest-spinner.js- Test script that runs an ora spinner for 15 seconds
-
Install pre-commit (if not already installed):
pip install pre-commit
-
Install dependencies:
npm install
-
Install pre-commit hooks:
pre-commit install
-
Confirm ora is working as expected:
node ./test-spinner.js
Run the spinner hook directly:
pre-commit run spinner-hook --all-filesThis will execute the ora spinner within the pre-commit hook environment, demonstrating the issue where the spinner may hang or not complete properly.
-
Run all hooks:
pre-commit run --all-files
-
Make a test commit:
git add . git commit -m "Test commit"