Skip to content

Commit

Permalink
feat: run log only on dev_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Oct 13, 2024
1 parent 58a3407 commit f63ae3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ function cleanup_temp_files() {

# shellcheck disable=SC2145
function log() {
if ! env::is_dev_mode_enabled; then
return
fi

local level="$1"
shift

Expand Down
8 changes: 8 additions & 0 deletions tests/unit/globals_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ function tear_down() {
rm "$BASHUNIT_DEV_LOG"
}

function set_up_before_script() {
export BASHUNIT_DEV_MODE=true
}

function tear_down_after_script() {
export BASHUNIT_DEV_MODE=$_DEFAULT_DEV_MODE
}

function test_globals_current_dir() {
assert_same "tests/unit" "$(current_dir)"
}
Expand Down

0 comments on commit f63ae3a

Please sign in to comment.