Skip to content

Commit

Permalink
Merge branch 'main' into strictmode
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
antonio-gg-dev committed Mar 3, 2024
2 parents 6884e4c + 1b1ff46 commit e464032
Show file tree
Hide file tree
Showing 27 changed files with 532 additions and 915 deletions.
15 changes: 3 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,25 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

[**.sh]
indent_style = space
indent_size = 2

[**.sh]
max_line_length = 120

[**.md]
indent_style = space
indent_size = 4

[**.ts]
indent_style = space
indent_size = 2
max_line_length = 120

[**.css]
indent_style = space
indent_size = 2
max_line_length = 120

[**.json]
indent_style = space
indent_size = 2

[docs/**.md] # YAML support
indent_size = 2

[{Makefile,**.mk}]
[{Makefile,**.mk,.git*}]
indent_style = tab

[{tests/acceptance/**.sh,src/console_header.sh}]
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Changelog

## [Unreleased](https://github.com/TypedDevs/bashunit/compare/0.10.1...main)
## [Unreleased](https://github.com/TypedDevs/bashunit/compare/0.11.0...main)

- Support tests written using Bash's errexit (-e), nounset (-u), and pipefail options ("unofficial strict mode").

## [0.11.0](https://github.com/TypedDevs/bashunit/compare/0.10.1...0.11.0) - 2024-03-02

- Add `--upgrade` option to `./bashunit`
- Remove support to deprecated `setUp`, `tearDown`, `setUpBeforeScript` and `tearDownAfterScript` functions
- Optimize test execution time
- Support tests written using Bash's errexit (-e), nounset (-u), and pipefail options ("unofficial strict mode").
- Test functions are now run in the order they're defined in a test file
- Increase contrast of test results

## [0.10.1](https://github.com/TypedDevs/bashunit/compare/0.10.0...0.10.1) - 2023-11-13

Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ endif

help:
@echo ""
@echo "usage: make COMMAND"
@echo "Usage: make [command]"
@echo ""
@echo "Commands:"
@echo " test Run the test"
@echo " test/list List all the test under the tests directory"
@echo " test/watch Automatically run the test every second"
@echo " env/example Makes a copy of the keys on your .env file"
@echo " pre_commit/install Installs the pre-commit hook"
@echo " pre_commit/run Function that will be called when the pre-commit runs"
@echo " test Run the tests"
@echo " test/list List all tests under the tests directory"
@echo " test/watch Automatically run tests every second"
@echo " env/example Copy variables without the values from .env into .env.example"
@echo " pre_commit/install Install the pre-commit hook"
@echo " pre_commit/run Function that will be called when the pre-commit hook runs"
@echo " sa Run shellcheck static analysis tool"
@echo " lint Run editorconfig linter tool"

Expand All @@ -68,25 +68,25 @@ test/watch: $(TEST_SCRIPTS)
@fswatch -m poll_monitor -or $(SRC_SCRIPTS_DIR) $(TEST_SCRIPTS_DIR) .env Makefile | xargs -n1 ./bashunit $(TEST_SCRIPTS)

env/example:
@echo "Copy the .env into the .env.example file without the values"
@echo "Copying variables without the values from .env into .env.example"
@sed 's/=.*/=/' .env > .env.example

pre_commit/install:
@echo "Installing pre-commit hooks"
@echo "Installing pre-commit hook"
cp $(PRE_COMMIT_SCRIPTS_FILE) $(GIT_DIR)/hooks/

pre_commit/run: test sa lint env/example

sa:
ifndef STATIC_ANALYSIS_CHECKER
@printf "\e[1m\e[31m%s\e[0m\n" "Shellcheck not installed: Static analisys not preformed!" && exit 1
@printf "\e[1m\e[31m%s\e[0m\n" "Shellcheck not installed: Static analysis not performed!" && exit 1
else
@shellcheck ./**/*.sh -C && printf "\e[1m\e[32m%s\e[0m\n" "ShellCheck: OK!"
endif

lint:
ifndef LINTER_CHECKER
@printf "\e[1m\e[31m%s\e[0m\n" "Editorconfig not installed: Lint not preformed!" && exit 1
@printf "\e[1m\e[31m%s\e[0m\n" "Editorconfig not installed: Lint not performed!" && exit 1
else
@ec -config .editorconfig && printf "\e[1m\e[32m%s\e[0m\n" "editorconfig-check: OK!"
endif
2 changes: 1 addition & 1 deletion bashunit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

# shellcheck disable=SC2034
declare -r BASHUNIT_VERSION="0.10.1"
declare -r BASHUNIT_VERSION="0.11.0"

readonly BASHUNIT_ROOT_DIR="$(dirname "${BASH_SOURCE[0]}")"
export BASHUNIT_ROOT_DIR
Expand Down
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

mkdir -p bin

cat src/*.sh > bin/temp.sh
echo '#!/usr/bin/env bash' > bin/temp.sh

cat src/*.sh >> bin/temp.sh
cat bashunit >> bin/temp.sh
grep -v '^source' bin/temp.sh > bin/bashunit
rm bin/temp.sh
Expand Down
2 changes: 1 addition & 1 deletion docs/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Arguments:
Specifies the directory or file containing [...]
Options:
-f|--filer
-f|--filter
Filters the tests to run based on the test name.
[...]
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# shellcheck disable=SC2164
# shellcheck disable=SC2103

declare -r LATEST_BASHUNIT_VERSION="0.10.1"
declare -r LATEST_BASHUNIT_VERSION="0.11.0"

DIR=${1-lib}
VERSION=${2-latest}
Expand Down
Loading

0 comments on commit e464032

Please sign in to comment.