feat: integrate trace mark with render#47
Conversation
| } | ||
|
|
||
| function mark(locator: Locator, name: string, fn: Function, error: Error) { | ||
| if ('captureStackTrace' in Error) { |
There was a problem hiding this comment.
Can we create the error only if mark exists?
There was a problem hiding this comment.
I moved new Error + captureStackTrace guarded inside.
If we want to avoid this based on trace activity, then we need to expose getBrowserState().activeTraceTaskIds.has(currentTest.id) like logic (which is what vitest browser use internally to avoid overhead entirely) to user land.
There was a problem hiding this comment.
Alternatively we could change the API to receive the locator.mark(name, { captureStackTraceFn: fn }) instead of locator.mark(name, { stack }) 🤔
|
Could you also open PRs to |
|
Vue and Svelte |
|
I think you can return a then property and do it there - if render is awaited, we add a mark. In the next major we can make the render function itself async. |
|
@sheremet-va that's genius! |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
page/locator.markAPI to enhance playwright trace vitest-dev/vitest#9652This PR adds
markAPI insiderender/rerender/unmountcalls.Example
$ pnpm test --run --browser.trace --browser.headless render.test.tsx $ pnpm playwright show-trace .vitest-attachments/test-traces-render-test-tsx-react--chromium--renders-counter-0-0-trace-zip-9387db5f219ca34ece839c1eb57841b5ebb3e0c2.zipScreencast.From.2026-02-27.09-45-00.mp4