{"id":18149,"library":"bats-support","title":"bats-support","description":"bats-support is a supporting library for Bats (Bash Automated Testing System) test helpers, providing common functions for error reporting, output formatting, and language tools. Version 0.3.0 is the latest stable release with no active maintenance cadence announced. It serves as a dependency for higher-level assertion libraries like bats-assert, focusing on internal helper utilities rather than end-user assertions. Key differentiators include its lightweight shell implementation, strict adherence to Bats conventions, and compatibility with both Bats 0.4 and 1.x. The library was renamed from bats-core to bats-support, with GitHub redirects ensuring backward compatibility.","status":"active","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/jasonkarns/bats-support","tags":["javascript"],"install":[{"cmd":"npm install bats-support","lang":"bash","label":"npm"},{"cmd":"yarn add bats-support","lang":"bash","label":"yarn"},{"cmd":"pnpm add bats-support","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"runtime peer dependency for test execution framework","package":"bats","optional":true}],"imports":[{"note":"Use the Bats 'load' function to properly initialize all helpers; direct sourcing may cause path issues.","wrong":"source bats-support/load.bash","symbol":"fail","correct":"load 'bats-support/load'"},{"note":"All functions are exposed via the main load file; importing individual source files is incorrect and unsupported.","wrong":"source bats-support/src/caller.bash","symbol":"batslib_is_caller","correct":"load 'bats-support/load'"},{"note":"This library is not a Node.js or Ruby gem; use 'load' from within a Bats test file, not a package manager.","wrong":"require 'bats-support'","symbol":"batslib_err","correct":"load 'bats-support/load'"}],"quickstart":{"code":"#!/usr/bin/env bats\nload 'bats-support/load'\n\n@test 'fail helper works' {\n  run some-command\n  if [ \"$status\" -ne 0 ]; then\n    fail \"Expected success, but command failed with status $status\"\n  fi\n}\n\n@test 'batslib_is_caller example' {\n  run bash -c '\n    function my_helper {\n      batslib_is_caller --indirect \"teardown\" && echo \"called from teardown\"\n    }\n    my_helper\n  '\n  [ \"$output\" = \"called from teardown\" ]\n}","lang":"bash","description":"Demonstrates loading bats-support, using fail helper for custom error messages, and batslib_is_caller for call stack inspection."},"warnings":[{"fix":"Update git submodule and file references to the new repository URL: https://github.com/bats-core/bats-support.git","message":"Repository renamed from bats-core to bats-support; all references (submodules, clones) redirect automatically but should be updated.","severity":"breaking","affected_versions":">=0.0"},{"fix":"Replace with: load 'bats-support/load'","message":"Direct sourcing of individual source files (e.g., 'source bats-support/src/output.bash') is deprecated; always use 'load'.","severity":"deprecated","affected_versions":">=0.0"},{"fix":"Always supply a message argument unless you intentionally want to pipe input.","message":"The 'fail' function reads from stdin if no argument is provided; piping to fail without checking may lead to unexpected failures.","severity":"gotcha","affected_versions":">=0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install bats-support via git submodule or npm, and ensure BATS_LIB_PATH includes the parent directory of bats-support.","cause":"bats-support is not installed or BATS_LIB_PATH is not set correctly.","error":"bats: load: bats-support/load: file not found"},{"fix":"Update bats-support to version 0.2.0 or later which introduced --indirect.","cause":"Using an older version of bats-support that does not support the --indirect flag.","error":"bats: unknown option: --indirect"},{"fix":"Ensure 'load bats-support/load' is placed before any calls to bats-support functions.","cause":"Using Unix 'type' command or other shell that doesn't recognize batslib_err as a function (likely due to incorrect sourcing order).","error":"TypeError: batslib_err is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}