Skip to content

test(node-integration): Replace conditionalTest with a supports helper - #25202

Merged
JPeer264 merged 1 commit into
developfrom
jp/node-integration-tests-skip-helper
Oct 12, 2026
Merged

JPeer264 merged 1 commit into
developfrom
jp/node-integration-tests-skip-helper

Conversation

@JPeer264

@JPeer264 JPeer264 commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Pro Tip: It is better to review it with the option "Hide whitespaces": https://github.com/getsentry/sentry-javascript/pull/25202/changes?w=1

This replaces conditionalTest with a supports(requirements) helper that returns a boolean, so blocks and single tests use the same requirements with Vitest's runIf. The RUNTIME checks in skipIf use it too, and skipRuntimes becomes runtimes, the runtimes that run the tests.

describe.runIf(supports({ min: 22 }))('OpenAI integration (V7)', () => {
  test.runIf(supports({ runtimes: ['node'] }))('...', async () => {});
});

Most of the diff is new indentation. Hide whitespace to review.

Why

Blocks used conditionalTest(options) and single tests used skipIf with a RUNTIME check, so one condition had two forms. With one helper, a new requirement, for example a minimum Bun version, works for both.

API decisions

The helper goes with runIf, not skipIf, so each requirement says where the tests run, and a call does not read as skipIf(shouldSkip({ skipRuntimes })). runIf cannot take the requirements object directly, because Vitest only checks if the value is truthy. Wrapping Vitest's test and describe would allow it, but then an object passed to Vitest's own functions would always run.

@JPeer264
JPeer264 added this pull request to stack #25205 October 9, 2026 06:50
@JPeer264

JPeer264 commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

bugbot run

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

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

@JPeer264
JPeer264 marked this pull request as ready for review October 9, 2026 07:10
@JPeer264
JPeer264 requested a review from a team as a code owner October 9, 2026 07:10
@JPeer264
JPeer264 requested review from andreiborza and isaacs and removed request for a team October 9, 2026 07:10
@JPeer264 JPeer264 self-assigned this Oct 9, 2026
@JPeer264
JPeer264 requested a review from s1gr1d October 9, 2026 07:10
…elper

`supports(requirements)` returns whether the Node version and the runtime
that runs the scenarios meet the requirements of the tests, for use in
`test.runIf` and `describe.runIf`. It replaces `conditionalTest` and the
`RUNTIME` checks in `skipIf`. `skipRuntimes` becomes `runtimes`, the
runtimes that run the tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the jp/node-integration-tests-skip-helper branch from 0ef01b6 to 146254e Compare October 12, 2026 11:19

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

Could we also add a bugbot review rule or a linting rule to use support over the older stuff?

@JPeer264

Copy link
Copy Markdown
Member Author

@andreiborza good idea, will do in a follow up 👍

@JPeer264
JPeer264 merged commit 96dfcc0 into develop Oct 12, 2026
101 of 103 checks passed
@JPeer264
JPeer264 deleted the jp/node-integration-tests-skip-helper branch October 12, 2026 13:10
JPeer264 added a commit that referenced this pull request Oct 12, 2026
…rom the test utils (#25292)

follow up to #25202

This stops exporting `NODE_VERSION` and `RUNTIME` from the Node
integration test utils, so suites limit tests with
`test.runIf(supports({ ... }))`. It moves `thread-blocked-native`, the
last suite that checked `NODE_VERSION` itself, to `supports`, and adds a
Bugbot rule that flags suites that check the Node version or the runtime
in other ways, for example with `process.versions`.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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