6 Ways to Run Jest Test Cases Silently

A detailed guide on how to turn off console information

Jennifer Fu
The Startup

--

Among all types of tests, unit tests reside at the bottom of the Test Pyramid. Each unit test case verifies one specific point of the software logic, with a very narrow and well-defined scope. Since unit tests are nimble and fast, the number of unit tests should largely outnumber any other types of tests.

With a large amount of test cases, there might be a large amount of console information from the code, which you may not have control of.

The console object provides access to browsers’ debugging console. A number of methods are provided by the console object:

The most frequently-used feature of the console is logging information. The popular methods are:

  • console.log(): Prints out a debug message to the console.
  • console.debug(): An alias for console.log.
  • console.info(): Prints out an information message to the console.
  • console.warn(): Prints out a warning message to the console.
  • console.error(): Prints out an error…

--

--