Skip to content

Feature request: report failing tests at the bottom of the spec reporter #47110

Description

@MoLow

What is the problem this feature will solve?

when test runs fail, it is currently needed to scroll up and manually search for the failing tests,

What is the feature you are proposing to solve the problem?

this behavior exists in some popular test runners (mocha, jest, playwright, etc),
re-printing the list of failing tests after the summary can be very useful

What alternatives have you considered?

scrolling to find the failing tests manually

Activity

  1. added
    good first issueIssues that are suitable for first-time contributors.
    feature requestIssues requesting new Node.js features.
    test_runnerIssues and PRs related to the test runner subsystem.
    on Mar 15, 2023
  2. changed the title [-]report failing tests at the bottom of the spec reporter[/-] [+]Feature request: report failing tests at the bottom of the spec reporter[/+] on Mar 15, 2023
  3. itsAfnanAlam commented on Mar 17, 2023

    @itsAfnanAlam

    Hi, can I take this?

  4. HinataKah0 commented on Mar 18, 2023

    @HinataKah0
    Contributor

    Hi,

    I am interested to work on the changes.

    Based on my understanding:

    • We need to output the failing tests report in root Test (lib/internal/test_runner/test.js).
    • Since #handleReportItem (lib/internal/test_runner/runner.js) immediately emits the test output to stream, we need to store the error output somewhere.
    • Eventually, all children Tests need to propagate the error outputs to their parents.
    • ArrayPrototypePush is concurrency safe.

    Please correct me if I am wrong.
    Draft commit here

    I need suggestions about the output format.
    I feel that if we output the whole diagnostics (including stack trace) again, it will make the output too cluttered since too many duplicates. Maybe we can omit the stack trace before the summary?
    And I am worried about the memory usage, should we allow this feature to be disabled by choice (using flag)?

    Also may I know how to properly re-generate test_runner_default_reporter.out?
    Thanks!

  5. MoLow commented on Mar 18, 2023

    @MoLow
    MemberAuthor

    @HinataKah0 I would expect the change to only affect the spec reporter
    whenever it receives a test:fail event, it can store the failed test, and when completed the reporting, it can print the failutes in the same format, at the end of the stream and with no indentation

  6. HinataKah0 commented on Mar 19, 2023

    @HinataKah0
    Contributor

    Hi @MoLow ,

    Thanks for the kind reply! Now the implementation is quite clear for me.
    However, I noticed that we need to introduce a new event to mark the end of tests (e.g. test:eot).
    Because test:diagnostic is sent a few times so it doesn't signify the ending. Actually I can maintain a counter but I don't think it's clean.

    To illustrate what I am talking about here

    Does this match to what you have in mind?
    Screenshot_2023-03-19_at_7 12 19_PM
    I think adding file path will be very useful.

    It took me a while to understand how nodejs' build testing works (and to understand why I broke some tests). 🤣

    Thanks!

  7. moved this from Awaiting Triage to Done in Node.js feature requestson Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.good first issueIssues that are suitable for first-time contributors.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions