Finalize “test” interface (adds “options”).#115
Merged
Conversation
We aim to be a _strict subset_ of what `node:test` offers — no real
reason to diverge there. As such, rather than take `interval` as an
optional, positional argument, we should match Node’s _options_
interface which allows for `{ timeout?: number }` to be defined.
theengineear
commented
May 4, 2026
| * @returns {void} | ||
| */ | ||
| export function test(name, fn, timeout) { | ||
| export function test(name, options, fn) { |
Collaborator
Author
There was a problem hiding this comment.
This is the way. The tradeoff is between positional arguments (which we typically favor) and matching a well-known JS interface (Node’s standard test runner). In this case, the pragmatic / responsible choice is to mirror the prior art.
theengineear
commented
May 4, 2026
| } | ||
|
|
||
| /** | ||
| * @overload |
Collaborator
Author
There was a problem hiding this comment.
Because of the new call-signature, we need to do this over-loading thing to make all the tooling understand. Still, a small cost to pay for parity. At the end of the day, doing this means we can claim that any test written in x-test is a valid node test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We aim to be a strict subset of what
node:testoffers — no real reason to diverge there. As such, rather than takeintervalas an optional, positional argument, we should match Node’s options interface which allows for{ timeout?: number }to be defined.