Testing Extension API: Enrich TestMessage #133028
Labels
testing
Built-in testing support
under-discussion
Issue is under discussion for relevance, priority, approach
Motivation
I think it would be very useful if VS Code (or an extension) could help fixing failing tests, in particular those where a deep strict equal assertion failed, like this:
Problem
However, there is no nice way extensions can do that if the test provider does not expose the exact shape of the actual data. Currently there is not even a way test providers can expose data at all.
This is the current definition of a
TestMessage
:expectedOutput
andactualOutput
are shown to the user and thus are optimized for being human-readable and not machine-readable.When implementing the motivating feature, this causes a conflict: Either
actualOutput
is nice to read by humans or it truthfully reflects the actual value that can be used to as expected output to fix the test.Proposed Solution 1
Allow test providers to attach arbitrary metadata to test messages.
Consumers of such test message can set/read that metadata:
The downside of this approach is that metadata has no semantics and is not standardized and extensions can do anything they like.
Proposed Solution 2: Introduce TestMessage.actualOutputJSON
However, this might only apply to JavaScript based test-runners.
Proposed Solution 3: Support extension-private meta data
Like solution 1, but this metadata is only visibile to the extension that produced the test item.
This extension has to export APIs so that other extension can query this metadata.
The text was updated successfully, but these errors were encountered: