Skip to content

Invert failure output #38

@darcyrush

Description

@darcyrush

I'm not sure this is the same as issue #3, but currently the parser outputs the assertion message, ID and error details of a failed test when it fails, and outputs the assertion message and ID in the summary.

IMHO I believe a better approach would be to 'invert' the failure output to output the assertion message and ID when it fails, and output the assertion message, ID and details of the failed test in the summary.

This would match the modern node:test library in terms of the UI and DX. It makes both large and small test suites much easier to use since you only need to scroll a few lines to see why and where an error happened as opposed to potentially hundreds or even thousands.

In our case, we have a very large test suite and the summary output is useless because we have many duplicated assertion messages meaning we cannot uniquely search them, and since the errors happen early in the test suite, the terminal history is exhausted so we cannot scroll to see why tests failed.

Current;

example failed test
    ✓ should be deeply equivalent
    ✗ [30] should be deeply equivalent
        Actual:   "{ method: 'GET', url: 'hostUrl/example' }"
        Expected: {"method":"POST","url":"hostUrl/example" }
        At: <anonymous> (/test/unit/example.test.ts:1:1)

Failed tests: There was 1 failure

    ✗ [30] should be deeply equivalent

Proposed;

example failed test
    ✓ should be deeply equivalent
    ✗ [30] should be deeply equivalent

Failed tests: There was 1 failure

✗ [30] should be deeply equivalent
        Actual:   "{ method: 'GET', url: 'hostUrl/example' }"
        Expected: {"method":"POST","url":"hostUrl/example" }
        At: <anonymous> (/test/unit/example.test.ts:1:1)

As a workaround we are using --bail, but this is not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions