Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { createRunner } from '../../../runner';

// The worker is built by the Sentry Vite plugin (auto-instrumentation on). The
// runner detects `vite.config.mts`, runs `vite build`, and serves the generated
// output — so a workflow-step transaction only arrives if the build-time
// transform wrapped `MyWorkflow` with `instrumentWorkflowWithSentry`.
// output — so these transactions only arrive if the build-time transform wrapped
// `MyWorkflow` with `instrumentWorkflowWithSentry` and the default export with
// `withSentry`.
//
// The workflow step and the triggering request are separate executions whose
// envelopes race, so both are expected `unordered`.
it('auto-instruments a Workflow class', async ({ signal }) => {
const runner = createRunner(__dirname)
.expect(envelope => {
Expand All @@ -14,6 +18,13 @@ it('auto-instruments a Workflow class', async ({ signal }) => {
expect(transactionEvent.contexts?.trace?.op).toBe('function');
expect(transactionEvent.contexts?.trace?.origin).toBe('auto.faas.cloudflare.workflow');
})
.expect(envelope => {
const transactionEvent = envelope[1]?.[0]?.[1] as TransactionEvent;
expect(transactionEvent.transaction).toBe('GET /workflow/trigger');
expect(transactionEvent.contexts?.trace?.op).toBe('http.server');
expect(transactionEvent.contexts?.trace?.origin).toBe('auto.http.cloudflare');
})
.unordered()
.start(signal);

await runner.makeRequest('get', '/workflow/trigger');
Expand Down
Loading