R. Karlus
R. Karlus

Reputation: 2256

Get tests running time with Jest

Is there any way to know how long my tests take without doing it programmatically with Jest?

To be clear, I know that if I add a variable to get the current time before each test and then log this when my test completes I'll get this information, but I want this automatically, maybe with some Jest configuration.

Upvotes: 20

Views: 16595

Answers (1)

Jonathan Irwin
Jonathan Irwin

Reputation: 5747

You shouldn't need any configuration to get the running time for your tests

PASS  src/containers/Dashboard/Dashboard.test.tsx (12.902s)

That 12.902s in the brackets is the total time from when the test command was run.

If you want to see the running time per test you can run jest with the --verbose flag and it will show you the time for each test as well as the whole suite.

  Dashboard Container
    ✓ render without crashing (1090ms)

Upvotes: 30

Related Questions