Skip to content

FailureReport's exit() causes exception backtrace to not get output #58

@cgriego

Description

@cgriego

Given a project using --failure-threshold and an uncaught exception being raised (one outside of a test/spec), some/all of the tests/specs will fail to execute, resulting in threshold not being met. At this point, the FailureReport formatter will kick in, notice the coverage failure, and call exit(1), to ensure an error exit code, which raises a SystemExit. The SystemExit causes the original exception's backtrace to not get output.

This is affecting my team's ability to diagnose test failures that happen as a result of an initialization failure (database connection problem, configuration problem, etc.) because the underlying exception isn't visible, but instead we simply see a 0% coverage error.

I'm unsure what would be the best solution to this would be, but here are two options that seemed to work when tried. One is not to raise SystemExit when an exception has already been raised using exit(1) if $__rcov_exit_exception.nil?. The exit code will still be non-zero because of the original exception. Another is to register the SystemExit as an after_exit hook using after_exit { exit(1) }.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions