Skip to content

Commit fa919ed

Browse files
committed
Merge branch 'main' into fix-test-doubles
Conflicts: tests/functional/doubles_test.sh
2 parents 467bb02 + bd46555 commit fa919ed

122 files changed

Lines changed: 902 additions & 273 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ BASHUNIT_HEADER_ASCII_ART=
1111
BASHUNIT_SIMPLE_OUTPUT=
1212
BASHUNIT_STOP_ON_FAILURE=
1313
BASHUNIT_SHOW_EXECUTION_TIME=
14-
BASHUNIT_DEV_MODE=

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Run tests
4343
shell: bash
4444
run: |
45-
./bashunit tests/${{ matrix.test_chunk }}/*_test.sh
45+
./bashunit --parallel tests/${{ matrix.test_chunk }}/*_test.sh
4646
4747
alpine:
4848
name: "On alpine-latest"

CHANGELOG.md

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

3+
## Unreleased
4+
5+
- Fix asserts on test doubles in subshell
6+
- Allow interpolating arguments in data providers output
7+
- Deprecate `# data_provider` in favor of `# @data_provider`
8+
- Allow `assert_have_been_called_with` to check arguments of specific calls
9+
- Enable parallel tests on Windows
10+
- Add `assert_not_called`
11+
- Improve `find_total_tests` performance
12+
13+
## [0.19.1](https://github.com/TypedDevs/bashunit/compare/0.19.0...0.19.1) - 2025-05-23
14+
15+
- Replace `#!/bin/bash` with `#!/usr/bin/env bash`
16+
- Usage printf with awk, which correctly handles float rounding and improves portability
17+
18+
## [0.19.0](https://github.com/TypedDevs/bashunit/compare/0.18.0...0.19.0) - 2025-02-19
19+
20+
- Fixed false negative with `set -e`
21+
- Fixed name rendered when having `test_test_*`
22+
- Fixed duplicate function detection
23+
- Fixed display test with multiple outputs in multiline
24+
- Improved output: adding a space between each test file
25+
- Removed `BASHUNIT_DEV_MODE` in favor of `BASHUNIT_DEV_LOG`
26+
- Added source file and line on global dev function `log`
27+
328
## [0.18.0](https://github.com/TypedDevs/bashunit/compare/0.17.0...0.18.0) - 2024-10-16
429

530
- Added `-p|--parallel` to enable running tests in parallel

adrs/adr-004-metadata-prefix.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Title: Prefix metadata comments with @
2+
3+
* Status: accepted
4+
* Authors: @Chemaclass
5+
* Date: 2025-05-29
6+
7+
8+
## Context and Problem Statement
9+
10+
Data providers are defined via a special comment `# data_provider`. We want to
11+
clearly differentiate these meta comments from ordinary comments.
12+
13+
## Considered Options
14+
15+
* Keep using `# data_provider` as is.
16+
* Introduce an `@` prefix for special comments while supporting the old syntax.
17+
18+
## Decision Outcome
19+
20+
We decided to prefix the metadata provider directives with `@`,
21+
eg: using `# @data_provider provider_name`.
22+
23+
> The previous form without the prefix is still supported for backward compatibility but is now deprecated.
24+
25+
### Positive Consequences
26+
27+
* Highlights special bashunit directives clearly.
28+
* Allows future directives to consistently use the `@` prefix.
29+
30+
### Negative Consequences
31+
32+
* Projects must eventually update old comments to the new syntax.
33+
34+
## Technical Details
35+
36+
`helper::get_provider_data` now matches both `# @data_provider` and the old
37+
`# data_provider` when locating provider functions.

bashunit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -euo pipefail
33

44
# shellcheck disable=SC2034
5-
declare -r BASHUNIT_VERSION="0.18.0"
5+
declare -r BASHUNIT_VERSION="0.19.1"
66

77
# shellcheck disable=SC2155
88
declare -r BASHUNIT_ROOT_DIR="$(dirname "${BASH_SOURCE[0]}")"

bin/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
echo "Running pre-commit checks"
33

44
make pre_commit/run

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
source src/check_os.sh
44

@@ -37,7 +37,7 @@ function build::generate_bin() {
3737
local temp
3838
temp="$(dirname "$out")/temp.sh"
3939

40-
echo '#!/bin/bash' > "$temp"
40+
echo '#!/usr/bin/env bash' > "$temp"
4141
echo "Generating bashunit in the '$(dirname "$out")' folder..."
4242

4343
for file in $(build::dependencies); do

docs/blog/2024-09-01-release-0-15.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ BASHUNIT_REPORT_HTML=
5151

5252
::: code-group
5353
```bash [example_test.sh]
54-
# data_provider provider_directories
54+
# @data_provider provider_directories
5555
function test_directory_exists() {
5656
local outro=$1
5757
local directory=$2

docs/command-line.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ Creates a report XML file that follows the JUnit XML format and contains informa
129129
130130
bashunit provides an option to run each test in a separate child process, allowing you to parallelize the test execution and potentially speed up the testing process. When running in parallel mode, the execution order of tests is randomized.
131131

132+
::: warning
133+
Parallel mode is supported on **macOS**, **Ubuntu**, and **Windows**. On other
134+
systems (like Alpine Linux) the option is automatically disabled due to
135+
inconsistent results. In those environments consider using `--no-parallel`.
136+
:::
137+
132138
::: code-group
133139
```bash [Example]
134140
./bashunit ./tests --parallel
@@ -304,7 +310,6 @@ BASHUNIT_HEADER_ASCII_ART: false
304310
BASHUNIT_SIMPLE_OUTPUT: false
305311
BASHUNIT_STOP_ON_FAILURE: false
306312
BASHUNIT_SHOW_EXECUTION_TIME: true
307-
BASHUNIT_DEV_MODE: true
308313
BASHUNIT_VERBOSE: true
309314
########################################################################################################################################
310315

docs/configuration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ BASHUNIT_SIMPLE_OUTPUT=false
6868
6969
Runs the tests in child processes with randomized execution, which may improve overall testing speed, especially for larger test suites.
7070

71+
::: warning
72+
Parallel execution is supported only on **macOS** and **Ubuntu**. On other
73+
systems bashunit forces sequential execution to avoid inconsistent results.
74+
:::
75+
7176
Similar as using `-p|--parallel` option on the [command line](/command-line#parallel).
7277

7378

0 commit comments

Comments
 (0)