简体   繁体   中英

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.

So, any help on this?

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 running time for the test suite.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM