Skip to content

Use subtest not describe level loop - #2574

Merged
shadowspawn merged 11 commits into
tj:developfrom
shadowspawn:use-subtest-not-describe-level-loop
Aug 1, 2026
Merged

shadowspawn merged 11 commits into
tj:developfrom
shadowspawn:use-subtest-not-describe-level-loop

Conversation

@shadowspawn

@shadowspawn shadowspawn commented Aug 1, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Running fixture loops with embedded tests at top level of describe is running the tests at file load time instead of a test time. This is not causing any known problems at the moment, but could cause confusion in the future.

Issue picked up by node-test/require-hook:

Solution

Wrap fixture loops in a test, and by convention use await for the nested test.

Couple of other tidies:

  • use built-in support for conditional test/describe
  • remove node-test/require-top-level-describe as we often use a top level test rather than describe, and don't want extra wrapper or to suppress the warning everywhere that pattern used.

The changes are a bit noisy, but a fairly pure refactor. (Turning off whitespace in the diff may help make this clearer.)

@shadowspawn
shadowspawn marked this pull request as ready for review August 1, 2026 09:33

@abetomo abetomo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@shadowspawn
shadowspawn merged commit 2e6d920 into tj:develop Aug 1, 2026
11 checks passed
@shadowspawn
shadowspawn deleted the use-subtest-not-describe-level-loop branch August 1, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants