tap: Exit with failure code only if environment variable is set

This commit is contained in:
retropikzel 2026-08-15 15:56:03 +03:00
parent 0835e52c53
commit 8bff17c6c7
1 changed files with 7 additions and 5 deletions

View File

@ -103,10 +103,10 @@
(let ((value (test-result-ref runner key)))
(if value (any->string value) "")))))
(let* ((failed? (or (equal? result 'fail) (equal? result 'xfail))))
(when failed?
(set! exit-with-fail? #t)
(print "not "))
(print "ok " current-test-group-count)
(cond (failed?
(set! exit-with-fail? #t)
(print "not ok " current-test-group-count))
(else (print "ok " current-test-group-count)))
(if (and (string? name) (not (string=? name "")))
(println " - " name)
(println ""))
@ -124,6 +124,8 @@
(test-runner-on-final!
runner
(lambda (runner)
(when exit-with-fail? (exit 1))))
(when (and (get-environment-variable "SCM_TAP_EXIT_FAIL")
exit-with-fail?)
(exit 1))))
runner))))