phpunit-speedtrap icon indicating copy to clipboard operation
phpunit-speedtrap copied to clipboard

Feature request > format tests times for easier readability

Open marcelopm opened this issue 7 years ago • 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!

marcelopm avatar Jun 29 '17 00:06 marcelopm

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

johnkary avatar Jun 29 '17 15:06 johnkary

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

Thanks.

marcelopm avatar Jul 04 '17 22:07 marcelopm

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)

LasseRafn avatar Nov 27 '17 15:11 LasseRafn