https://github.com/transpiria/bocker
Bocker is a simple mocker for bash.
https://github.com/transpiria/bocker
bash bats mock
Last synced: 4 months ago
JSON representation
Bocker is a simple mocker for bash.
- Host: GitHub
- URL: https://github.com/transpiria/bocker
- Owner: Transpiria
- License: unlicense
- Created: 2022-01-15T03:55:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-08T19:36:37.000Z (about 3 years ago)
- Last Synced: 2025-06-05T18:47:50.624Z (4 months ago)
- Topics: bash, bats, mock
- Language: Shell
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Bocker
[](https://app.circleci.com/pipelines/github/Transpiria/bocker)
[](https://www.npmjs.com/package/bocker)Bocker is a simple mocker for bats.
## Installation
### Npm
Install bocker with [npm](https://www.npmjs.com).
```shell
npm install -D bocker
```## Usage
See [examples](examples) for examples.
### Setup
Load bocker in the test file.
```shell
load bocker
```### Cleanup
Clean up the temporary files used during the test run by adding bock_teardown to the test teardown method.
```shell
function teardown() {
bock_teardown
}
```### Arrange
Sets up a mock of a call.
```shell
arrange [options] call [arguments] -- [does]
```#### Options
Options applied to the mock.
|Option|Description|
|---|---|#### Arguments
A list of arguments and/or conditions use to match the call
##### anyargs
Matches any remaining arguments.
##### any
Matches any argument.
##### has
Matches a sequence of arguments in the call.
```shell
# usage
has[-sequence count] sequence# examples
has foo
has-1 foo
has-2 foo bar
```#### Does
What the mocked call will do when executed.
### Verify
Verifies a mock was run or not.
```shell
verify [options] call [arguments]
```