johnkary/phpunit-speedtrap

Feature request > format tests times for easier readability

sk33wiff opened this issue · 3 comments

Hello,

I would like to propose adding an option to make easier to read the test times.

So instead of having something like this:

You should really fix these slow tests (>2000ms)...

  1. 18859ms to run x
  2. 16441ms to run y
  3. 12352ms to run z
  4. 2352ms to run z

We could have something like:

You should really fix these slow tests (>2000ms)...

  1. 18.8s to run x
  2. 16.4s to run y
  3. 12.3s to run z
  4. 2352ms to run z

Something similar to Carbon::diffForHumans().

Great job btw!

Hi @marcelopm! That's a great idea. Based on your example, should the report print time in seconds once exceeding 10000ms?

Not sure @johnkary, maybe it could be configurable by an optional param with a default value?

Thanks.

I think something as simple as adding a period for some number formatting could take it most of the way. So instead of 18859ms it would say 18.859ms (or with a comma instead)