Skip to content

Commit 5b53c34

Browse files
committed
Fix failing unit tests
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
1 parent e470f4f commit 5b53c34

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/test/groovy/nextflow/lsp/TestUtils.groovy

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ class TestUtils {
4040
return workspaceRoot
4141
}
4242

43-
/**
44-
* Approximate the language service waiting for a debounced update.
45-
*/
46-
static void awaitUpdate() {
47-
sleep(1200)
48-
}
49-
5043
/**
5144
* Get a language service instance for Nextflow scripts.
5245
*/
@@ -55,6 +48,9 @@ class TestUtils {
5548
def configuration = LanguageServerConfiguration.defaults()
5649
service.connect(new TestLanguageClient())
5750
service.initialize(workspaceRoot.toUri().toString(), configuration)
51+
// skip workspace scan
52+
open(service, getUri('main.nf'), '')
53+
service.updateNow()
5854
return service
5955
}
6056

src/test/groovy/nextflow/lsp/services/script/ScriptDefinitionTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ScriptDefinitionTest extends Specification {
5252
}
5353
'''
5454
open(service, uri, contents)
55-
awaitUpdate()
55+
service.updateNow()
5656
def location = getDefinition(service, uri, new Position(4, 4))
5757
then:
5858
location != null
@@ -84,7 +84,7 @@ class ScriptDefinitionTest extends Specification {
8484
HELLO('World')
8585
}
8686
''')
87-
awaitUpdate()
87+
service.updateNow()
8888
def location = getDefinition(service, mainUri, new Position(3, 4))
8989
then:
9090
location != null

src/test/groovy/nextflow/lsp/services/script/ScriptReferencesTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ScriptReferencesTest extends Specification {
6060
}
6161
'''
6262
open(service, uri, contents)
63-
awaitUpdate()
63+
service.updateNow()
6464
def references = getReferences(service, uri, new Position(0, 9))
6565
then:
6666
references[uri].size() == 2
@@ -88,7 +88,7 @@ class ScriptReferencesTest extends Specification {
8888
HELLO()
8989
}
9090
''')
91-
awaitUpdate()
91+
service.updateNow()
9292
def references = getReferences(service, moduleUri, new Position(0, 9))
9393
then:
9494
references[moduleUri].size() == 1

0 commit comments

Comments
 (0)