Skip to content

Commit 8afb9bb

Browse files
committed
test: add hook failures to the test failures list
Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
1 parent 3ea736c commit 8afb9bb

File tree

1 file changed

+4
-2
lines changed
  • tests/acceptance/scripts

1 file changed

+4
-2
lines changed

tests/acceptance/scripts/run.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,16 @@ function run_behat_tests() {
258258
fi
259259
fi
260260

261-
FAILED_SCENARIO_PATHS_COLORED=`awk '/Failed scenarios:/',0 ${TEST_LOG_FILE} | grep -a feature`
261+
FAILED_SCENARIO_PATHS_COLORED=`awk '/Failed (scenarios|hooks):/',0 ${TEST_LOG_FILE} | grep -a feature`
262262
# There will be some ANSI escape codes for color in the FEATURE_COLORED var.
263263
# Strip them out so we can pass just the ordinary feature details to Behat.
264264
# Also strip everything after ".feature:XX", including text such as "(on line xx)" added by Behat indicating the failing step's line number.
265265
# Thanks to https://en.wikipedia.org/wiki/Tee_(command) and
266266
# https://stackoverflow.com/questions/23416278/how-to-strip-ansi-escape-sequences-from-a-variable
267267
# for ideas.
268-
FAILED_SCENARIO_PATHS=$(echo "${FAILED_SCENARIO_PATHS_COLORED}" | sed "s/\x1b[^m]*m//g" | sed 's/\(\.feature:[0-9]\+\).*/\1/')
268+
FAILED_SCENARIO_PATHS=$(echo "${FAILED_SCENARIO_PATHS_COLORED}" | sed "s/\x1b[^m]*m//g" | sed "s/AfterScenario \"//g" | sed 's/\(\.feature:[0-9]\+\).*/\1/')
269+
# remove duplicate scenario paths
270+
FAILED_SCENARIO_PATHS=$(echo "$FAILED_SCENARIO_PATHS" | awk '!seen[$0]++')
269271

270272
# If something else went wrong, and there were no failed scenarios,
271273
# then the awk, grep, sed command sequence above ends up with an empty string.

0 commit comments

Comments
 (0)