Home > database >  Why does Jest sometimes prints "pretty" error messages with line pointers, and sometimes n
Why does Jest sometimes prints "pretty" error messages with line pointers, and sometimes n

Time:01-08

I have jest 27 installed, and I see that sometimes I get pretty error messages like this (with visual pointer to the failing line): enter image description here

And sometimes it prints the errors like this (plain error, without pointer): enter image description here

I am trying to understand why it happens, can someone help me with that?

CodePudding user response:

Ok, after doing some investigations, it seems like the difference is if the error happens in node_modules or not. If the error is thrown within the project's root, jest will print a pretty message with a pointer to the line that caused the error. But if the error happens from within the node_modules folder, Jest will print the error message along with the stack trace, without any visual pointers.

  •  Tags:  
  • Related