Skip to content

feat: record hooks and fixtures in trace timeline - #11755

Draft
hi-ogawa wants to merge 2 commits into
mainfrom
feat/trace-timeline-hooks
Draft

hi-ogawa wants to merge 2 commits into
mainfrom
feat/trace-timeline-hooks

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR records hooks and fixtures as trace steps, so the timeline shows where the time went before and during the test body.

Trace:
  step                       start  duration  location
  aroundEach                  +0ms      21ms  basic.test.ts:13:1
  beforeEach                 +21ms     134ms  basic.test.ts:18:1
  ├── fixture server         +22ms      32ms  basic.test.ts:5:19
  │   └── vi.waitFor()       +22ms      31ms  basic.test.ts:7:14
  └── expect.poll().toBe()  +155ms       0ms  basic.test.ts:20:35
  expect.poll().toBe()      +155ms     102ms  basic.test.ts:26:53

Some details

  • The recorded steps are beforeEach and its returned cleanup, afterEach, aroundEach setup and teardown, onTestFinished, onTestFailed, and fixture setup and teardown.
  • Steps after the test body, such as afterEach, fixture teardown, and onTestFinished, are printed in the terminal only when they fail or don't finish, to save space in the timeline.
  • beforeAll and afterAll are not recorded, because they run once per suite rather than per attempt, and a failure there is reported on the suite, which has no timeline.
  • experimental.traceTimeline still adds no measurable cost to passing tests. On 20,000 passing tests that each run aroundEach, beforeEach with cleanup, afterEach, a fixture, and onTestFinished (one worker, 8 interleaved runs), the run took 2.31s on average with the option off and 2.32s with it on, which is within run-to-run noise.
  • Browser trace view doesn't record hooks and fixtures yet, because browser mode uses its own trace recorder. Sharing one recorder, so that browser trace view gets these steps too, is tracked in Share one trace recorder between the node trace timeline and browser trace view #12012.

@hi-ogawa
hi-ogawa changed the base branch from feat/node-trace-timeline to feat/trace-timeline-wait-message October 27, 2026 07:06
@hi-ogawa
hi-ogawa added this pull request to stack #11758 October 27, 2026 07:06
@netlify

netlify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit ec03712
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6afd2621cff269ac8e3c39e7
😎 Deploy Preview https://deploy-preview-11755--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Base automatically changed from feat/trace-timeline-wait-message to main November 2, 2026 06:56
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hi-ogawa
hi-ogawa force-pushed the feat/trace-timeline-hooks branch from c0ac9d4 to 846cae0 Compare November 2, 2026 07:08
@flakiness-io

flakiness-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Test Results Summary

This comment shows the latest test results for this pull request.

Commit Status Test Results CI Runs
ec03712 ✅ Passed 32208 passed · 235 flaky · 1188 skipped 30 runs
⚠️ 235 flaky

⚠️ win 10.0.26100 · threads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 26.04 · vmThreads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 26.04 · threads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 26.04 · vmThreads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 26.04 · forks test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 26.04 · forks test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ win 10.0.26100 · vmThreads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ Ubuntu 26.04 · threads test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ win 10.0.26100 · forks test/unit/test/retry.test.ts:55 › describe object add(1, 1) › returned value not be greater than 2
⚠️ win 10.0.26100 · threads test/unit/test/retry.test.ts:61 › describe object add(1, 1) › returned value not be less than 2
…and 225 more

View full report

ℹ️ About Flakiness.io in GitHub

Your team has set up Flakiness.io pull request comments. This comment is updated when

  • The first test results arrive for this pull request
  • A later run reports more results for the same commit
  • A new commit is pushed and tested

Flakiness.io rewrites the comment in place, so it always reflects the most recently tested commit.

…-hooks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

Record hooks and fixtures in the trace timeline

1 participant