You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many of my tests, I have nested describe blocks to help organize things, like this:
describe("outer", function() {
describe("inner", function() {
it("should do a thing", function() {
expect(1).to.equal(1);
});
});
});
When running sbt-mocha 1.1.2 in an sbt 0.13.17 project, this works perfectly fine. However, when I upgraded the project to sbt 1.2.6, it started failing. Specifically, it would run the tests until it hit a file with a nested describe, then it would run the tests in that file, then it would fail with the following exception:
[error] java.lang.RuntimeException: no test suite
[error] at scala.sys.package$.error(package.scala:26)
[error] at sbt.JUnitXmlTestsListener.$anonfun$withTestSuite$1(JUnitXmlTestsListener.scala:153)
[error] at scala.Option.getOrElse(Option.scala:121)
[error] at sbt.JUnitXmlTestsListener.withTestSuite(JUnitXmlTestsListener.scala:153)
[error] at sbt.JUnitXmlTestsListener.writeSuite(JUnitXmlTestsListener.scala:230)
[error] at sbt.JUnitXmlTestsListener.endGroup(JUnitXmlTestsListener.scala:215)
[error] at com.typesafe.sbt.mocha.MochaTestReporting.$anonfun$handleSuite$25(MochaTestReporting.scala:222)
[error] at com.typesafe.sbt.mocha.MochaTestReporting.$anonfun$handleSuite$25$adapted(MochaTestReporting.scala:221)
[error] at scala.collection.immutable.List.foreach(List.scala:388)
[error] at com.typesafe.sbt.mocha.MochaTestReporting.$anonfun$handleSuite$24(MochaTestReporting.scala:221)
[error] at com.typesafe.sbt.mocha.MochaTestReporting.$anonfun$handleSuite$24$adapted(MochaTestReporting.scala:220)
[error] at scala.Option.foreach(Option.scala:257)
[error] at com.typesafe.sbt.mocha.MochaTestReporting.handleSuite(MochaTestReporting.scala:220)
[error] at com.typesafe.sbt.mocha.MochaTestReporting.$anonfun$logTestResults$3(MochaTestReporting.scala:81)
[error] at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
[error] at scala.collection.immutable.List.foreach(List.scala:388)
[error] at scala.collection.TraversableLike.map(TraversableLike.scala:233)
[error] at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
[error] at scala.collection.immutable.List.map(List.scala:294)
[error] at com.typesafe.sbt.mocha.MochaTestReporting.logTestResults(MochaTestReporting.scala:78)
[error] at com.typesafe.sbt.mocha.SbtMocha$.$anonfun$mochaTestTask$7(SbtMocha.scala:180)
[error] at scala.Option.map(Option.scala:146)
[error] at com.typesafe.sbt.mocha.SbtMocha$.$anonfun$mochaTestTask$5(SbtMocha.scala:179)
[error] at com.typesafe.sbt.mocha.SbtMocha$.$anonfun$projectSettings$15(SbtMocha.scala:128)
[error] at com.typesafe.sbt.mocha.SbtMocha$.$anonfun$projectSettings$15$adapted(SbtMocha.scala:112)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:278)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (foo / mochaOnly) no test suite
If I comment out the inner describe calls so that all the it tests are now on the same level, then the tests run normally again.
I also forked sbt-mocha and modified one of the test files in the scripted tests to do this, and I was able to replicate the issue there as well. Unfortunately, I'm not that familiar with the inner workings of this plugin, so I haven't been able to figure out the root cause yet.
The text was updated successfully, but these errors were encountered:
btmcnellis
changed the title
sbt-mocha fails when there are nested describes in sbt 1.x
sbt-mocha fails with "no test suite" when there are nested describes in sbt 1.x
Nov 30, 2018
In many of my tests, I have nested
describe
blocks to help organize things, like this:When running sbt-mocha 1.1.2 in an sbt 0.13.17 project, this works perfectly fine. However, when I upgraded the project to sbt 1.2.6, it started failing. Specifically, it would run the tests until it hit a file with a nested
describe
, then it would run the tests in that file, then it would fail with the following exception:If I comment out the inner
describe
calls so that all theit
tests are now on the same level, then the tests run normally again.I also forked sbt-mocha and modified one of the test files in the scripted tests to do this, and I was able to replicate the issue there as well. Unfortunately, I'm not that familiar with the inner workings of this plugin, so I haven't been able to figure out the root cause yet.
The text was updated successfully, but these errors were encountered: