This repository contains common scripts for use in Blockchain build pipelines.
Make sure you have installed jq before attempting to run the test cases on your local system.
This project is tested using Bats when making pull requests.
To run the tests locally, install bats-core and bats-mock. Here are a few tips on installing these two libraries so you don't go into a rabbit hole when attempting to run the test cases.
You should install bats-core from source. After you have cloned bats-core into the directory of your choosing, navigate to that folder and run the ./install.sh script by passing the absolute path to the folder where this repository (i.e. build-lib) was cloned into your local system and appending bats folder to that path as shown below:
./install.sh <absolute path to the build-lib repository>/bats
Executing the install.sh script should result in the creation of a bats folder under the build-lib repository; this bats folder contains the bats-core files.
To install bats-mock, first create an empty folder named bats-mock under the build-lib repository. Then clone the bats-mock repository into the directory of your choosing; navigate to that folder, copy the binstub and stub.bash files into the bats-mock you created under the build-lib repository.
mkdir <absolute path to the build-lib repository>/bats-mock
cp binstub stub.bash <absolute path to the build-lib repository>/bats-mock
If running on a Mac OS machine, you may have to use a package installer (i.e. Homebrew) to install the greadlink binary.
brew install coreutils
Once you have installed bats-core and bats-mock as described the sections above, you can then run the following command from the root directory of this repository:
PATH="./bats/bin:$PATH" bats test/*