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

Add Integration Tests to the project. #40

Open
naderghanbari opened this issue Sep 20, 2015 · 3 comments
Open

Add Integration Tests to the project. #40

naderghanbari opened this issue Sep 20, 2015 · 3 comments

Comments

@naderghanbari
Copy link

That would be great if this sample project had a few integration tests. That way it will be easier for people adopting Scalajs + Play + SBT combo.

There are some caveats (I believe because the way sbt-web works: sbt/sbt-web#54). But it would be nice to mention the best workaround here.

@naderghanbari
Copy link
Author

So far I found one by using something like this in the server sbt descriptor:

  unmanagedResourceDirectories in IntegrationTest <+= baseDirectory(_ / "target/web/public/test"),
  resourceGenerators in IntegrationTest <+= PlayScalaJS.copyMappings(scalaJSDev, WebKeys.public in TestAssets).map(_ => Seq[File]())

Please share your thoughts and let me know if there are better workarounds. If not, is a PR with this workaround welcome?

@vmunier
Copy link
Owner

vmunier commented Sep 23, 2015

There is an integration test in this project.

I don't have any real experience running integration tests in Play.

How do you run your integration tests in Play? Are you using it:test? Do you add the tests in a different folder than test?

@naderghanbari
Copy link
Author

Yes, what I have now is putting tests in a separate folder, namely it and then adding Defaults.itSettings to the build file:

# build.sbt
Defaults.itSettings
scalaSource in IntegrationTest <<= baseDirectory(_ / "it")
parallelExecution in IntegrationTest := false,

In that sense there is almost no difference from what you have here. But the problem is the launcher file and other js files (fastOpt or jsDeps) are not available (I believe if you test the actual functionality in integration tests they will fail). So I guess despite the fact that Integration Tests has no great support by SBT, adding a working configuration to this project makes it easier for developers to adopt Scalajs (at least for my case, integration test was the only blocker in the way of migrating to Scalajs)

By the way I found the following as a workaround but maybe there are cleaner and more straightforward ways to achieve this:

resourceGenerators in IntegrationTest <+= PlayScalaJS.copyMappings(scalaJSDev, WebKeys.public in TestAssets).map(_ => Seq[File]())
unmanagedResourceDirectories in IntegrationTest <+= baseDirectory(_ / "target/web/public/test"),

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

2 participants