Skip to content

Add scoped tracing start variants - #37

Merged
fiws merged 1 commit into
mainfrom
push-scoped-tracing
Nov 9, 2026
Merged

fiws merged 1 commit into
mainfrom
push-scoped-tracing

Conversation

@fiws

@fiws fiws commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #36. Playwright 1.64 made Tracing.start() and Tracing.startChunk() return a Disposable that stops tracing. #36 dropped it so those wrappers keep succeeding with void; this adds the Effect equivalent of disposal.

Changes

  • Tracing.startScoped(options?, stopOptions?): starts tracing and stops it when the current Scope closes, including on failure or interruption.
  • Tracing.startChunkScoped(options?, stopOptions?): the same for trace chunks.
  • Stop options such as path are the second argument, since stopping happens in the scope's finalizer. Errors while stopping are logged rather than failing the scope, matching how browser.newContext closes contexts.
  • start() and startChunk() are unchanged.
yield* context.tracing.startScoped(
  { screenshots: true, snapshots: true },
  { path: "trace.zip" },
);

Verification

  • New tests in src/browser-context.test.ts: startScoped in a failing scope writes the trace and leaves tracing stopped (it can be started again); startChunkScoped writes the chunk on scope close.
  • Temporarily replacing the release step with Effect.void makes the startScoped test fail with ENOENT on the trace file.
  • pnpm check, pnpm type-check, pnpm test (111 tests), and pnpm check-doc-examples pass.

@fiws fiws self-assigned this Nov 9, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/effect-playwright@5009a34

commit: 5009a34

@fiws
fiws merged commit bde063c into main Nov 9, 2026
4 checks passed
@fiws
fiws deleted the push-scoped-tracing branch November 9, 2026 15:38
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.

1 participant