Jest failed tests no longer provide failure info, only `maxLength` error

Viewed 23

In my project we had Jest running just fine and as far as I know no test dependencies were changed. When tests would fail it would log out the details of what was expected versus what was received. But if I have a failing test now (or try to make it fail like the following example) all I get is an error around pretty-format options:

when provided no parameters other than text › default values are set correctly

    pretty-format: Unknown option "maxWidth".

      48 |
      49 |     it('default values are set correctly', async () => {
    > 50 |       expect(element.variant).toBe('primarzy');

It should be telling me that it expected "primarzy" (misspelled on purpose) but got "primary". This is happening no matter which test suite has a failed test.

1 Answers

So for anyone else who encounters this, apparently different packages in my test dependencies were trying to run different versions of pretty-format breaking failed test output. The fix for me was just manually installing pretty-format: npm i pretty-format --save-dev Everything works fine after that.

Related