ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Call ReportAfterSuite in --dry-run mode

Open rcw5 opened this issue 3 years ago • 5 comments

I've been running ginkgo in --dry-run mode to generate a custom report of all the tests in my project without having to run them (it's a long-running integration test suite)

After migrating to Ginkgo v2 I notice that ReportAfterSuite() isn't called when --dry-run is enabled, I think because of this block - https://github.com/onsi/ginkgo/blob/master/internal/suite.go#L528-L530:

if suite.config.DryRun {
	suite.currentSpecReport.State = types.SpecStatePassed
	return
}

The same occurs with ReportAfterEach()

Would you consider changing the behaviour so that the reporting hooks are called even in dry-run mode?

rcw5 avatar Feb 22 '22 17:02 rcw5

iirc i turned this off intentionally. your usecase makes sense to me though so let me dig into why i'd done that and circle back.

onsi avatar Feb 22 '22 17:02 onsi

I've been able to find a way around the change by setting --focus in such a way that all tests are skipped, i.e. ginkgo --focus NoSpecsMatchThisString

Seems to be working OK so far, but a modified --dry-run behaviour would make my intentions more explicit!

rcw5 avatar Feb 22 '22 17:02 rcw5

Makes sense - but I think I agree that the intent behind --dry-run is to report on how the suite will run which should include running the reporting nodes. Will take a look sometime this week.

onsi avatar Feb 22 '22 18:02 onsi

@onsi thanks for the quick fix, could you pls let me know which minor version of v2 will include this fix and the timeline for the release? https://github.com/onsi/ginkgo/commit/aae4480d35116455d7115e71120566e8be55b4a4?

chendave avatar Apr 01 '22 02:04 chendave

it'll be in the next release - not sure yet when I'll cut a release, though. hopefully in the next few days/week.

onsi avatar Apr 01 '22 23:04 onsi