Skip to content

test: add WHATWG Performance API suite (opt-in via runPerformanceTests) - #25

Merged
NathanWalker merged 3 commits into
masterfrom
feat/performance-tests
Aug 11, 2026
Merged

test: add WHATWG Performance API suite (opt-in via runPerformanceTests)#25
NathanWalker merged 3 commits into
masterfrom
feat/performance-tests

Conversation

@edusperoni

@edusperoni edusperoni commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Adds a shared cross-runtime suite (53 specs) for the WHATWG Performance surface: hr-time (now/timeOrigin/toJSON), User Timing Level 3 (mark/measure with the full options algebra), performance-timeline queries, PerformanceObserver, and worker isolation (per-worker time origin and independent entry buffers, driven through Workers/EvalWorker.js).

The suite runs from runAllTests() and gates itself on the API being present: a runtime that does not define performance/PerformanceObserver reports a single visible pending spec instead of failures. This makes the PR safe to merge to master immediately — Android skips until it ships the API, no coordination needed. The iOS runtime (NativeScript/ios#430) pairs this with an unguarded canary in its own suite asserting the globals exist, so the gate cannot silently hide a regression on an implementing runtime.

Two implementation deviations are asserted as contract, so both runtimes implement them identically:

  • detail is retained by reference (no structuredClone in the runtimes);
  • observer callbacks are only guaranteed asynchronous delivery — nothing pins microtask vs. task scheduling.

Everything in the suite is runtime-agnostic JS (no ObjC/Android APIs); global error-listener suppression used by the throwing-observer spec is feature-detected.

Covers hr-time (now/timeOrigin/toJSON, monotonicity, sub-ms precision,
readonly accessor placement), User Timing Level 3 (mark/measure options
algebra, SyntaxError-named unknown-mark errors, clearMarks/clearMeasures),
performance timeline queries (chronological ordering, per-type/per-name
filtering), PerformanceObserver (entryTypes/type forms, buffered replay,
takeRecords/disconnect, registration-order delivery with a throwing
observer), and per-worker time-origin/buffer independence via EvalWorker.

Exported as runPerformanceTests and deliberately NOT part of runAllTests:
the suite requires a runtime that implements the API. The iOS runtime opts
in from its own test index; the Android runtime can do the same once it
ships the API, and the suite can then move into runAllTests.

Two implementation deviations are asserted as contract: mark/measure detail
is retained by reference (no structuredClone), and observer callbacks are
only guaranteed asynchronous delivery (nothing pins microtask vs task).
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b02282ce-4047-45ca-ae43-2919d9a5fb66

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@edusperoni

Copy link
Copy Markdown
Collaborator Author

Consumed by NativeScript/ios#430 (which opts into runPerformanceTests from the iOS test index). Merge this first; the iOS PR then bumps its submodule pointer to the resulting master commit.

Non-iterables (numbers, array-likes without @@iterator) and string
primitives must throw TypeError instead of silently observing nothing,
and any iterable — a Set, not just an Array — must convert.
…llTests

The suite now skips itself (one visible pending spec) on a runtime that
does not define performance/PerformanceObserver, so it can live inside
runAllTests() and merge to master without breaking runtimes that have
not shipped the API. Implementing runtimes keep an unguarded canary in
their own suite so the gate cannot hide a regression there.
@NathanWalker
NathanWalker merged commit a358473 into master Aug 11, 2026
3 checks passed
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