bats-test-scaffolder

Solid

Generate BATS test structure and fixtures for shell script testing with setup/teardown, assertions, and mocking.

Testing & QA 814 stars 53 forks Updated today MIT

Install

View on GitHub

Quality Score: 95/100

Stars 20%
97
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# BATS Test Scaffolder Generate BATS test structure for shell script testing. ## Capabilities - Generate BATS test files - Create setup and teardown fixtures - Implement custom assertions - Set up mocking helpers - Configure test isolation - Generate test helpers ## Usage Invoke this skill when you need to: - Set up BATS testing for shell scripts - Create test fixtures and helpers - Implement mock functions - Generate test cases ## Generated Test Structure ``` tests/ ├── bats/ │ └── bats-*.bash # BATS submodules ├── test_helper/ │ ├── common-setup.bash # Common setup │ └── mocks.bash # Mock helpers ├── fixtures/ │ ├── input.txt # Test fixtures │ └── expected.txt └── *.bats # Test files ``` ## Test File Template ```bash #!/usr/bin/env bats # Load test helpers load 'test_helper/common-setup' # Setup runs before each test setup() { common_setup # Test-specific setup export TEST_DIR="$(mktemp -d)" } # Teardown runs after each test teardown() { # Cleanup rm -rf "${TEST_DIR}" } @test "script displays help with --help" { run ./script.sh --help assert_success assert_output --partial "Usage:" } @test "script fails without required argument" { run ./script.sh assert_failure assert_output --partial "Missing required argument" } @test "script processes input file" { cp fixtures/input.txt "${TEST_DIR}/" run ./script.sh "${TEST_DIR}/input.txt" assert_success as...

Details

Author
a5c-ai
Repository
a5c-ai/babysitter
Created
4 months ago
Last Updated
today
Language
JavaScript
License
MIT

Related Skills