bats-core / bats-vscode

BATS (Bash Automated Testing System) language support for VSCode.
MIT License
23 stars 7 forks source link
bats language-support shell testing-tools vscode

BATS (Bash Automated Testing System) for VSCode

Current Version Install Count downloads Count GitHub tag (latest SemVer) license

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

tada Features

Bats overview

Bats logo

bat Bats

Bash Automated Testing System (2021) is a community-maintained Bats project.

(c) 2011-2016 Sam Stephenson\ (c) 2017-2021 bats-core organization

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 \ See bats-core README for documentation on how to use Bats.

Bats modules

Project version code snippets syntax highlighting
https://github.com/bats-core/bats-core bats-core project Y Y
https://github.com/bats-core/bats-assert bats-assert project Y Y
https://github.com/bats-core/bats-support bats-support project N Y
https://github.com/bats-core/bats-file bats-file project N Y
https://github.com/lox/bats-mock bats-mock project N Y

scissors Snippets

These modules have snippets:

Type BATS:*snippet* to use snippets.

bats-core snippets

bats-assert snippets

flashlight Syntax highlighting

These modules have syntax highlighting support:

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

Example after saving the editor.tokenColorCustomizations settings below.

Bats overview

Add this to your VS Code settings.

{
    "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

Installation

Extension Marketplace

This extension is published in the VSCode marketplace.

  1. Run Install Extensions from the Command Palette
  2. Search and choose bats.

Release Notes

See Changelog.

exclamationKnown Issues

GitHub issues

Feel free to report any issues.

Related Projects

If you like Bats, you may also like ShellCheck and the VSCode extension

This extension was inspired by sublime-bats.

scroll License

humans.txt

MIT