test: add WHATWG Performance API suite (opt-in via runPerformanceTests) - #25
Conversation
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).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Consumed by NativeScript/ios#430 (which opts into |
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.
Adds a shared cross-runtime suite (53 specs) for the WHATWG Performance surface: hr-time (
now/timeOrigin/toJSON), User Timing Level 3 (mark/measurewith the full options algebra), performance-timeline queries,PerformanceObserver, and worker isolation (per-worker time origin and independent entry buffers, driven throughWorkers/EvalWorker.js).The suite runs from
runAllTests()and gates itself on the API being present: a runtime that does not defineperformance/PerformanceObserverreports a single visible pending spec instead of failures. This makes the PR safe to merge tomasterimmediately — 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:
detailis retained by reference (nostructuredClonein the runtimes);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.