Skip to content

API: support call stacks in TestMessages #214488

Closed

Description

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);
	}
}

Activity

  1. timheuer commented on Jun 22, 2024

    @timheuer
    Contributor

    Connor Peet (@connor4312) does this track that not only the stack but stack + any stdout would show in same UX? /cc Peter Waldschmidt (@peterwald)

  2. connor4312 commented on Jun 22, 2024

    @connor4312
    MemberAuthor

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

  3. peterwald commented on Jun 24, 2024

    @peterwald
    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.

  4. connor4312 commented on Jul 19, 2024

    @connor4312
    MemberAuthor
  5. mjbvz commented on Aug 12, 2024

    @mjbvz
    Contributor

    Connor Peet (@connor4312) Just check with Joh and this looks good to move into finalized!

  6. connor4312 commented on Aug 12, 2024

    @connor4312
    MemberAuthor

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

  7. added a commit that references this issue on Aug 13, 2024
    1a152e2
  8. added a commit that references this issue on Aug 13, 2024
    ef72141
  9. locked and limited conversation to collaborators on Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions