Skip to content

fix(types): return jest from setSystemTime - #33923

Open
ShiroKSH wants to merge 1 commit into
oven-sh:mainfrom
ShiroKSH:jest-set-system-time-return-type
Open

ShiroKSH wants to merge 1 commit into
oven-sh:mainfrom
ShiroKSH:jest-set-system-time-return-type

Conversation

@ShiroKSH

Copy link
Copy Markdown

What changed

  • Declare jest.setSystemTime() as returning the jest object, matching the runtime.
  • Add an exact-type regression assertion to the bun-types fixture.

Why

The native host function returns its receiver, but the declaration reported void. This prevented typed fluent usage even though it already works at runtime.

Verification

  • TypeScript 6 compile check without DOM types
  • TypeScript 6 compile check with DOM types
  • Current-main Bun runtime check: jest.setSystemTime() === jest
  • Regression assertion fails with the old declaration and passes with this change

@ShiroKSH
ShiroKSH requested a review from alii as a code owner July 10, 2026 13:34

@claude claude Bot left a comment

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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 593eb4b3-8e50-4a9a-a410-cae0f54f1fb0

📥 Commits

Reviewing files that changed from the base of the PR and between c1076ce and 93adef0.

📒 Files selected for processing (2)
  • packages/bun-types/test.d.ts
  • test/integration/bun-types/fixture/mocks.ts

Walkthrough

Changes

setSystemTime type contract

Layer / File(s) Summary
Update declaration and validate return type
packages/bun-types/test.d.ts, test/integration/bun-types/fixture/mocks.ts
jest.setSystemTime now returns typeof jest, and a fixture assertion validates the updated type.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change to setSystemTime's return type.
Description check ✅ Passed The PR explains the change, motivation, and verification, covering the template's required information.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ShiroKSH

Copy link
Copy Markdown
Author

@alii - Buildkite has been pending since July 10, and CodeRabbit reported no actionable issues. Could you approve or restart the CI run, or route this to the right reviewer? I can make any requested changes. Thanks!

@ShiroKSH

ShiroKSH commented Aug 8, 2026

Copy link
Copy Markdown
Author

Hi maintainers, this PR has been open for over two weeks. When you have a moment, I would appreciate a review. Thank you.

@robobun

robobun commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Triage note: this is not on main yet (checked at f426a8e), the branch still merges cleanly, and bun test test/integration/bun-types/bun-types.test.ts passes with it applied. #36505, which had copied this fix into a batch, has been cut down so it no longer overlaps; this PR is the one to land for it.

One heads up: #32333, #32335, #32455 and #33923 all append to the end of test/integration/bun-types/fixture/mocks.ts, so whichever of them lands first will put the other three into a trivial conflict (keep both sides). A quick rebase at that point should be all that is needed. #32455 also inserts now() directly below the setSystemTime line this PR changes in test.d.ts, so that one conflicts the same way.

Thanks for the fix and for the patience.

This branch has not been deployed

No deployments
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