@@ -72,7 +72,7 @@ suite "Nimlangserver extensions":
7272 check tasks[0 ].name == " helloWorld"
7373 check tasks[0 ].description == " hello world"
7474
75- test " calling extension/test should return all existing tests" :
75+ test " calling extension/listTests should return all existing tests" :
7676 # We first need to initialize the nimble project
7777 let projectDir = getCurrentDir () / " tests" / " projects" / " testrunner"
7878 cd projectDir:
@@ -98,3 +98,25 @@ suite "Nimlangserver extensions":
9898 check testProjectInfo.suites[" Sample Tests" ].tests[0 ].name == " Sample Test"
9999 check testProjectInfo.suites[" Sample Tests" ].tests[0 ].file == " sampletests.nim"
100100 check testProjectInfo.suites[" Sample Tests" ].tests[0 ].line == 4
101+
102+ test " calling extension/runTests should run the tests and return the results" :
103+ let initParams =
104+ InitializeParams %* {
105+ " processId" : % getCurrentProcessId (),
106+ " rootUri" : fixtureUri (" projects/testrunner/" ),
107+ " capabilities" :
108+ {" window" : {" workDoneProgress" : true }, " workspace" : {" configuration" : true }},
109+ }
110+ let initializeResult = waitFor client.initialize (initParams)
111+
112+ let runTestsParams = RunTestParams (entryPoints: @ [" tests/projects/testrunner/tests/sampletests.nim" .absolutePath])
113+ let runTestsRes = client.call (" extension/runTests" , jsonutils.toJson (runTestsParams)).waitFor ().jsonTo (
114+ RunTestProjectResult
115+ )
116+ check runTestsRes.suites.len == 4
117+ check runTestsRes.suites[0 ].name == " Sample Tests"
118+ check runTestsRes.suites[0 ].tests == 1
119+ check runTestsRes.suites[0 ].failures == 0
120+ check runTestsRes.suites[0 ].errors == 0
121+ check runTestsRes.suites[0 ].skipped == 0
122+ check runTestsRes.suites[0 ].time > 0.0 and runTestsRes.suites[0 ].time < 1.0
0 commit comments