mattphillips/jest-expect-message

Slight modification to stack output.

Gazook89 opened this issue · 0 comments

Feature Request

Description:
I don't think this is currently possible, please correct me if I am wrong: I would like to have the output exclude the portion that shows me the relevant test in my test file...everything after the expected: / received:. Here is an example of my output right now:

Block: When using the Block syntax {{tags\ntext\n}} › Renders a div with a class, style and text

    Input:
    {{cat,color:red
    Sample text.
    }}

    expect(received).toBe(expected) // Object.is equality

    Expected: "<div class=\"block cat\" style=\"color:red;\"><p>Sample text.</p></div>"
    Received: "<div class=\"block cat\"  style=\"color:red;\"><p>Sample text.</p></div>"

      172 |             }}`;
      173 |             const rendered = Markdown.render(source).trimReturns();
    > 174 |             expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class="block cat" style="color:red;"><p>Sample text.</p></div>`);
          |                                                                          ^
      175 |     });
      176 |
      177 |     it('Renders a div with an ID, class, style and text (different order)', function() {

      at Object.toBe (tests/markdown/mustache-syntax.test.js:174:64)

Everything from the "line 172" on down is not very helpful, at least in my case, but takes consider space in the full output when doing many similar tests.

I have tried the showMatcherMessage and showStack options, but no combination of the two removes just this portion without also affecting the display of the Expected/Received, which I still need.

Possible solution:
Not sure how it figures into this library, but I can disable the stack as described above with just using the Jest CLI option --noStackTrace. I'm not sure why showStack: false doesn't have the exact same result? I'm not sure if this a bug, or a feature request.