Skip to content

Jest reporter doesn't show failing arguments #16

@chrismilleruk

Description

@chrismilleruk

While experimenting with this library, I found an issue that seemingly makes it very difficult to work with. It could be that I'm doing something wrong, or that there have been changes in jest since this library was last updated.

Demonstration code:
https://github.com/chrismilleruk/testapp/tree/kitimat-jest

Given a simple generative test which fails:

check('Always starts with a letter', 
  [string(), string()], 
  (generatedPrefix, generatedName) => {
  const module = new Greeting(generatedPrefix);
  const result = module.sayHello(generatedName);

  // Always starts with a letter
  expect(result[0]).toMatch(/[A-Za-z]/);
});

The reporter output doesn't provide

  • the arguments which caused the failure.
  • the seed used to create the arguments.
...
✕ Always starts with a letter (seed: undefined, source: undefined) (26ms)
✓ Has four basic formats (33ms)

● Greeting Class › Always starts with a letter (seed: undefined, source: undefined)

expect(received).toMatch(expected)

Expected pattern: /[A-Za-z]/
Received string:  " "

  37 |
  38 |     // Always starts with a letter
> 39 |     expect(result[0]).toMatch(/[A-Za-z]/);
     |                       ^
  40 |   });
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions