ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Get reporter to access PreRunStats?

Open Itxaka opened this issue 2 years ago • 5 comments

Hi!

I been looking like crazy, but it seems that its not possible to access the reporter anywhere in order to obtain the PreRunStats?

Im interested in running a check in BeforeSuite that checks the number of tests that are gonna run, in order to take some expensive actions (reset a VM to its original state) and thought about getting the number of specs that its gonna run, so its its just 1, I can ignore any cleanup in the VM, otherwise I need to reset the whole thing so the next spec has a clean VM testing environment.

Before on ginkgo v1 I think it was possible as long as you created a reporter and run the spec suite with that, you were able to have that reporter around and access it but with V2 that has been deprecated, so I cannot access it that way.

There is also not a ReportBeforeSuite which will also work, to access the suite report, I can only access the SpecReport

Any ideas?

Itxaka avatar Jun 13 '22 14:06 Itxaka

hey there - sorry if this has been frustrating. i'm planning to reintroduce a ReportBeforeSuite in an upcoming release but don't have a timeline for you yet. :(

onsi avatar Jun 13 '22 15:06 onsi

oh, there was that before? Nice to know. Maybe I should try to send a PR with that, although seems a bit complicated, I could have a look at it :D

Itxaka avatar Jun 13 '22 15:06 Itxaka

hey thanks @Itxaka - there was support for getting a report before the suite ran if you implemented a custom reporter in V1 but it was a bit janky (specifically, if you were running in parallel, it would be called multiple times on each process). What I'd like to do for V2 is have it only run on the first Ginkgo process and make all the PreRunStats available.

onsi avatar Jun 14 '22 01:06 onsi

And thanks for an offer for a PR - I think this bit of code will be kind of gnarly, though... so not a great candidate as a PR for someone not super familiar with the codebase.

onsi avatar Jun 14 '22 01:06 onsi

yeah Im seeing it @onsi, tried my luck but it seems a bit complicated for me :D

Thanks for the feedback!

Itxaka avatar Jun 14 '22 08:06 Itxaka

/cc

Expect to see NumberOfSpecsThatWillBeRun is available when the ReportBeforeSuite is back. :)

chendave avatar Oct 20 '22 06:10 chendave

this is fixed now in 2.6.0 with the introduction of ReportBeforeSuite

onsi avatar Dec 10 '22 04:12 onsi

@onsi thanks for fixing this!

chendave avatar Dec 12 '22 02:12 chendave

Thanks @onsi , really appreciate it!!

Itxaka avatar Dec 13 '22 08:12 Itxaka