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

Drop Spek #4670

Merged
merged 11 commits into from Apr 11, 2022
Merged

Drop Spek #4670

merged 11 commits into from Apr 11, 2022

Conversation

3flex
Copy link
Member

@3flex 3flex commented Apr 3, 2022

Tying off some loose ends to close #4450.

@3flex 3flex added the housekeeping Marker for housekeeping tasks and refactorings label Apr 3, 2022
@marschwar
Copy link
Contributor

To my understanding (or wishful thinking) we decided to stay with the Spec suffix for the initial migration to be able to process the change set. Personally I think we should switch to the Test suffix. This should probably be a separate PR but the documentation changed here should then reflect that.

docs/pages/extensions.md Outdated Show resolved Hide resolved
@3flex
Copy link
Member Author

3flex commented Apr 3, 2022

I think we should switch to the Test suffix

I'm not too bothered personally, it seems the JUnit convention is for Tests (plural) to be the suffix, though that would depend on the number of tests in the class... Also this convention makes sense for inner classes too so perhaps it's not just files and top level classes to rename.

I don't think there's anything wrong with Spec though. If the current suffix was Spek that would be different!

@@ -11,6 +11,9 @@ import org.spekframework.spek2.dsl.Root
import org.spekframework.spek2.lifecycle.CachingMode
import java.nio.file.Path

@Deprecated(
"Use @KotlinCoreEnvironmentTest annotation on test classes instead. See detekt's tests for examples."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on wording? This is only relevant if JUnit 5 is being used. Perhaps this message should be test framework agnostic and/or direct readers to the type resolution testing docs which outlines options for different test frameworks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe talks about KotlinCoreEnvironmentTest and createEnvironment so we don't force the use of JUnit 5?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this shouldn't be a deprecation imho but more of a KDoc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't the deprecation suitable? Are we intending to support those extending detekt and testing with Spek indefinitely?

My preference is a deprecation with removal in the near future (with a copy of the extension function in the release notes that users can then use in their own test code if they're still using Spek).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup sorry, I haven't realized this was Spek-specific. Therefore I'm in for deprecating this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at the updated deprecation message - I've directed readers to the type resolution docs and copied the Spek DSL extension code there so it becomes a self-contained example that doesn't rely on detekt-test-utils. This will make it easier to remove the deprecated code in a future release.

@3flex 3flex force-pushed the drop-spek branch 2 times, most recently from 69246d5 to ab36488 Compare April 6, 2022 06:44
@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #4670 (eb0d239) into main (2a513c4) will increase coverage by 0.28%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main    #4670      +/-   ##
============================================
+ Coverage     84.42%   84.71%   +0.28%     
+ Complexity     3436     3423      -13     
============================================
  Files           493      490       -3     
  Lines         11342    11255      -87     
  Branches       2085     2069      -16     
============================================
- Hits           9576     9535      -41     
+ Misses          704      675      -29     
+ Partials       1062     1045      -17     

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2a513c4...eb0d239. Read the comment docs.

@@ -11,6 +11,9 @@ import org.spekframework.spek2.dsl.Root
import org.spekframework.spek2.lifecycle.CachingMode
import java.nio.file.Path

@Deprecated(
"Use @KotlinCoreEnvironmentTest annotation on test classes instead. See detekt's tests for examples."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this shouldn't be a deprecation imho but more of a KDoc

docs/pages/extensions.md Outdated Show resolved Hide resolved
docs/pages/gettingstarted/type-resolution.md Show resolved Hide resolved
gradle/libs.versions.toml Show resolved Hide resolved
@cortinico cortinico added this to the 1.20.0 milestone Apr 8, 2022
@cortinico cortinico added the notable changes Marker for notable changes in the changelog label Apr 8, 2022
@cortinico
Copy link
Member

I'd like to merge this and prepare 1.20.0 just after it 👍

}
}
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to fully drop support for Spek test? Line 129 - 141 still have some code references.

At least we can update them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry didn't see your note before pushing an update - I've actually expanded the docs to make deprecation of org.spekframework.spek2.dsl.Root.setupKotlinEnvironment easier for anyone using it in external projects.

3flex and others added 11 commits April 10, 2022 14:21
The only custom check it included was for Spek, which has been removed from
the code base.
The migration has been completed.
These are redundant as Spek is no longer used.
JUnit 5 is recommended, along with the @KotlinCoreEnvironmentTest
annotation, to setup a Kotlin environment for testing rules that use type
and symbol solving.
Co-authored-by: Goooler <wangzongler@gmail.com>
Co-authored-by: Goooler <wangzongler@gmail.com>
@3flex
Copy link
Member Author

3flex commented Apr 11, 2022

LGTM? I'll let someone else click the button after a final review.

@cortinico cortinico merged commit 8939aed into detekt:main Apr 11, 2022
@3flex 3flex deleted the drop-spek branch April 11, 2022 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Marker for housekeeping tasks and refactorings notable changes Marker for notable changes in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Spek with a new test framework
6 participants