monocart-reporter icon indicating copy to clipboard operation
monocart-reporter copied to clipboard

[Feature Request] Add option to exclude idle time when calculating report duration

Open edumserrano opened this issue 5 months ago • 1 comments

After #141 I was able to use the MonocartReporterOptions.onData function to implement a custom calculation for the report duration which excludes idle time.

I would like to know if you would consider including this calculation in the monocart-reporter itself and make it available via an extra option in the MonocartReporterOptions. For instance:

const monocartOptions: MonocartReporterOptions = {
  name: "My report name",
  calculateDurationStrategy: "exclude-idle-time", // should default to "normal"

When calculateDurationStrategy is set to:

  • normal: monocart-reporter would use the logic it currently uses to calculate the test run duration. It should also default to this value.
  • exclude-idle-time: monocart-reporter would use the logic implemented in this comment to calculate the test run duration.

This request is a quality of life improvement, there's nothing new that this allows you to do that you can't do already today. It just avoids having to repeat the logic to exclude idle time across all my Playwright projects or creating a small NPM package just for that.

edumserrano avatar Sep 22 '24 16:09 edumserrano