Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: support call stacks in TestMessages #214488

Closed
connor4312 opened this issue Jun 6, 2024 · 6 comments · Fixed by #225517
Closed

API: support call stacks in TestMessages #214488

connor4312 opened this issue Jun 6, 2024 · 6 comments · Fixed by #225517

Comments

@connor4312
Copy link
Member

connor4312 commented Jun 6, 2024

Currently, messages that are shown when tests fail can only be shown at a single Location. Often (connor4312/nodejs-testing#37, #214287 (comment), among others) folks want to see the full call stack of the test failure.

I propose some API to add this information:

declare module 'vscode' {
	export class TestMessage2 extends TestMessage {
		/**
		 * The stack trace associated with the message or failure.
		 */
		stackTrace?: TestMessageStackFrame[];
	}

	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.
		 */
		file?: 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, file?: Uri, position?: Position);
	}
}
@timheuer
Copy link
Member

@connor4312 does this track that not only the stack but stack + any stdout would show in same UX? /cc @peterwald

@connor4312
Copy link
Member Author

Yes, output is already trackable and associable to a test case via the run.appendOutput API

@peterwald
Copy link
Member

We are using appendOutput() to record all stdout written by tests. In addition, the test.fail() is used to record the failure message and stack for each test failure.

@connor4312
Copy link
Member Author

UI: #222126

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 12, 2024

@connor4312 Just check with Joh and this looks good to move into finalized!

@connor4312
Copy link
Member Author

@mjbvz do we want to bundle this with any of the other testing proposals (#212196, #126932)?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants