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

Filter scripted tests based on optional project/build.properties #3564

Closed
jonas opened this Issue Sep 20, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@jonas
Member

jonas commented Sep 20, 2017

steps

In a cross-built sbt plugin project, scripted will run all tests under src/sbt-test.

problem

As an sbt plugin author, there are several situations where it would be good to be able to conditionally run a scripted tests:

  • A plugin has not been cross published for sbt 1.0 yet.
  • The plugin version is different for sbt 0.13 and sbt 1.0 (e.g. tut)
  • Certain scripted tests track the minimum required sbt versions, e.g. 0.13.9 and 1.0.0-RC2.

The scripted plugin allows to pass which tests to run, however, this requires additional configuration of the form (e.g. sbt-site)

TaskKey[Unit]("runScriptedTest") := Def.taskDyn {
  (sbtBinaryVersion in pluginCrossBuild).value match {
    case "0.13" => Def.task(scripted.toTask("..."))
    case "1.0"  => Def.task(scripted.toTask("..."))
  }
}.value

expectation

For all scripted tests in which project/build.properties exist, the value of the sbt.version property is read. If its binary version is different from sbtBinaryVersion in pluginCrossBuild the test will be skipped and a message indicating this will be logged.

notes

sbt version: 0.13.16, 1.0.2
PoC: https://github.com/scalacenter/scalajs-bundler/pull/179/files#diff-fdc3abdfd754eeb24090dbd90aeec2ceR148

jonas added a commit to jonas/sbt that referenced this issue Sep 21, 2017

Fix sbt#3564: Filter scripted tests based on project/build.properties
Skip scripted tests where the binary version configured in the build
does not match the binary version of sbt used for cross-building.

@dwijnand dwijnand added this to the 1.1.0 milestone Sep 22, 2017

@dwijnand dwijnand closed this in 62a1d42 Sep 26, 2017

dwijnand added a commit that referenced this issue Sep 26, 2017

Merge pull request #3566 from jonas/scripted-skip-1.0
Fix #3564: Filter scripted tests based on project/build.properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment