jest-bats
Run Bats tests with Jest
jest-bats is a simple jest
plugin that
enables testing bash scripts in a npm
project.
It uses bats
under the hood to run
the tests, and transforms the results to a format that jest understands.
Install
npm install --save-dev jest-bats
Usage
jest-bats should be configured as a jest preset. You will most likely want to
include it in the 'projects' option of jest, as this will enable support for
both bats and javascript tests. To do so, simply add this to your
package.json
:
{
"jest": {
"projects": [
{ "preset": "jest-bats" },
{ "displayName": "node" }
]
}
}
If you only have bats scripts to test in your project, you can set jest-bats as
the global preset in your package.json
:
{ "jest": { "preset": "jest-bats" } }
.
For a live example, you can check this project's jest.config.js file and sample tests under the examples folder.
License
jest-bats is MIT licensed