test(instrumentation): add console instrumentation e2e test#353
Open
pjsny wants to merge 1 commit into
Open
Conversation
|
|
Signed-off-by: Philip Snyder <57119461+pjsny@users.noreply.github.com>
pjsny
force-pushed
the
test/e2e-console-instrumentation
branch
from
July 20, 2026 15:29
22c6321 to
37f33c1
Compare
joaquin-diaz
approved these changes
Jul 21, 2026
| it('emits a log record with body, severity, and method attribute for console.error', async () => { | ||
| result = testSdkSetup([new ConsoleInstrumentation()]); | ||
|
|
||
| console.error('database connection failed'); |
Contributor
There was a problem hiding this comment.
I know this is just for testing but can you use more browser-like error message just to avoid any kind of confusion on this running in node?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
This adds end-to-end coverage for
ConsoleInstrumentation, building on the e2e testing initiative from #332. This is test-only, no runtime/source changes.Short description of the changes
Adds
ConsoleInstrumentatione2e tests (e2e-tests/packages/instrumentation/console/)driving the real browser
consolethrough the SDK → OTLP/HTTP → MSW-mockedcollector pipeline, covering:
browser.consoleevent name,browser.console.methodattributelogMethodsconfig (only configured methods emit)console.*call inside an active span yields a logcarrying the span's
traceId/spanId)test-collector.tsOTLP log type withbody/eventName(already on the wire).StackContextManagerintest-otel-setup.tsso trace context propagates(needed for the correlation test); names its return type
TestSdkHandleandmigrates the
errorse2e test onto it.consolesource alias toe2e-tests/vitest.config.ts.Assertions match records by body, so any potential future unrelated logs emitted in the same window
won't cause flakes.
Type of change
How Has This Been Tested?
npm run test:e2e