Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bats-core/bats-vscode

BATS (Bash Automated Testing System) language support for VSCode.
https://github.com/bats-core/bats-vscode

bats language-support shell testing-tools vscode

Last synced: 9 days ago
JSON representation

BATS (Bash Automated Testing System) language support for VSCode.

Awesome Lists containing this project

README

        

# BATS (Bash Automated Testing System) for VSCode

[![Current Version](https://img.shields.io/visual-studio-marketplace/v/jetmartin.bats.svg?color=emerald&label=Visual%20Studio%20Marketplace&logo=visual-studio-code&logoColor=blue&style=flat)
![Install Count](https://img.shields.io/visual-studio-marketplace/i/jetmartin.bats.svg?color=emerald&style=flat)
![downloads Count](https://img.shields.io/visual-studio-marketplace/d/jetmartin.bats.svg?color=emerald&style=flat)][marketplace]
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/bats-core/bats-vscode.svg?color=emerald&label=release&logoColor=white&logo=github&labelColor=grey)][github]
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg)][MIT]

This extension adds language support for the [Bats] (Bash Automated Testing System) testing framework to [VS Code][vscode].

## ![tada][_tada] Features

![Bats overview](images/bats.gif)

- [x] **Bats** language support for VSCode
- [x] Syntax highlighting for core functions
- [x] Syntax highlighting for community modules
- [x] Code Snippets for quick coding for core functions
- [x] Code Snippets for quick coding for community modules

[Bats logo][Bats]

## ![bat][_bat] Bats

[Bash Automated Testing System (2021)][bats-core] is a [community-maintained][@bats-core] Bats project.
> (c) 2011-2016 [Sam Stephenson][@sstephenson]\
> (c) 2017-2021 [bats-core organization][@bats-core]

Bats is a [TAP]-compliant testing framework for Bash. 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.

> ![Note][_information_source] \
> See [bats-core README][bats-readme] for documentation on how to use [Bats].

### Bats modules

Project | version | code snippets | syntax highlighting
:--- | ---: | :---: | :---:
| [![bats-core project][badge-core]][bats-core-l] | ![Y][_white_check_mark] | ![Y][_white_check_mark]
| [![bats-assert project][badge-assert]][bats-assert-l] | ![Y][_white_check_mark] | ![Y][_white_check_mark]
| [![bats-support project][badge-support]][bats-support-l] | ![N][_negative_squared_cross_mark] | ![Y][_white_check_mark]
| [![bats-file project][badge-file]][bats-file-l] | ![N][_negative_squared_cross_mark] | ![Y][_white_check_mark]
| [![bats-mock project][badge-mock]][bats-mock-l] | ![N][_negative_squared_cross_mark] | ![Y][_white_check_mark]

## ![scissors][_scissors] Snippets

These modules have snippets:

- [x]
- [x]
- [ ]
- [ ]
- [ ]

Type `BATS:*snippet*` to use snippets.

[![bats-core snippets][badge-core]][bats-core-l]

- [x] **BATS:env** : shebang.
- [x] **BATS:setup** : Setup function.
- [x] **BATS:teardown** : Teardown function.
- [x] **BATS:load** : Load common code.
- [x] **BATS:bats_load_library** : Load system-wide libraries.
- [x] **BATS:test** : Test case.
- [x] **BATS:status** : Test status code.
- [x] **BATS:output** : Test output.
- [x] **BATS:line** : Test line output.
- [x] **BATS:skip** : Skip test.

[![bats-assert snippets][badge-assert]][bats-assert-l]

- [x] **BATS:assert**
- [x] **BATS:assert_output**
- [x] **BATS:assert_line**
- [x] **BATS:assert_success**
- [x] **BATS:assert_failure**
- [x] **BATS:assert_equal**
- [x] **BATS:assert_not_equal**
- [x] **BATS:refute**
- [x] **BATS:refute_output**
- [x] **BATS:refute_line**

## ![flashlight][_flashlight] Syntax highlighting

These modules have syntax highlighting support:

- [x]
- [x]
- [x]
- [x]
- [x]

### ![art][_art] Color customizations

If you want `Bats` syntax highlighting to look different to `shellscript` syntax, you can change your user preferences or workspace settings (`.vscode/settings.json`).

Default theme, for `shellscript`:

![Bats overview](images/default_colours.png)

Example after saving the `editor.tokenColorCustomizations` settings below.

![Bats overview](images/custom_colours.png)

Add this to your VS Code settings.

```json
{
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "keyword.control.bats",
"settings": {
"foreground": "#9f1fd1",
"fontStyle": "italic"
}
},
{
"scope": "support.function.bats",
"settings": {
"foreground": "#d41515",
"fontStyle": "italic"
}
},
{
"scope": "support.variable.bats",
"settings": {
"foreground": "#329432",
"fontStyle": "italic"
}
}
]
}
}
```

[Bats logo][Bats]

## Installation

### Extension Marketplace

This extension is published in the [VSCode marketplace][marketplace].

1. Run [Install Extensions] from the [Command Palette]
1. Search and choose [**`bats`**][marketplace].

### Release Notes

See [Changelog].

### ![exclamation][_exclamation]Known Issues

[![GitHub issues](https://img.shields.io/github/issues/bats-core/bats-vscode.svg?color=tomato)][issues]

Feel free to report any [issues][new issue].

## Related Projects

If you like [Bats], you may also like [ShellCheck][shellcheck] and the [VSCode extension][vscode-shellcheck]

This extension was inspired by [sublime-bats].

## ![scroll][_scroll] License

[humans.txt][humanstxt]

[MIT]

[Bats]:
[v1.5.0]:
[sBats]:
[@sstephenson]:
[@bats-core]:
[TAP]:
[Bash]:
[bats-readme]:
[marketplace]:
[github]:
[issues]:
[new issue]:
[Changelog]:
[MIT]:
[humanstxt]:

[bats-core]:
[bats-assert]:
[bats-support]:
[bats-file]:
[bats-mock]:
[grayhemp-mock]:

[bats-core-l]:
[bats-assert-l]:
[bats-support-l]:
[bats-file-l]:
[bats-mock-l]:

[badge-core]:
[badge-assert]:
[badge-support]:
[badge-file]:
[badge-mock]:

[command palette]:
[install extensions]:
[Visual Studio Code]:
[vscode]:
[shellcheck]:
[vscode-shellcheck]:
[sublime-bats]:

[_art]:
[_bat]:
[_construction]:
[_copyright]:
[_exclamation]:
[_flashlight]:
[_information_source]:
[_negative_squared_cross_mark]:
[_scissors]:
[_scroll]:
[_tada]:
[_white_check_mark]: