kotest icon indicating copy to clipboard operation
kotest copied to clipboard

Kotest runs `afterProject`, `afterSpec` on spec even if all of its tests are excluded by tag expression

Open OliverO2 opened this issue 1 year ago • 3 comments

Kotest 5.9.1/master

Example: Self-testing Kotest with

./gradlew -p kotest-framework/kotest-framework-engine cleanAllTests jvmTest -Dkotest.tags=Deprecated --no-build-cache

produces (among others):

io.kotest.assertions.AssertionFailedError: expected:<3> but was:<0>
	at com.sksamuel.kotest.engine.spec.style.FreeSpecTest.afterSpec(FreeSpecTest.kt:15)
io.kotest.assertions.AssertionFailedError: expected:<8> but was:<7>
	at com.sksamuel.kotest.engine.extensions.spec.finalizespec.FinalizeSpecListenerPerTestTest$1.invoke(FinalizeSpecListenerPerTestTest.kt:43)

OliverO2 avatar Jun 20 '24 09:06 OliverO2

Related: #3419

OliverO2 avatar Jun 20 '24 09:06 OliverO2

Should afterProject run regardless? Maybe it should? afterSpec should not (I have a PR up for that).

sksamuel avatar Aug 07 '24 01:08 sksamuel

Yeah, I guess always running afterProject is OK. Needs to be documented.

OliverO2 avatar Aug 09 '24 08:08 OliverO2