Skip to content

Test Runner docs could use more information on the concept of a Suite #60758

Description

@Ethan-Arrowood

Affected URL(s)

https://nodejs.org/docs/latest-v24.x/api/test.html

Description of the problem

The test runner docs could use more information regarding suites. Suites do behave subtly differently to a test with subtests. Documenting these difference is important.

For example, comparing and contrasting the difference in:

suite('s1', () => {
  test('t1', () => {
    assert.ok(true);
  });
  test('t2', () => {
    assert.ok(true);
  });
});

And then the equivalent:

test('s1', async (ctx) => {
  await ctx.test('t1', () => {
    assert.ok(true);
  });
  await ctx.test('t2', () => {
    assert.ok(true);
  });
});

I'm sure there is more details to mention too but this comparison stands out the most to me.

It also feels like the docs are missing this section because as you read the page top-to-bottom, you get to the Subtests section and it mentions:

This is necessary because tests do not wait for their subtests to complete, unlike tests created within suites.

Without ever actually introducing what a "suite" is.

I understand the concept of a "suite" is generally well understood in the context of a any test runner, but nonetheless the specifics for Node's version of it is important to detail as devs work to convert from other testing frameworks where they may be familiar with different assumptions for what a "suite" vs "test" is.

Activity

  1. added
    docIssues and PRs related to Node.js documentation.
    test_runnerIssues and PRs related to the test runner subsystem.
    on Nov 17, 2025
  2. composiokiwiqa-stack commented on Nov 20, 2025

    @composiokiwiqa-stack
  3. composiokiwiqa-stack commented on Nov 20, 2025

    @composiokiwiqa-stack
  4. vassudanagunta commented on Dec 20, 2025

    @vassudanagunta
    Contributor

    It has been on my todo list to seek clarification on the these very questions, as I'm building a test framework on top of node:test as well as custom reporters.

    Here is a related question the docs should answer, or possibly be answered by API fixes. node:test also allows you to nest tests within tests. In other words, you can do any of the following:

    1. suite
      • suite
        • test
        • test
    2. suite
      • test
        • t.test
        • t.test
    3. suite
      • test
        • test
        • test
    4. test
      • test
        • test
        • test

    Why are 3 and 4 allowed? Is it intentional? If so, are they semantically and functionally the same as 1?1 If not, what are the semantics? Or is it a bug that they are allowed?

    You can also nest subtests! So why do 5 vs 6?

    1. suite
      • test
        • t.test
          • t.test
          • t.test
        • t.test
    2. test
      • test
        • test
          • t.test
          • t.test
        • test

    Footnotes

    1. I believe I've observed behavioral differences, but I'd have to check. Let me know if you want data on this. ↩

  5. github-actions commented on Jul 19, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 210 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  6. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 19, 2026
  7. vassudanagunta commented on Jul 19, 2026

    @vassudanagunta
    Contributor

    i think this is still relevant, see my comment above

  8. removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 20, 2026
  9. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 90 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  10. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Oct 19, 2026
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

    docIssues and PRs related to Node.js documentation.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.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