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 not running tests #49

Closed
fommil opened this issue Jan 12, 2015 · 7 comments
Closed

sbt not running tests #49

fommil opened this issue Jan 12, 2015 · 7 comments

Comments

@fommil
Copy link

fommil commented Jan 12, 2015

I've followed the tutorial and the utest README but sbt seems to ignore the tests in my (really simple) project https://github.com/fommil/kerbal-calculator/

Can you please take a look and see what I'm doing wrong? It might lead to a change to the docs.

@lihaoyi
Copy link
Member

lihaoyi commented Jan 12, 2015

Have you tried this? https://github.com/lihaoyi/utest#scalajs-and-sbt You need to add some magic settings to make it work with Scala.js, which are all stuffed into a one-line bundle in the utest-js-plugin.

This won't be necessary for 0.6.x, but for now you'll have to do this song & dance ^_^

@fommil
Copy link
Author

fommil commented Jan 12, 2015

yes, I tried all of that. I'm looking at jasmine now.

@lihaoyi
Copy link
Member

lihaoyi commented Jan 12, 2015

I don't see it in your repo, but sure. Let me know if i can be of any help

@lihaoyi lihaoyi closed this as completed Jan 12, 2015
@fommil
Copy link
Author

fommil commented Jan 12, 2015

argh, I went to jasmine, which worked, but I got a stack trace during the test https://github.com/fommil/kerbal-calculator/tree/11620af869db57e1309d09097b1852a24f7e1035

Does this mean my code is pushing the limits of the scalajs compiler, or do I need to do something else? (I'm going to give utest one more try, because it would be nice to have all this code in a shared module, with all the JS stuff in a separate one... although it would be good to be able to run the tests of the shared code in the JVM and the JS if possible)

> test
[info] 
[info] Engine
[info]   + should return valid fuel tanks for the Poodle engine
[info]   + should return valid fuel tanks for the KR-1x2 engine
[info] 
[info] Total for suite Engine
[info] 0 specs, 0 failure
[info] 
[info] 
[info] Solver
[error]  x should solve for a Kerbin to Mun 10 payload
[error]     TypeError: Cannot find function Ljava_math_MathContext in object [object Object]. in s_math_BigDecimal$.sjsir (line 199)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/math/BigDecimal.scala:31)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/math/BigDecimal.scala:25)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/math/Numeric.scala:161)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/math/Numeric.scala:191)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/math/Numeric.scala:191)
[error] <jscode>.(https://raw.githubusercontent.com/scala-js/scala-js/v0.5.6/scalalib/overrides-2.11/scala/collection/immutable/NumericRange.scala:276)
[error] <jscode>.(https://raw.githubusercontent.com/scala-js/scala-js/v0.5.6/scalalib/overrides-2.11/scala/collection/immutable/NumericRange.scala:51)
[error] <jscode>.(https://raw.githubusercontent.com/scala-js/scala-js/v0.5.6/scalalib/overrides-2.11/scala/collection/immutable/NumericRange.scala:51)
[error] <jscode>.(https://raw.githubusercontent.com/scala-js/scala-js/v0.5.6/scalalib/overrides-2.11/scala/collection/immutable/NumericRange.scala:54)
[error] <jscode>.(https://raw.githubusercontent.com/scala-js/scala-js/v0.5.6/scalalib/overrides-2.11/scala/collection/immutable/NumericRange.scala:72)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/TraversableLike.scala:727)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:92)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:91)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/TraversableLike.scala:252)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/TraversableLike.scala:252)
[error] <jscode>.(https://raw.githubusercontent.com/scala-js/scala-js/v0.5.6/library/src/main/scala/scala/scalajs/runtime/AnonFunctions.scala:11)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/immutable/HashSet.scala:322)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/immutable/HashSet.scala:978)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/TraversableLike.scala:252)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/Traversable.scala:104)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:91)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:89)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/immutable/Stream.scala:529)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/immutable/Stream.scala:534)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:89)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:81)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:80)
[error] <jscode>.(https://raw.githubusercontent.com/scala/scala/v2.11.2/src/library/scala/collection/immutable/Stream.scala:458)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/main/scala/com/github/fommil/kerbal/solver.scala:80)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/test/scala/com/github/fommil/kerbal/SolverSpec.scala:11)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/test/scala/com/github/fommil/kerbal/SolverSpec.scala:10)
[error] <jscode>.(file:/home/fommil/Projects/kerbal-calculator/src/test/scala/com/github/fommil/kerbal/SolverSpec.scala:10)
[error] <jscode>.(https://raw.githubusercontent.com/scala-js/scala-js/v0.5.6/jasmine-test-framework/src/main/scala/scala/scalajs/test/JasmineTest.scala:20)
[info] 
[error] Total for suite Solver
[error] 1 specs, 1 failure
[info] 
[error] Error: Total 3, Failed 0, Errors 1, Passed 2
[error] Error during tests:
[error]     com.github.fommil.kerbal.SolverSpec
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 12 s, completed 12-Jan-2015 21:21:18

@lihaoyi
Copy link
Member

lihaoyi commented Jan 12, 2015

Looks like you're using bits of code (java.lang.MathContext) that haven't been ported to Scala.js yet. There's an open ticket to implement it (scala-js/scala-js#373) but so far nobody's stepped up to push it all the way through. If you want to be a hero, you could make a lot of people happy =P

@fommil
Copy link
Author

fommil commented Jan 12, 2015

Damnit. That scuppers my plan of converting this little app into a webapp 😢

At this point in time, I think I'm about to pop a stack overflow from repeated applications of this diagram http://xkcd.com/1319/ so I might give that a miss 😄

Keep up the good work!

@fommil
Copy link
Author

fommil commented Jan 13, 2015

I was able to get utest to work, finally. I'll push to my repo shortly.

The confusing thing for me, which might be worth documenting, was appreciating that a single module project will be treated as a JS project which absolutely requires that one use the utest sbt plugin: there is no cross-compilation for a single module project.

Now that I have a shared/js/jvm project in place I can see that the shared tests run in both the jvm module and the js module. It's a bit of a hack the way this is set up as it is effectively explicitly adding directories to the module's source directory list instead of setting up a transitive dependency structure. I'm guessing this is going to cause havoc with our ENSIME sbt plugin. I suspect the required symbolic links will bring their own problems with ENSIME.

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