hbenl / vscode-test-explorer

The VS Code Test Explorer extension
MIT License
215 stars 55 forks source link

[Question] There is a way to put messages in Test Explorer Output? #145

Closed danielmeza closed 4 years ago

danielmeza commented 4 years ago

I wonder if there is any way to put a custom message in the test explorer, this is useful for trace what happen in the test code, for example in Visual Studio we use the Trace.WriteLine and all that output is show in the test result detail.

matepek commented 4 years ago

Hey, I' not sure what do you mean by custom message. You can add any message to output window through events. If you thinking adding diagnostic messages here is a solution: https://github.com/hbenl/vscode-test-adapter-util/blob/master/src/log.ts

danielmeza commented 4 years ago

Hi @matepek sorry if I not explain my self well, what I means is to write a simple console log inside a test case and see that log related to the execution of a test.

hbenl commented 4 years ago

write a simple console log inside a test case and see that log related to the execution of a test.

This is possible if the Test Adapter implements it. For example, the Mocha Test Adapter will read all messages from stdout and stderr and write them to its own output channel (which is used to collect the output from all tests) as well as send them to Test Explorer in events so they can be shown in Test Explorer's output channel (which always shows the output from one test).