CICD-088 · Test Bash helper behaviour
Encyclopedia · Tests and quality checks · All snippets
Previous · CICD-087 · Next · CICD-089
1. Where it fits
- Placement Bash run step following checkout, or equivalent lab terminal.
- Prerequisites repository with test fixtures and task-specific quality dependencies.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
bash -n scripts/deploy.sh
bats tests/deploy.bats3. How it works
bash -n parses the script without executing it. The Bats tests then exercise its behavior with controlled inputs or fake dependencies.
4. Verify the result
Bash syntax and behaviour are separate checks. Use fixture binaries or a dry-run flag in tests.
Validation syntax-validated (Bash parse). Status definitions.