Skip to content

chore(node-integration-tests): Improve node test runner naming#21685

Merged
mydea merged 6 commits into
developfrom
fn/node-runner-changes
Jun 24, 2026
Merged

chore(node-integration-tests): Improve node test runner naming#21685
mydea merged 6 commits into
developfrom
fn/node-runner-changes

Conversation

@mydea

@mydea mydea commented Jun 22, 2026

Copy link
Copy Markdown
Member

Noticed that this is really verbose right now: When using createEsmAndCjsTests right now, it produes a rather deeply nested structure, which is technically correct but pretty verbose:

Screenshot 2026-06-22 at 12 53 20

This PR adjusts this to instead produce this:

Screenshot 2026-06-22 at 12 50 35

Note that it also suffixes "- failed" in cases where a given env (e.g. esm or cjs) fails, making this more apparent in the test results.

It also adjust runner cleanup for createEsmAndCjsTests to only cleanup processes started by this specific suite, not all of them.

While at it, I also split the runner code into multiple files as this has become unwieldy, nothing functionally should change.

@mydea mydea self-assigned this Jun 22, 2026
@mydea mydea requested a review from a team as a code owner June 22, 2026 11:03
@mydea mydea requested review from JPeer264 and andreiborza and removed request for a team June 22, 2026 11:03

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0de77ce. Configure here.

Comment thread dev-packages/node-integration-tests/utils/runner.ts
Comment thread dev-packages/node-integration-tests/utils/runner.ts Outdated
Comment thread dev-packages/node-integration-tests/utils/runner.ts Outdated

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The output looks way better. The tests are failing, but it seems like a docker related issue, it should work after a rerun

@mydea mydea force-pushed the fn/node-runner-changes branch from 4fe9328 to e8f0ae8 Compare June 24, 2026 06:30
Comment thread dev-packages/node-integration-tests/utils/runner/createRunner.ts
Comment on lines +241 to +247
}

if (prop === 'each' || prop === 'for') {
return wrapTestEachApi(target[prop], suffix);
}

return Reflect.get(target, prop);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Test cleanup logic fragilely depends on Vitest's default afterAll hook execution order. A configuration change could break test cleanup.
Severity: LOW

Suggested Fix

Make the dependency on cleanup order explicit. Instead of relying on implicit framework behavior, the createEsmAndCjsTests function could return its cleanup function, which the calling test suite can then explicitly invoke in the correct order within its own afterAll block. This removes the invisible dependency on Vitest's configuration.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
dev-packages/node-integration-tests/utils/runner/createEsmAndCjsTests.ts#L241-L247

Potential issue: The test cleanup logic relies on the implicit default execution order
of `afterAll` hooks in Vitest, which is 'stack' (reverse registration order). This means
the inner cleanup hooks from `createEsmAndCjsTests` run before the outer
`cleanupChildProcesses` hook. While this works correctly under the current
configuration, it is fragile. If the Vitest configuration were changed to
`sequence.hooks: 'list'` or the test runner were switched to a framework with a
different hook execution order, the outer cleanup would run first, prematurely clearing
steps and causing subsequent cleanup logic to fail silently.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think so, we do not care when this runs because it just cleans up stuff.

@mydea mydea merged commit 0d042b0 into develop Jun 24, 2026
49 checks passed
@mydea mydea deleted the fn/node-runner-changes branch June 24, 2026 07:59
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