-
Notifications
You must be signed in to change notification settings - Fork 91
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
Cannot get rich filtering capabilities example working #62
Comments
Thank you for reporting! The example from the blog post has stopped working since the v0.5 release when all internals became async. I opened #63 fixing the code example from the blog post and improved the UX around how the override def munitNewTest(test: Test): Test = {
val isIgnored =
test.tags(Windows213) && !(
Properties.isWin &&
Properties.versionNumberString.startsWith("2.13")
)
if (isIgnored) test.tag(Ignore)
else test
} |
@olafurpg - thanks for the response! I tried out your code snippet and it's not working as expected. Here is the code I am running. When I run
Is |
It's expected the code snippet doesn't work with the current version of Metals but it will work with the next version after the fixes in #63 are released |
I'm preparing another change I would like to include in the next release as well |
@olafurpg - awesome, thanks for clarifying (I should have seen that in your original message). This rich filtering options is so awesome - keep up the great work! |
@MrPowers I opened #64 to (hopefully) simplify how to customize filtering and evaluation of tests. The code example from the blog post would become this instead import scala.util.Properties
import munit._
object Windows213 extends Tag("Windows213")
class MySuite extends FunSuite {
override def munitTestTransforms = super.munitTestTransforms ++ List(
new TestTransform("Windows213", { test =>
val isIgnored =
test.tags(Windows213) && !(
Properties.isWin &&
Properties.versionNumberString.startsWith("2.13")
)
if (isIgnored) test.tag(Ignore)
else test
})
)
test("windows-213".tag(Windows213)) {
// Only runs when operating system is Windows and Scala version is 2.13
}
test("normal test") {
// Always runs like a normal test.
}
} A I'm curious to hear your thoughts if this new API makes sense? |
@olafurpg - I updated my blog post to reflect the latest API. I will email you so we can brainstorm how to market this feature! This functionality will be really useful for the Spark community! |
I am really excited about the rich filtering capabilities!
Here's the example on the website that I cannot get working:
Changing from
options.tags
totest.tags
solves one of the errors (please confirm this fix is correct).The
if (isIgnored) test.withBody(() => Ignore)
line is still erroring out with this message:[error] /Users/powers/Documents/code/my_apps/munit-example/src/test/scala/com/github/mrpowers/munit/example/RichFiltersSpec.scala:16:40: type mismatch;
[error] found : munit.Tag
[error] required: MySuite.this.TestValue
[error] (which expands to) scala.concurrent.Future[Any]
[error] if (isIgnored) test.withBody(() => Ignore)
[error] ^
[error] one error found
[error] (Test / compileIncremental) Compilation failed
Thanks for building this awesome library!
The text was updated successfully, but these errors were encountered: