https://github.com/targendaz2/bats-zsh
Plugin enabling Bats to test Zsh scripts
https://github.com/targendaz2/bats-zsh
assert bash bats helper shell test zsh zshell
Last synced: 8 months ago
JSON representation
Plugin enabling Bats to test Zsh scripts
- Host: GitHub
- URL: https://github.com/targendaz2/bats-zsh
- Owner: targendaz2
- License: cc0-1.0
- Created: 2023-05-06T13:40:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T07:40:32.000Z (over 1 year ago)
- Last Synced: 2025-02-02T04:04:59.795Z (8 months ago)
- Topics: assert, bash, bats, helper, shell, test, zsh, zshell
- Language: Shell
- Homepage:
- Size: 125 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# bats-zsh



Plugin enabling [Bats](https://github.com/bats-core/bats-core) to source and test Zsh scripts.
## Installation
This package is available on the npm registry as `bats-zsh`.
```bash
npm install -D bats bats-support bats-zsh
```## Usage
This project provides the following functions:
### `zset`
Used to set or change global variables in the sourced files.
```bash
@test 'say_my_name() outputs \$MY_NAME'{
zsource path/to/zsh-file.shzrun say_my_name
[ "$output" = "You don't have a name" ]
zset MY_NAME="David"
zrun say_my_name
[ "$output" = "Your name is David" ]
}
```### Testing
1. Clone this repository:
`git clone https://github.com/targendaz2/bats-zsh.git`
2. Install global dependencies:
[Node.js](https://nodejs.org/en/download/package-manager), [ShellCheck](https://github.com/koalaman/shellcheck#user-content-installing), & [Zsh](https://nodejs.org/en/download/package-manager)
3. Install project dependencies:
`yarn install`
4. Run shellcheck:
`yarn lint`
5. Run tests:
`yarn test`## Contributing
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
This package is licensed under the [Creative Commons Zero v1.0 Universal License](https://github.com/targendaz2/bats-zsh/blob/main/LICENSE).