VS Code Dev Team Eyes Long-Requested Testing Support

The latest update to Visual Studio Code marks the early stages of an investigation by the dev team into improving testing support for Microsoft's popular, cross-platform, open source code editor.

Of course, testing is possible in VS Code via numerous extensions, but Microsoft is seeking to spearhead a more structured, comprehensive approach.

The 2020 Roadmap for VS Code, last updated 23 days ago, shows testing is an item:

Investigate how VS Code can improve the testing support. Several extensions are already providing testing support, explore what APIs/UIs could be added to improve these testing extensions and the test running experience.

In announcing the latest update to VS Code (v1.53, January 2021), the dev team this week said, "We are investigating testing in VS Code, and the first version of the API is now present in vscode.proposed.d.ts," referring to the team's set of unstable API that are implemented in VS Code but not exposed to the public as stable API does.

"This iteration focused building out the Selfhost Test Provider for VS Code and foundational UI, primarily the test explorer, gutter decorations, and peek views for results."

Testing approaches being considered by Microsoft are outlined in GitHub issue #107467, appropriately titled "Testing in VS Code."

Pointing out that testing has been a longstanding request dating back at least four years or so, the issue notes "excellent extensions" provided by the community, but noted some concerns with that approach.

"Each implementation of testing presents a different set of features, UI, and idiomaticity. Because there is no sanctioned approach to tests in VS Code, extension developers tend to make bespoke implementations, as we've seen in the Python and Java language extensions. Ideally, like in debugging, a VS Code user would have just about the same experience as they work between projects and languages.

"The Test Explorer UI presents the best point of inspiration for us, as there are many existing extensions built on its API: it's capable and proven. Regardless of the direction we take in VS Code, we should have a way for its Test Adapters to be upgraded to the new world."

A Failed Test Showing the Difference Between Actual and Expected Values in a Diff Peek View
[Click on image for larger view.] A Failed Test Showing the Difference Between Actual and Expected Values in a Diff Peek View (source: Microsoft).

The GitHub issue goes on to discuss different approaches that could be taken to prototype an API in the extension host, along with many other details all being fleshed out among many developers, including testing tool maintainers. That conversation, again, is right here.

Wrapping Tabs in Animated Action
[Click on image for larger, animated GIF view.] Wrapping Tabs in Animated Action (source: Microsoft).

Another highlight of the January 2021 update introduces the ability to wrap tabs across the top when there are too many to be shown onscreen, instead of having to use a scrollbar to see them all. Wrapping tabs is enabled by the workbench.editor.wrapTabs setting. Coincidentally, this feature was one of the favorite tips and tricks shared by Sana Ajani, a program manager on Microsoft's Visual Studio code team, in a presentation at the recent VS Code Day online event. She called it a "highly, highly requested" feature.

Other updates in VS Code v1.53 as highlighted by the team include:

All of the above and much more is presented in much greater detail in the automatic "Release Notes: 1.53.0" file that pops up when you load VS Code, of course, and in the announcement post.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


Subscribe on YouTube