Open isaiahshiner opened 1 year ago
The important thing for this to work automatically is to know if there is a way to detect that this flag was passed. I couldn't find any info about this topic.
Otherwise, not outputting the stack trace doesn't require much change. Here's the place where we output it: https://github.com/ValentinH/jest-fail-on-console/blob/main/index.js#L27
Thanks for the quick response! I see that it's not nearly as much code as I was picturing, I'll see if I can get a pull request together, maybe later in the month. I'll also see if I can find out if Jest makes the flag status available anywhere.
Is it possible for this library to support the
--noStackTrace
Jest flag out of the box? That is, allconsole.x
should still cause an error, and printexpected not to call...
but have no stack trace? It looks like this might be possible with a custom error message, but it might make sense for it to work automatically. I also might like to always have no stack traces for fail on console, but that's a stretch goal. I could also consider a PR if you could point me in the right direction.If it should work and I have something wrong, let me post my exact behavior. Jest is run as a script through pnpm, so my actual command and output looks like this:
pnpm jest -- TheTestToRun
When using
pnpm jest -- --silent --noStackTrace TheTestToRun
, I get the exact same output.