| Q |
A |
| OS |
Linux |
| Shell & version |
bash 5.3.8 |
| bashunit version |
beta / 0.28.0 |
Summary
When changing the directory in set_up_before_script, subsequent tests in other files do not get executed.
How to reproduce
Create the following two files and run bashunit.
#!/usr/bin/env bash
# tests/change-dir.test.sh
function set_up_before_script() {
cd "$(temp_dir)" || return 1
}
function test_a() {
assert_equals a a
}
#!/bin/env bash
# tests/second-test.sh
test_b() {
assert_equals b b
}
Expected behavior
Both tests should run and the output should look like this, like is the case when not changing directory in set_up_before_script:
bashunit - 0.28.0 | Tests: 2
Running tests/change-dir.test.sh
✓ Passed: A 24 ms
Running tests/second-test.sh
✓ Passed: B 25 ms
Tests: 2 passed, 2 total
Assertions: 2 passed, 2 total
Actual Behavior
Only test_a runs and the output looks like this:
bashunit - 0.28.0 | Tests: 2
Running tests/change-dir.test.sh
grep: tests/change-dir.test.sh: No such file or directory
✓ Passed: A 24 ms
Tests: 1 passed, 1 total
Assertions: 1 passed, 1 total
All tests passed
Time taken: 99 m
Summary
When changing the directory in
set_up_before_script, subsequent tests in other files do not get executed.How to reproduce
Create the following two files and run bashunit.
Expected behavior
Both tests should run and the output should look like this, like is the case when not changing directory in
set_up_before_script:Actual Behavior
Only
test_aruns and the output looks like this: