Helpers and assertions for BATS testing.
Documentation
npm install -D bats-helpers@npm:@drevops/bats-helpers
-
Create a
_loader.bash
file next to your BATS tests with content:export BATS_LIB_PATH="${BATS_TEST_DIRNAME}/../node_modules" bats_load_library bats-helpers
-
Use
load _loader.bash
in every BATS file:#!/usr/bin/env bats load _loader @test "My test" { run ls assert_success }
The goal is to merge this package with bats-assert.
However:
- This package has more assertions and tests. They were battle-tested on many projects and were waiting for BATS to provide support for library functionality to be extracted into a standalone package.
- Those packages have outdated version constraints which leads to conflicts.
The mocking functionality is based on the bats-mock project. A special thank you to the contributors for their original work.
npm install
npm run lint
npm run test
npm version minor
git push
npm publish
Repository created using https://getscaffold.dev/ project scaffold template