Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure specs that fail in initialisation fail a Maven build #832

Merged
merged 1 commit into from
Jun 17, 2019
Merged

Ensure specs that fail in initialisation fail a Maven build #832

merged 1 commit into from
Jun 17, 2019

Conversation

Mahoney
Copy link
Contributor

@Mahoney Mahoney commented Jun 14, 2019

KotlinTest fails to notify the Maven Surefire plugin properly via the
JUnit platform if a spec throws an exception during initialisation.

This is because whilst TestEngine does try to register a spec that
fails during initialisation, it accidentally skips the beforeSpecClass
and afterSpecClass methods on the TestEngineListener because it is
wrapped in an IsolationTestEngineListener which has guards around
those methods, and the guards always return false because the spec was
never created.

See https://github.com/Mahoney/maven-kotlintest for an example of the
problem.

KotlinTest fails to notify the Maven Surefire plugin properly via the
JUnit platform if a spec throws an exception during initialisation.

This is because whilst `TestEngine` does try to register a spec that
fails during initialisation, it accidentally skips the beforeSpecClass
and afterSpecClass methods on the `TestEngineListener` because it is
wrapped in an `IsolationTestEngineListener` which has guards around
those methods, and the guards always return false because the spec was
never created.

See https://github.com/Mahoney/maven-kotlintest for an example of the
problem.
@LeoColman
Copy link
Member

I think this is a little bit related to #807

@LeoColman LeoColman requested a review from sksamuel June 14, 2019 17:12
@sksamuel
Copy link
Member

Ah nice spot. @Kerooker do you think this would fix what you were adding in your PR ?

@LeoColman
Copy link
Member

LeoColman commented Jun 15, 2019 via email

@sksamuel
Copy link
Member

sksamuel commented Jun 15, 2019 via email

@LeoColman
Copy link
Member

Makes sense. Merged.

@LeoColman LeoColman merged commit b99f7f7 into kotest:master Jun 17, 2019
Mahoney pushed a commit to Mahoney-forks/kotlintest that referenced this pull request Jun 18, 2019
KotlinTest fails to notify the Maven Surefire plugin properly via the
JUnit platform if a spec throws an exception during initialisation.

This is because whilst `TestEngine` does try to register a spec that
fails during initialisation, it accidentally skips the beforeSpecClass
and afterSpecClass methods on the `TestEngineListener` because it is
wrapped in an `IsolationTestEngineListener` which has guards around
those methods, and the guards always return false because the spec was
never created.

See https://github.com/Mahoney/maven-kotlintest for an example of the
problem.

(cherry picked from commit b99f7f7)
sksamuel pushed a commit that referenced this pull request Jun 29, 2019
KotlinTest fails to notify the Maven Surefire plugin properly via the
JUnit platform if a spec throws an exception during initialisation.

This is because whilst `TestEngine` does try to register a spec that
fails during initialisation, it accidentally skips the beforeSpecClass
and afterSpecClass methods on the `TestEngineListener` because it is
wrapped in an `IsolationTestEngineListener` which has guards around
those methods, and the guards always return false because the spec was
never created.

See https://github.com/Mahoney/maven-kotlintest for an example of the
problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants