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

Switched to single test framework per TestModule #1268

Merged
merged 15 commits into from
Apr 12, 2021

Conversation

lefou
Copy link
Member

@lefou lefou commented Apr 10, 2021

Introduced new methods and targets where appropriate.
Deprecated all methods that support multiple frameworks.

See also discussion in #170

@lefou lefou marked this pull request as ready for review April 12, 2021 10:02
@@ -218,13 +218,13 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule {
val (close, framework) = mill.scalajslib.ScalaJSWorkerApi.scalaJSWorker().getFramework(
toolsClasspath().map(_.path),
jsEnvConfig(),
testFrameworks().head,
Copy link
Member

Choose a reason for hiding this comment

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

Beautiful!

Copy link
Member

@lolgab lolgab left a comment

Choose a reason for hiding this comment

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

It seems strange to have mill-contrib-testng artifact with an hardcoded _2.13.
I guess it's to be used with Java projects.
If you mix it with other Scala dependencies not on Scala 2.13 it silently breaks the binary compatibility.
Maybe we should rewrite that module in pure java if possible?
Other than this it looks good to me!

@lefou
Copy link
Member Author

lefou commented Apr 12, 2021

It seems strange to have mill-contrib-testng artifact with an hardcoded _2.13.
I guess it's to be used with Java projects.
If you mix it with other Scala dependencies not on Scala 2.13 it silently breaks the binary compatibility.
Maybe we should rewrite that module in pure java if possible?
Other than this it looks good to me!

Oh, our testng framework is already a pure Java implementation. I think the Scala binary suffix is an oversight due to current consistent packaging setup.

@lolgab
Copy link
Member

lolgab commented Apr 12, 2021

It seems strange to have mill-contrib-testng artifact with an hardcoded _2.13.
I guess it's to be used with Java projects.
If you mix it with other Scala dependencies not on Scala 2.13 it silently breaks the binary compatibility.
Maybe we should rewrite that module in pure java if possible?
Other than this it looks good to me!

Oh, our testng framework is already a pure Java implementation. I think the Scala binary suffix is an oversight due to current consistent packaging setup.

I think it was a side effect of this change
If you look at Maven Central at some point ( a few commits after this ) the artifact was renamed with the extra _2.13. This because MillModule depends on Scala where MillPublishModule depends on Java only.

EDIT: Actually it started to depend on scalalib so something happened in that PR that needs to be addressed.

@lolgab
Copy link
Member

lolgab commented Apr 12, 2021

From my side the issue with TestNG can be fixed later with a separate PR.
Just add a TODO where the dependency is added with the _2.13 and create a companion issue to link in the TODO

build.sc Show resolved Hide resolved
@lefou lefou requested a review from lolgab April 12, 2021 16:05
@lefou
Copy link
Member Author

lefou commented Apr 12, 2021

It seems strange to have mill-contrib-testng artifact with an hardcoded _2.13.
I guess it's to be used with Java projects.
If you mix it with other Scala dependencies not on Scala 2.13 it silently breaks the binary compatibility.
Maybe we should rewrite that module in pure java if possible?
Other than this it looks good to me!

Oh, our testng framework is already a pure Java implementation. I think the Scala binary suffix is an oversight due to current consistent packaging setup.

I think it was a side effect of this change
If you look at Maven Central at some point ( a few commits after this ) the artifact was renamed with the extra _2.13. This because MillModule depends on Scala where MillPublishModule depends on Java only.

EDIT: Actually it started to depend on scalalib so something happened in that PR that needs to be addressed.

We added Integration tests which obviously need mill. ;-) I now changed this dependency to be only a dependency of the actual test module, not the outer testng framework implementation.

}
)
classFingerprint.map(classF => classF._1.getName.stripSuffix("$"))
Seq.from(classFingerprint.map(classF => classF._1.getName.stripSuffix("$")))
Copy link
Member

Choose a reason for hiding this comment

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

Just curiosity: why not .toSeq?

Copy link
Member Author

Choose a reason for hiding this comment

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

.toSeq gives a deprecation warning, and any fix is more verbose and results in the same call.

"predefined TestModules: TestNg, Junit, Scalatest, ..."
if (frameworks.size != 1) {
Result.Failure(
"Since mill after-0.9.6 only one test framework per TestModule is supported. " ++ msg)
Copy link
Member

Choose a reason for hiding this comment

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

First time I see string concatenation with ++ :) Is it to not confuse it with the sum?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea, haha. Will fix it...

Copy link
Member

@lolgab lolgab left a comment

Choose a reason for hiding this comment

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

Good job on this one! Thank you!

@sake92
Copy link
Contributor

sake92 commented Apr 12, 2021

Looks great really, seems like a great simplification!
Just wondering if having ivyDeps for some frameworks and not for others is a bit inconsistent?
Also, MUnit? 😄

* TestModule that uses Scalatest Framework to run tests.
* You need to provide the scalatest dependencies yourself.
*/
trait Scalatest extends TestModule {
Copy link
Contributor

Choose a reason for hiding this comment

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

ScalaTest is more precise I think.

@lefou
Copy link
Member Author

lefou commented Apr 12, 2021

Looks great really, seems like a great simplification!
Just wondering if having ivyDeps for some frameworks and not for others is a bit inconsistent?

It's mainly because those which come with ivyDeps don't provide a Sbt Test Interface. The side effect of course is, that they can be used without any addional ivyDeps.

Also, the most Scala-based test frameworks are more complex in regard of their dependencies, many have extra options for e.g. ScalaCheck, or shapeless

Also, MUnit? smile

Oh, yeah. I never used it or saw it in action. But if you say, it works as smooth as all the others in mill, I can add a trait for it, too.

@lefou
Copy link
Member Author

lefou commented Apr 12, 2021

Looks like latest CI runs fail because org.tpolecat:tut-core is no longer available. Probably an issue with bintray sunsetting?

@sake92
Copy link
Contributor

sake92 commented Apr 12, 2021

Thx for adding MUnit, it's really awesome framework! :)
Yeah, probably fails bcoz Bintray stuff. Tut seems to be deprecated/abandoned anyways?

@lefou
Copy link
Member Author

lefou commented Apr 12, 2021

Looks like latest CI runs fail because org.tpolecat:tut-core is no longer available. Probably an issue with bintray sunsetting?

See #1269

@lefou lefou merged commit b261b5f into com-lihaoyi:master Apr 12, 2021
@lefou lefou deleted the testframework branch April 12, 2021 21:03
@lefou lefou added this to the after 0.9.6 milestone Apr 12, 2021
@lefou
Copy link
Member Author

lefou commented Apr 12, 2021

Thank you, @lolgab and @sake92, for you valuable feedback.

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