File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 44function set_up_before_script() {
55 TEST_ENV_FILE=" tests/acceptance/fixtures/.env.default"
66 LCOV_FILE=" $( bashunit::temp_file " lcov-output" ) "
7+ LCOV_FILE_EXTERNAL=" $( bashunit::temp_file " lcov-external" ) "
78}
89
910function test_coverage_includes_src_hits_from_setup_hook() {
@@ -27,3 +28,21 @@ function test_coverage_includes_src_hits_from_setup_hook() {
2728 assert_contains " SF:$( pwd) /src/" " $lcov "
2829 assert_contains " DA:" " $lcov "
2930}
31+
32+ function test_coverage_hooks_via_external_bashunit() {
33+ # Run bashunit on fixture with coverage enabled and verify hook code is tracked
34+ local output
35+ output=$( BASHUNIT_COVERAGE=true \
36+ BASHUNIT_COVERAGE_PATHS=" src/" \
37+ BASHUNIT_COVERAGE_REPORT=" $LCOV_FILE_EXTERNAL " \
38+ ./bashunit tests/acceptance/fixtures/test_coverage_hooks.sh --simple 2>&1 )
39+
40+ assert_successful_code
41+
42+ # Verify LCOV file was created with coverage data
43+ assert_file_exists " $LCOV_FILE_EXTERNAL "
44+ local lcov
45+ lcov=" $( cat " $LCOV_FILE_EXTERNAL " 2> /dev/null) "
46+ assert_contains " SF:" " $lcov "
47+ assert_contains " DA:" " $lcov "
48+ }
You can’t perform that action at this time.
0 commit comments