Skip to content

Commit c9bcf37

Browse files
authored
Log standard out on passing tests (#2082)
1 parent cc8cb23 commit c9bcf37

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

global.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"sdk": {
3-
"version": "8.0.100"
3+
"version": "8.0.100",
4+
"rollForward": "feature",
5+
"allowPrerelease": false
46
}
57
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
},
2828
"engines": {
2929
"node": ">=16.0.0"
30-
}
30+
},
31+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
3132
}

release/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ You find a version of this plugin pre-packaged with the FOSS debugger from Samsu
5959

6060
## How to Contribute
6161

62-
Ths project is hosted on [GitHub](https://github.com/ionide/ionide-vscode-fsharp) where you can [report issues](https://github.com/ionide/ionide-vscode-fsharp/issues), participate in [discussions](https://github.com/ionide/ionide-vscode-fsharp/discussions), fork
62+
This project is hosted on [GitHub](https://github.com/ionide/ionide-vscode-fsharp) where you can [report issues](https://github.com/ionide/ionide-vscode-fsharp/issues), participate in [discussions](https://github.com/ionide/ionide-vscode-fsharp/discussions), fork
6363
the project and submit pull requests.
6464

6565
### Building and Running

src/Components/TestExplorer.fs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ module TestFrameworkId =
240240
type TestResult =
241241
{ FullTestName: string
242242
Outcome: TestResultOutcome
243+
Output: string option
243244
ErrorMessage: string option
244245
ErrorStackTrace: string option
245246
Expected: string option
@@ -312,7 +313,9 @@ module TrxParser =
312313
{ Message: string option
313314
StackTrace: string option }
314315

315-
type Output = { ErrorInfo: ErrorInfo }
316+
type Output =
317+
{ StdOut: string option
318+
ErrorInfo: ErrorInfo }
316319

317320
type UnitTestResult =
318321
{ ExecutionId: string
@@ -376,6 +379,8 @@ module TrxParser =
376379

377380
let outcome = xpathSelector.SelectStringRelative(node, "@outcome")
378381

382+
let outputMessage = xpathSelector.TrySelectStringRelative(node, "t:Output/t:StdOut")
383+
379384
let errorInfoMessage =
380385
xpathSelector.TrySelectStringRelative(node, "t:Output/t:ErrorInfo/t:Message")
381386

@@ -387,12 +392,12 @@ module TrxParser =
387392
let success, ts = TimeSpan.TryParse(durationString)
388393
if success then ts else TimeSpan.Zero
389394

390-
391395
{ ExecutionId = executionId
392396
Outcome = outcome
393397
Duration = durationSpan
394398
Output =
395-
{ ErrorInfo =
399+
{ StdOut = outputMessage
400+
ErrorInfo =
396401
{ StackTrace = errorStackTrace
397402
Message = errorInfoMessage } } }
398403

@@ -1237,7 +1242,12 @@ module Interactions =
12371242

12381243
match testResult.Outcome with
12391244
| TestResultOutcome.NotExecuted -> testRun.skipped testItem
1240-
| TestResultOutcome.Passed -> testRun.passed (testItem, testResult.Timing)
1245+
| TestResultOutcome.Passed ->
1246+
testResult.Output
1247+
|> Option.iter (TestRun.appendOutputLineForTest testRun testItem)
1248+
1249+
testRun.passed (testItem, testResult.Timing)
1250+
12411251
| TestResultOutcome.Failed ->
12421252
let fullErrorMessage =
12431253
match testResult.ErrorMessage with
@@ -1248,10 +1258,10 @@ module Interactions =
12481258
| None -> "No error reported"
12491259

12501260
let msg = vscode.TestMessage.Create(!^fullErrorMessage)
1251-
12521261
msg.location <- TestItem.tryGetLocation testItem
12531262
msg.expectedOutput <- testResult.Expected
12541263
msg.actualOutput <- testResult.Actual
1264+
12551265
TestRun.showFailure testRun testItem msg testResult.Timing
12561266

12571267
let mergeTestResultsToExplorer
@@ -1303,7 +1313,6 @@ module Interactions =
13031313
displayTestResultInExplorer testRun (treeItem, additionalResult))
13041314

13051315
let private trxResultToTestResult (trxResult: TrxParser.TestWithResult) =
1306-
// Q: can I get these parameters down to just trxResult?
13071316
let expected, actual =
13081317
match trxResult.UnitTestResult.Output.ErrorInfo.Message with
13091318
| None -> None, None
@@ -1320,6 +1329,7 @@ module Interactions =
13201329

13211330
{ FullTestName = trxResult.UnitTest.FullName
13221331
Outcome = !!trxResult.UnitTestResult.Outcome
1332+
Output = trxResult.UnitTestResult.Output.StdOut
13231333
ErrorMessage = trxResult.UnitTestResult.Output.ErrorInfo.Message
13241334
ErrorStackTrace = trxResult.UnitTestResult.Output.ErrorInfo.StackTrace
13251335
Expected = expected

0 commit comments

Comments
 (0)