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

[SBT-Plugin] Default IntegrationTest configuration #584

Open
pslaski opened this issue Sep 2, 2022 · 3 comments
Open

[SBT-Plugin] Default IntegrationTest configuration #584

pslaski opened this issue Sep 2, 2022 · 3 comments

Comments

@pslaski
Copy link

pslaski commented Sep 2, 2022

I have tried to run ScalaJS code as SBT Integration test suite, I configured them as is written in the docs

.configs(IntegrationTest)
.settings(commonSettings, Defaults.itSettings)
.settings(inConfig(IntegrationTest)(ScalaJSPlugin.testConfigSettings))

but, during execution of IntegrationTest / fastLinkJS operation, I got

[error] Referring to non-existent class org.scalajs.testing.bridge.Bridge
[error]   called from core module module initializers
[error] Referring to non-existent method static org.scalajs.testing.bridge.Bridge.start()void
[error]   called from core module module initializers
[error] There were linking errors
[error] (IntegrationTest / fastLinkJS) There were linking errors

The fix for that is adding explicitly scalajs-test-bridge as IntegrationTest scope dependency.

My proposition is to have in ScalaJSPlugin defined integration tests config settings (similar to testConfigSettings) which user can easily add to IntegrationTest scope

@enriquerodbe
Copy link

Thanks for the workaround, I stumbled upon this and wasn't able to make this work!

@sjrd
Copy link
Member

sjrd commented Sep 2, 2022

I don't think we can do that. Unfortunately, sbt decided to design its libraryDependencies so that the setting itself is scoped in the project, but the right-hand-side has an additional % Test or % IntegrationTest. That means that we cannot add config-specific libraryDependencies from a Seq[Setting[_]] that should be passed in inConfig.

Said in a different way: I do not see what setting we could put inside testConfigSettings that would achieve the effect of, when passed through inConfig(IntegrationTest)(...), adding a dependency in the IntegrationTest configuration.


An entirely different solution would be to resolve the dependency ourselves and patch it up directly in fullClasspath. The problem with that is that it requires dark magic in our own build, as we must instead do an actual dependsOn and not resolve from the internet. And every piece of dark magic like that dramatically reduces our confidence in our tests, since we don't actually test the sbt plugin as users will see it.


My opinion here is that we should improve the documentation instead.

@pslaski
Copy link
Author

pslaski commented Sep 8, 2022

Thanks for your response - yes, improving the documentation would be good too and probably the simplest and fastest solution

@sjrd sjrd transferred this issue from scala-js/scala-js Sep 8, 2022
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

No branches or pull requests

3 participants