15

I have a test suite/file that I have disabled. It has an associated snapshot file. For my particular situation I do not want to delete or update the snapshot file (long-story-short: it is used elsewhere).

So, Jest logs out just a warning, rather than a failure, for the obsolete snapshot. However Jest then exits with code 1 and my build fails. This happens despite no test actually failing.

Can I tweek the config to ignore obsolete snapshots? Or is there some other way to have Jest exit with code 0 after only a warning?

enter image description here

skyboyer
  • 22,209
  • 7
  • 57
  • 64
cham
  • 8,666
  • 9
  • 48
  • 69

1 Answers1

1

Add --silent to your test-ui script in the projects package.json

Mario Perez
  • 2,777
  • 1
  • 12
  • 21
  • For others, the documentation says "Prevent tests from printing messages through the console." If this causes "Jest exit with code 0 after only a warning" then I'd be surprised. – MatthewMartin May 02 '23 at 12:12