Skip to content

Commit 8f08f33

Browse files
authored
Merge pull request #553 from TypedDevs/fix/flaky-tests
Fix flaky tests when running --strict
2 parents bc6c5a4 + 18edfca commit 8f08f33

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Fix internal flaky tests when running `--strict`
6+
37
## [0.29.0](https://github.com/TypedDevs/bashunit/compare/0.28.0...0.29.0) - 2025-12-08
48

59
### Added

tests/acceptance/bashunit_strict_mode_test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ function set_up_before_script() {
66

77
function test_permissive_mode_allows_unset_variables() {
88
local output
9-
output=$(BASHUNIT_STRICT_MODE=false ./bashunit --no-parallel --simple --env "$TEST_ENV_FILE" \
9+
output=$(BASHUNIT_STRICT_MODE=false ./bashunit --no-parallel --simple --preserve-env --env "$TEST_ENV_FILE" \
1010
tests/acceptance/fixtures/strict_mode_unset_variable.sh 2>&1) || true
1111

1212
assert_contains "All tests passed" "$output"
1313
}
1414

1515
function test_strict_mode_fails_on_unset_variables() {
1616
local output
17-
output=$(BASHUNIT_STRICT_MODE=true ./bashunit --no-parallel --simple --env "$TEST_ENV_FILE" \
17+
output=$(BASHUNIT_STRICT_MODE=true ./bashunit --no-parallel --simple --preserve-env --env "$TEST_ENV_FILE" \
1818
tests/acceptance/fixtures/strict_mode_unset_variable.sh 2>&1) || true
1919

2020
assert_contains "failed" "$output"
2121
}
2222

2323
function test_permissive_mode_allows_nonzero_returns() {
2424
local output
25-
output=$(BASHUNIT_STRICT_MODE=false ./bashunit --no-parallel --simple --env "$TEST_ENV_FILE" \
25+
output=$(BASHUNIT_STRICT_MODE=false ./bashunit --no-parallel --simple --preserve-env --env "$TEST_ENV_FILE" \
2626
tests/acceptance/fixtures/strict_mode_nonzero_return.sh 2>&1) || true
2727

2828
assert_contains "All tests passed" "$output"
2929
}
3030

3131
function test_strict_mode_fails_on_nonzero_returns() {
3232
local output
33-
output=$(BASHUNIT_STRICT_MODE=true ./bashunit --no-parallel --simple --env "$TEST_ENV_FILE" \
33+
output=$(BASHUNIT_STRICT_MODE=true ./bashunit --no-parallel --simple --preserve-env --env "$TEST_ENV_FILE" \
3434
tests/acceptance/fixtures/strict_mode_nonzero_return.sh 2>&1) || true
3535

3636
assert_contains "failed" "$output"
3737
}
3838

3939
function test_cli_flag_overrides_env_var() {
4040
local output
41-
output=$(BASHUNIT_STRICT_MODE=false ./bashunit --no-parallel --simple --strict --env "$TEST_ENV_FILE" \
41+
output=$(BASHUNIT_STRICT_MODE=false ./bashunit --no-parallel --simple --preserve-env --strict --env "$TEST_ENV_FILE" \
4242
tests/acceptance/fixtures/strict_mode_unset_variable.sh 2>&1) || true
4343

4444
assert_contains "failed" "$output"

0 commit comments

Comments
 (0)