question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing classes in integration test sbt config

See original GitHub issue

Hello, I am trying to setup metals with bloop at vscode and my build.sbt looks like this

 lazy val root = (project in file("."))
  .configs(IntegrationTest)
  .settings(
    name := "retro-service",
    Defaults.itSettings,
    libraryDependencies ++= Dependencies.libraries,
    outputStrategy := Some(StdoutOutput),
    inThisBuild(List(organization := "com.mycompany", scalaVersion := "2.12.10"))
)

dependencyClasspath in IntegrationTest :=
  (dependencyClasspath in IntegrationTest).value ++ (exportedProducts in Test).value

onLoad in Global ~= (_ andThen ("loadEnv" :: _))

fork := true
run / fork := false
run / envVars  := loadEnv.value._2
Test / envVars  := loadEnv.value._2
IntegrationTest / parallelExecution := false
IntegrationTest / envVars:= loadEnv.value._2
IntegrationTest / dependencyClasspath :=
  (IntegrationTest / dependencyClasspath).value ++ (Test / exportedProducts).value

But VScode is saying that a Class from /test is not on scope of a class at /it

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jvicancommented, Feb 12, 2020

@matheussbernardo Sorry for the late reply. The sbt build code that you’ve shared looks a little bit hacky in that you only express the dependency between the integration test project and the test project via exportedProducts. You should instead express the dependency at the project level so that bloop can pick it up. You can do that by writing this instead:

val DeepIntegrationTest = IntegrationTest.extend(Test)
lazy val root = (project in file("."))
  .configs(DeepIntegrationTest)
...

You need to make sure you replace any reference to IntegrationTest by DeepIntegrationTest. With that, bloop should correctly infer that your it sources depend on your test sources.

1reaction
matheussbernardocommented, Feb 13, 2020

@maciejbak85 Hello, Here it worked.

lazy val DeepIntegrationTest = IntegrationTest.extend(Test)
lazy val root = (project in file("."))
  .configs(DeepIntegrationTest)
  .settings(....

dependencyClasspath in DeepIntegrationTest :=
  (dependencyClasspath in DeepIntegrationTest).value ++ (exportedProducts in Test).value

onLoad in Global ~= (_ andThen ("loadEnv" :: _))

fork := true
run / fork := true
run / envVars := loadEnv.value._2
Test / envVars := loadEnv.value._2
DeepIntegrationTest / parallelExecution := false
DeepIntegrationTest / envVars := loadEnv.value._2
DeepIntegrationTest / dependencyClasspath :=
  (DeepIntegrationTest / dependencyClasspath).value ++ (Test / exportedProducts).value

Read more comments on GitHub >

github_iconTop Results From Across the Web

Per-configuration classpath dependencies doesn't work with ...
I'm trying to set up a SBT project configuration where the test classes are part of the exercises project while the answers project...
Read more >
BSP - SBT : Integration tests can't be launched in Intellij IDEA
Unable to load a Suite class. This could be due to an error in your runpath. Missing class: org.some.IntegrationTest. Kotlin detected.
Read more >
sbt Reference Manual — Testing
Test is the configuration and means that ScalaCheck will only be on the test classpath and it isn't needed by the main sources....
Read more >
SBT Plugin - Gatling
'Test' vs 'Integration Tests' configurations#. This plugin offers two different custom SBT configurations, named Gatling and GatlingIt . They are tied to ...
Read more >
Using ScalaTest with sbt
To see classpath that sbt uses to lookup for test classes, you can use ... Each reporter argument on the command line can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found