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
Scala.js support for ScalaTest 3.0.0 #152
Conversation
* update to scalatest 3.0.0, sbt 0.13.12, and scala 2.11.8 * bump version to 3.3.0
- methodName fixes for scala.js
@maqdev This now seems to have conflicts, do you mind rebase it on the latest master? Thanks. |
@cheeseng done. If you didn't notice I've previously updated this pull-request to cross-compile with scala 2.10 so there will be no need for a separate branch. If you'll merge this I have a branch with reworked requests #56 and #144, so I could update working code without conflicts for these two requests as well. It's good to see some life here :) |
@maqdev Thanks, I'll take a look and see if I can merge them in today. |
@cheeseng, any reason this hasn't been merged in? Too much time needed to look over all of the changes? |
Conflicts resolved again and updated to latest Scala.js: 0.6.14. Scala.js now requires NodeJS to run tests, if you want to avoid NodeJS installation you have to use |
Hi, this is a pretty big change, with a few structural changes. It'll take a while to review it. |
File moves: in a cross-project Scala/JVM + Scala.js, a lot of code can typically be shared between the two platforms. For most projects, virtually all of it can be shared, in fact. This one of the major selling points of Scala.js. However, sometimes, and in particular for "low-level" projects (e.g., a testing framework, or a mocking framework), you sometimes need platform-specific code. This why source files are categories under Node.js is the software used to run Scala.js code. Just like you need a JRE to run .class files, you need Node.js to run the .js files produced by Scala.js. This is only required to run/test Scala.js projects, obviously. It is not necessary to run/test Scala/JVM projects. Talking about "benefit" does not really make sense: without it you plain cannot test the Scala.js projects (the Rhino alternative is deprecated and will be removed in Scala.js 1.0.0; it had several severe issues, the least being extremely slow (orders of magnitude) compared to Node.js). |
Hi, Node.js is required only to run tests targeting JS platform. If you just run |
great, thanks. |
@barkhorn Now Node.js is the default test runner for ScalaJS: https://www.scala-js.org/news/2016/10/17/announcing-scalajs-0.6.13/ |
With Scala.js 0.6.x, yes. Rhino won't be supported by Scala.js 1.0.0, however. If you are concerned about a simpler setup, I suggest recommending in the Readme that people only run the JVM tests while they develop on their machines. The CI will catch JS-specific errors (which should be rare in practice). Only if one stumbles on a JS-specific error does one need to install Node.js to locally debug it. |
I will add the directive to use Rhino for now, until the documentation is updated to state something similar to @sjrd's comment. |
Thanks @barkhorn! I'll check that |
@barkhorn so far this is working fine for me, my library is compiling/testing fine under Scala 2.10-2.12 along with JS. Thank you! |
great news @maqdev . curious which library that is - is it on github? |
Sure, it's Json serialization library for Scala/Scala.JS |
Actually, ScalaMock isn't used in |
Hi!
This is an implementation targeting support Scala.js 0.6.12. I believe that supporting Scala.js will improve ScalaMock, considering the fact that ScalaTest 3.0.0 now supports Scala.js. At this point, I don't know any other mock library for Scala.js
I've created build.sbt file instead of existing Build.scala and split projects to JS/JVM with moving specific code to appropriate directories. It seems that shell prompt functionality is broken here. It would be great if someone could elaborate more on this.
Things that aren't supported when building for Scala.js are:
org.scalamock.scalatest.proxy.MockFactory
support, due to reflection;There are problems with ScalaTest's traits
OneInstancePerTest
,RandomTestOrder
. It's required to override methodnewInstance
which I did for all tests in ScalaMock.Also I would like to mention that this pull-request includes #149 , kudos to @dvic