test(perf_hooks): expand granular Node parity coverage#6493
Conversation
📝 WalkthroughWalkthroughThe PR expands Changesperf_hooks parity suite
Estimated code review effort: 3 (Moderate) | ~30 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
…-hooks-parity # Conflicts: # test-parity/node_suite_baseline.json
There was a problem hiding this comment.
🧹 Nitpick comments (2)
test-parity/node-suite/perf_hooks/constants/all-gc-values.ts (1)
3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueStandardize the string sorting approach.
The first log statement uses the default array
.sort()(which orders by UTF-16 code units), while this statement uses.localeCompare(). For strict deterministic testing across platforms that might configure their default locale differently, it is safer and more consistent to use standard string comparison for both.♻️ Proposed refactor
console.log( - Object.entries(constants).sort(([a], [b]) => a.localeCompare(b)).map(( + Object.entries(constants).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(( [key, value], ) => `${key}=${value}`).join(","), );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test-parity/node-suite/perf_hooks/constants/all-gc-values.ts` around lines 3 - 7, Update the Object.entries(constants) sorting in the log statement to use standard deterministic string comparison consistent with the other log statement, replacing locale-sensitive localeCompare behavior while preserving the existing key ordering and output format.test-parity/node-suite/perf_hooks/aaa-time-origin/not-lazy.ts (1)
6-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueResolve static analysis warning for self-comparison.
The static analysis tool Biome flagged a self-comparison (
noSelfCompare) here. While the intention is clearly to verify the idempotency of thetimeOrigingetter, assigning the property to a variable first will satisfy the linter without diminishing the test's validity.♻️ Proposed refactor
-console.log( - "timeOrigin stable:", - performance.timeOrigin === performance.timeOrigin, -); +const origin = performance.timeOrigin; +console.log( + "timeOrigin stable:", + origin === performance.timeOrigin, +);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test-parity/node-suite/perf_hooks/aaa-time-origin/not-lazy.ts` around lines 6 - 9, Update the timeOrigin stability check in not-lazy.ts by first assigning performance.timeOrigin to a local variable, then comparing that captured value with a subsequent performance.timeOrigin read. Preserve the existing console.log output and idempotency assertion while avoiding the direct self-comparison flagged by Biome.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test-parity/node-suite/perf_hooks/aaa-time-origin/not-lazy.ts`:
- Around line 6-9: Update the timeOrigin stability check in not-lazy.ts by first
assigning performance.timeOrigin to a local variable, then comparing that
captured value with a subsequent performance.timeOrigin read. Preserve the
existing console.log output and idempotency assertion while avoiding the direct
self-comparison flagged by Biome.
In `@test-parity/node-suite/perf_hooks/constants/all-gc-values.ts`:
- Around line 3-7: Update the Object.entries(constants) sorting in the log
statement to use standard deterministic string comparison consistent with the
other log statement, replacing locale-sensitive localeCompare behavior while
preserving the existing key ordering and output format.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0ace59b3-1284-492b-b328-be0a41aca640
📒 Files selected for processing (81)
scripts/node_suite_run.pytest-parity/node-suite/perf_hooks/README.mdtest-parity/node-suite/perf_hooks/aaa-time-origin/not-lazy.tstest-parity/node-suite/perf_hooks/clear/measure-symbol-throws.tstest-parity/node-suite/perf_hooks/clear/repeated-name.tstest-parity/node-suite/perf_hooks/constants/all-gc-values.tstest-parity/node-suite/perf_hooks/entries/argument-validation.tstest-parity/node-suite/perf_hooks/entries/snapshot-identity.tstest-parity/node-suite/perf_hooks/entries/timeline-sorting.tstest-parity/node-suite/perf_hooks/eventlooputil/two-arg-synthetic.tstest-parity/node-suite/perf_hooks/global/illegal-constructors.tstest-parity/node-suite/perf_hooks/histogram/add-isolation.tstest-parity/node-suite/perf_hooks/histogram/add-validation.tstest-parity/node-suite/perf_hooks/histogram/empty-state.tstest-parity/node-suite/perf_hooks/histogram/illegal-constructor.tstest-parity/node-suite/perf_hooks/histogram/monitor-disabled-reset.tstest-parity/node-suite/perf_hooks/histogram/monitor-distinct-handles.tstest-parity/node-suite/perf_hooks/histogram/monitor-lifecycle.tstest-parity/node-suite/perf_hooks/histogram/monitor-options-validation.tstest-parity/node-suite/perf_hooks/histogram/options-validation.tstest-parity/node-suite/perf_hooks/histogram/percentile-validation.tstest-parity/node-suite/perf_hooks/histogram/percentiles-maps.tstest-parity/node-suite/perf_hooks/histogram/percentiles.tstest-parity/node-suite/perf_hooks/histogram/record-delta.tstest-parity/node-suite/perf_hooks/histogram/record-number-bigint.tstest-parity/node-suite/perf_hooks/histogram/record-validation.tstest-parity/node-suite/perf_hooks/histogram/reset.tstest-parity/node-suite/perf_hooks/histogram/to-json.tstest-parity/node-suite/perf_hooks/imports/function-aliases.tstest-parity/node-suite/perf_hooks/imports/namespace-keys.tstest-parity/node-suite/perf_hooks/mark/detail-circular.tstest-parity/node-suite/perf_hooks/mark/direct-constructor.tstest-parity/node-suite/perf_hooks/mark/repeated-name-latest.tstest-parity/node-suite/perf_hooks/mark/reserved-node-milestone.tstest-parity/node-suite/perf_hooks/measure/detail-clone-failures.tstest-parity/node-suite/perf_hooks/node-timing/shape-invariants.tstest-parity/node-suite/perf_hooks/node-timing/to-json.tstest-parity/node-suite/perf_hooks/now/monotonic.tstest-parity/node-suite/perf_hooks/now/sub-ms-precision.tstest-parity/node-suite/perf_hooks/observer/buffered-false-excludes-prior.tstest-parity/node-suite/perf_hooks/observer/buffered.tstest-parity/node-suite/perf_hooks/observer/callback-this.tstest-parity/node-suite/perf_hooks/observer/disconnect-clears-queue.tstest-parity/node-suite/perf_hooks/observer/duplicate-entry-types.tstest-parity/node-suite/perf_hooks/observer/entry-list-snapshot.tstest-parity/node-suite/perf_hooks/observer/entry-list-validation.tstest-parity/node-suite/perf_hooks/observer/mode-switch-validation.tstest-parity/node-suite/perf_hooks/observer/multiple-type-replaces.tstest-parity/node-suite/perf_hooks/observer/reobserve-after-disconnect.tstest-parity/node-suite/perf_hooks/observer/replacement-retains-queued.tstest-parity/node-suite/perf_hooks/observer/single-type-accumulates.tstest-parity/node-suite/perf_hooks/observer/supported-entry-types-exact.tstest-parity/node-suite/perf_hooks/observer/take-records-suppresses-callback.tstest-parity/node-suite/perf_hooks/resource-timing/cache-mode-validation.tstest-parity/node-suite/perf_hooks/resource-timing/cache-transfer-size.tstest-parity/node-suite/perf_hooks/resource-timing/controlled-fields.tstest-parity/node-suite/perf_hooks/resource-timing/illegal-constructor-tag.tstest-parity/node-suite/perf_hooks/resource-timing/mark-resource-entry.tstest-parity/node-suite/perf_hooks/resource-timing/mark-resource-timing.tstest-parity/node-suite/perf_hooks/resource-timing/observer-delivery.tstest-parity/node-suite/perf_hooks/resource-timing/to-json-controlled.tstest-parity/node-suite/perf_hooks/shapes/prototype-tags.tstest-parity/node-suite/perf_hooks/shapes/public-descriptors.tstest-parity/node-suite/perf_hooks/shapes/receiver-branding.tstest-parity/node-suite/perf_hooks/timerify/async-fulfill.tstest-parity/node-suite/perf_hooks/timerify/async-reject.tstest-parity/node-suite/perf_hooks/timerify/constructor.tstest-parity/node-suite/perf_hooks/timerify/entry-arguments.tstest-parity/node-suite/perf_hooks/timerify/function-entry.tstest-parity/node-suite/perf_hooks/timerify/histogram-async.tstest-parity/node-suite/perf_hooks/timerify/histogram-sync.tstest-parity/node-suite/perf_hooks/timerify/invalid-function.tstest-parity/node-suite/perf_hooks/timerify/invalid-histogram.tstest-parity/node-suite/perf_hooks/timerify/multiple-wrapping.tstest-parity/node-suite/perf_hooks/timerify/name-length-descriptors.tstest-parity/node-suite/perf_hooks/timerify/return-object-identity.tstest-parity/node-suite/perf_hooks/timerify/sync-throw-no-entry.tstest-parity/node-suite/perf_hooks/timerify/this-arguments-result.tstest-parity/node-suite/perf_hooks/timerify/timerify.tstest-parity/node-suite/perf_hooks/to-json/fresh-snapshots.tstest-parity/node_suite_baseline.json
💤 Files with no reviewable changes (3)
- test-parity/node-suite/perf_hooks/timerify/timerify.ts
- test-parity/node-suite/perf_hooks/now/monotonic.ts
- test-parity/node-suite/perf_hooks/resource-timing/mark-resource-timing.ts
Summary
node:perf_hookssuite from 83 to 148 deterministic fixturesperf_hooksinto the sequential node-suite lane and document the deterministic stopping boundaryOracle and comparison evidence
Node 26.5.0 remains authoritative where Deno and Bun expose smaller or intentionally different surfaces.
Validation
cargo build --releasecargo fmt --all -- --checkdeno fmt --checkon all changed suite filesscripts/check_file_size.shExclusions
GC/finalization entries, exact event-loop measurements, CPU contention, real network resource timing, workers, trace/inspector integration, bootstrap timestamp snapshots, races, stress, exhaustion, and leak tests remain outside this deterministic lane.
Summary by CodeRabbit
New Features
node:perf_hookscompatibility coverage to 148 scenarios, including timing, observers, histograms, resource timing, andtimerify.Documentation
Tests
perf_hookschecks to sequential execution for more reliable results.