From 76be2c1621b90d53ffc24ef0af4b784fcae8266b Mon Sep 17 00:00:00 2001 From: andrea Date: Wed, 17 Oct 2018 08:38:13 +0100 Subject: [PATCH] fix ServerSpec testing with dbuild --- .gitignore | 1 + sbt/src/server-test/completions/build.sbt | 2 -- .../completions/src/test/scala/ExampleSpec.scala | 10 ---------- .../streams/test/$global/$global/definedTestNames/data | 1 + sbt/src/test/scala/testpkg/ServerSpec.scala | 10 +--------- 5 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 sbt/src/server-test/completions/src/test/scala/ExampleSpec.scala create mode 100644 sbt/src/server-test/completions/target/streams/test/$global/$global/definedTestNames/data diff --git a/.gitignore b/.gitignore index 42de74605..c77c963b0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules vscode-sbt-scala/client/server npm-debug.log *.vsix +!sbt/src/server-test/completions/target diff --git a/sbt/src/server-test/completions/build.sbt b/sbt/src/server-test/completions/build.sbt index 2ffc095d3..90de9d529 100644 --- a/sbt/src/server-test/completions/build.sbt +++ b/sbt/src/server-test/completions/build.sbt @@ -2,5 +2,3 @@ val hello = taskKey[Unit]("Say hello") hello := {} - -libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" diff --git a/sbt/src/server-test/completions/src/test/scala/ExampleSpec.scala b/sbt/src/server-test/completions/src/test/scala/ExampleSpec.scala deleted file mode 100644 index 8719766a6..000000000 --- a/sbt/src/server-test/completions/src/test/scala/ExampleSpec.scala +++ /dev/null @@ -1,10 +0,0 @@ -package org.sbt - -import org.scalatest.FlatSpec - -class ExampleSpec extends FlatSpec { - "a test" should "do something" in { - assert(true == true) - assert(false == false) - } -} diff --git a/sbt/src/server-test/completions/target/streams/test/$global/$global/definedTestNames/data b/sbt/src/server-test/completions/target/streams/test/$global/$global/definedTestNames/data new file mode 100644 index 000000000..5236a9ab6 --- /dev/null +++ b/sbt/src/server-test/completions/target/streams/test/$global/$global/definedTestNames/data @@ -0,0 +1 @@ +["org.sbt.ExampleSpec"] \ No newline at end of file diff --git a/sbt/src/test/scala/testpkg/ServerSpec.scala b/sbt/src/test/scala/testpkg/ServerSpec.scala index 68ade60fb..da78827fd 100644 --- a/sbt/src/test/scala/testpkg/ServerSpec.scala +++ b/sbt/src/test/scala/testpkg/ServerSpec.scala @@ -128,20 +128,12 @@ class ServerSpec extends fixture.AsyncFreeSpec with fixture.AsyncTestDataFixture "return completions for user classes" in { implicit td => withTestServer("completions") { p => - p.sendJsonRpc( - """{ "jsonrpc": "2.0", "id":12, "method": "sbt/exec", "params": { "commandLine": "test" } }""" - ) - - p.waitForString(30) { s => - (s contains """"id":12,"result":{"status":"Done"""") && (s contains """"exitCode":0""") - } - val completionStr = """{ "query": "testOnly org." }""" p.sendJsonRpc( s"""{ "jsonrpc": "2.0", "id": 15, "method": "sbt/completion", "params": $completionStr }""" ) - assert(p.waitForString(30) { s => + assert(p.waitForString(10) { s => s contains """"result":{"items":["testOnly org.sbt.ExampleSpec"]}""" }) }