Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Bats is a TAP-compliant testing framework for Bash 3.2 or above. It provides a simple way to verify that the UNIX programs you write behave as expected.
A Bats test file is a Bash script with special syntax for defining test cases. Under the hood, each test case is just a function with a description.
#!/usr/bin/env bats
@test "addition using bc" {
result="$(echo 2+2 | bc)"
[ "$result" -eq 4 ]
}
@test "addition using dc" {
result="$(echo 2 2+p | dc)"
[ "$result" -eq 4 ]
}
Bats is most useful when testing software written in Bash, but you can use it to test any UNIX program.
Test cases consist of standard shell commands. Bats makes use of Bash's
errexit
(set -e
) option when running test cases. If every command in the
test case exits with a 0
status code (success), the test passes. In this way,
each line is an assertion of truth.
NOTE The documentation has moved to https://bats-core.readthedocs.io
bin/bats --tap test
See also the CI settings for the current test environment and scripts.
The Bats source code repository is hosted on GitHub. There you can file bugs on the issue tracker or submit tested pull requests for review.
For real-world examples from open-source projects using Bats, see Projects Using Bats on the wiki.
To learn how to set up your editor for Bats syntax highlighting, see Syntax Highlighting on the wiki.
For now see the docs
folder for project guides, work with us on the wiki
or look at the other communication channels.
See docs/CHANGELOG.md
.
There was an initial call for maintainers for the original Bats repository, but write access to it could not be obtained. With development activity stalled, this fork allowed ongoing maintenance and forward progress for Bats.
Tuesday, September 19, 2017: This was forked from Bats at
commit 0360811. It was created via git clone --bare
and git push --mirror
.
As of Thursday, April 29, 2021: the original Bats has been archived by the owner and is now read-only.
This bats-core repo is now the community-maintained Bats project.
The Bats Logo was created by Vukory (Github) and sponsored by SethFalco. If you want to use our logo, have a look at our guidelines.
© 2017-2024 bats-core organization
© 2011-2016 Sam Stephenson
Bats is released under an MIT-style license; see LICENSE.md
for details.
See the parent project at GitHub or the AUTHORS file for the current project maintainer team.
FAQs
Bash Automated Testing System
We found that bats demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.