Search code examples
javascriptjestjsstimulusjs

Jest disable massive dump of html element on error


I'm testing a stimulus controller with jest. Every time it gets an error, it dumps EVERY property of an HTML element, which is impossible to read and I can't see the error because it exceeds my scrollback buffer.

Output:

...lots..
      HTMLBRElement: [Function],
              HTMLButtonElement: [Function],
              HTMLCanvasElement: [Function],
              HTMLDataElement: [Function],
              HTMLDataListElement: [Function],
              HTMLDetailsElement: [Function],
              HTMLDialogElement: [Function],
              HTMLDirectoryElement: [Function],
              HTMLFieldSetElement: [Function],
              HTMLFontElement: [Function],
              HTMLFormElement: [Function],
... more ..

It's possible to redirect that output to a file, but I only need like the top 10 lines.


Solution

  • Ok of course. "I only need like the top 10 lines"

    yarn test test.js | head -n 40

    node complains about EPIPE but I'm happy.