Merge pull request #4427 from andreaTP/flakyCompletionsSpec

fix ServerSpec flaky test
This commit is contained in:
eugene yokota 2018-10-18 17:20:57 -04:00 committed by GitHub
commit 23063e2813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 21 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ node_modules
vscode-sbt-scala/client/server
npm-debug.log
*.vsix
!sbt/src/server-test/completions/target

View File

@ -2,5 +2,3 @@
val hello = taskKey[Unit]("Say hello")
hello := {}
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5"

View File

@ -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)
}
}

View File

@ -0,0 +1 @@
["org.sbt.ExampleSpec"]

View File

@ -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"]}"""
})
}