Skip to content

Commit

Permalink
testing: finalize test message stack trace API
Browse files Browse the repository at this point in the history
Closes #214488
  • Loading branch information
connor4312 committed Aug 13, 2024
1 parent 37d001c commit 1a152e2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export async function scanTestOutput(
enqueueExitBlocker(
(async () => {
const stackInfo = await deriveStackLocations(store, rawErr, tcase!);
let message: vscode.TestMessage2;
let message: vscode.TestMessage;

if (hasDiff) {
message = new vscode.TestMessage(tryMakeMarkdown(err));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"src/**/*",
"../../../src/vscode-dts/vscode.d.ts",
"../../../src/vscode-dts/vscode.proposed.testObserver.d.ts",
"../../../src/vscode-dts/vscode.proposed.testMessageStackTrace.d.ts",
"../../../src/vscode-dts/vscode.proposed.testRelatedCode.d.ts",
"../../../src/vscode-dts/vscode.proposed.attributableCoverage.d.ts"
]
Expand Down
3 changes: 0 additions & 3 deletions src/vs/platform/extensions/common/extensionsApiProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,6 @@ const _allApiProposals = {
terminalSelection: {
proposal: 'https://github.com/raw/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts',
},
testMessageStackTrace: {
proposal: 'https://github.com/raw/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testMessageStackTrace.d.ts',
},
testObserver: {
proposal: 'https://github.com/raw/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
},
Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
TestResultState: extHostTypes.TestResultState,
TestRunRequest: extHostTypes.TestRunRequest,
TestMessage: extHostTypes.TestMessage,
TestMessage2: extHostTypes.TestMessage,
TestMessageStackFrame: extHostTypes.TestMessageStackFrame,
TestTag: extHostTypes.TestTag,
TestRunProfileKind: extHostTypes.TestRunProfileKind,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTypeConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,7 @@ export namespace TestMessage {
actual: message.actualOutput,
contextValue: message.contextValue,
location: message.location && ({ range: Range.from(message.location.range), uri: message.location.uri }),
stackTrace: (message as vscode.TestMessage2).stackTrace?.map(s => ({
stackTrace: message.stackTrace?.map(s => ({
label: s.label,
position: s.position && Position.from(s.position),
uri: s.uri && URI.revive(s.uri).toJSON(),
Expand Down
33 changes: 33 additions & 0 deletions src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18093,6 +18093,34 @@ declare module 'vscode' {
error: string | MarkdownString | undefined;
}

/**
* A stack frame found in the {@link TestMessage.stackTrace}.
*/
export class TestMessageStackFrame {
/**
* The location of this stack frame. This should be provided as a URI if the
* location of the call frame can be accessed by the editor.
*/
uri?: Uri;

/**
* Position of the stack frame within the file.
*/
position?: Position;

/**
* The name of the stack frame, typically a method or function name.
*/
label: string;

/**
* @param label The name of the stack frame
* @param file The file URI of the stack frame
* @param position The position of the stack frame within the file
*/
constructor(label: string, uri?: Uri, position?: Position);
}

/**
* Message associated with the test state. Can be linked to a specific
* source range -- useful for assertion failures, for example.
Expand Down Expand Up @@ -18149,6 +18177,11 @@ declare module 'vscode' {
*/
contextValue?: string;

/**
* The stack trace associated with the message or failure.
*/
stackTrace?: TestMessageStackFrame[];

/**
* Creates a new TestMessage that will present as a diff in the editor.
* @param message Message to display to the user.
Expand Down
38 changes: 0 additions & 38 deletions src/vscode-dts/vscode.proposed.testMessageStackTrace.d.ts

This file was deleted.

0 comments on commit 1a152e2

Please sign in to comment.