Skip to content

feat(core): align fake timers api#1439

Open
9aoy wants to merge 3 commits into
mainfrom
9aoy/fake-timers-api
Open

feat(core): align fake timers api#1439
9aoy wants to merge 3 commits into
mainfrom
9aoy/fake-timers-api

Conversation

@9aoy

@9aoy 9aoy commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR aligns Rstest's fake timers runtime API with the upgraded @sinonjs/fake-timers@15.4.0 API surface. The runtime now accepts the upstream tick/system-time input types, adds rstest.jumpTimersByTime() and rstest.setTickMode(), and updates the public types plus English/Chinese docs accordingly.

It also fixes the browser-mode compatibility gap: browser mode previously aliased @sinonjs/fake-timers to a local no-op/minimal stub that only kept a clock-shaped object and did not actually fake browser globals such as setTimeout or Date. Since modern @sinonjs/fake-timers provides browser bundler fallbacks and the core browser runtime bundles the real implementation, this PR removes the alias and stub so browser tests use real fake timers. A browser e2e file now validates the full fake-timer flow, including timer globals, Date/performance, async timers, animation frames, microtasks, excluded timers, string durations, jumpTimersByTime, and setTickMode.

Related Links

https://github.com/sinonjs/fake-timers/releases/tag/v15.4.0

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying rstest with  Cloudflare Pages  Cloudflare Pages

Latest commit: cf0c937
Status: ✅  Deploy successful!
Preview URL: https://1764f853.rstest.pages.dev
Branch Preview URL: https://9aoy-fake-timers-api.rstest.pages.dev

View logs

@9aoy

9aoy commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf0c937f48

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/runtime/api/fakeTimers.ts
@9aoy

9aoy commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f45d989ba3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread e2e/browser-mode/fixtures/basic/tests/fakeTimers.test.ts Outdated
@9aoy

9aoy commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: fba64822a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant