Skip to content

Commit 849e6fd

Browse files
committed
Use inspect and .txt. ext for Sentry server events
1 parent 60ba722 commit 849e6fd

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

dev-packages/e2e-tests/test-applications/create-remix-app-fastify-vite/app/entry.server.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as Sentry from '@sentry/remix';
22
import fsp from 'node:fs/promises';
3+
import util from 'node:util';
34

45
Sentry.init({
56
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
@@ -8,10 +9,7 @@ Sentry.init({
89
beforeSendTransaction: async e => {
910
if (process.env.SNAPSHOT_SERVER_EVENTS) {
1011
// Snapshot events for inspections and e2e tests purposes.
11-
// Note how we are giving those events a `.json` extension when dumping then.
12-
// This is just for the sake of formatter support which make further visual
13-
// inspection easier.
14-
await fsp.writeFile(`tests/events/${e.event_id}.json`, JSON.stringify(e));
12+
await fsp.writeFile(`tests/events/${e.event_id}.txt`, util.inspect(e, false, null));
1513
}
1614
return e;
1715
},

dev-packages/e2e-tests/test-applications/create-remix-app-fastify-vite/tests/behaviour-server.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ interface Tag {
1111
}
1212

1313
test('Sends two linked transactions (server & client) to Sentry', async ({ page }, testInfo) => {
14-
// this warm up turned out to be needed when using 'beforeSendTransaction' the trick (see
15-
// the Sentry init setup in `entry.server.ts`); after this we can navigate to any route and
16-
// be sure that the transaction events are being dumped to disk as expected;
17-
//
18-
// note, that to perform this "warp up" we could actually navigate to any other route including
19-
// non-existant, but going to non-existant will pollute the console with something like
20-
// ' Error: No route matches URL "/whatever"', which will _not_ prevent the test from passing
21-
// but simply not very pleasant.
22-
await page.goto("/navigate");
23-
2414
// We will be utilizing `testId` provided by the test runner to correlate
2515
// this test instance with the events we are going to send to Sentry.
2616
// See `Sentry.setTag` in `app/routes/_index.tsx`.
@@ -72,7 +62,7 @@ test('Sends two linked transactions (server & client) to Sentry', async ({ page
7262
await expect.poll(async () => {
7363
const files = await readEventsDir();
7464
if (files.length !== 0) {
75-
serverEventIds = files.map(f => path.basename(f, ".json"));
65+
serverEventIds = files.map(f => path.basename(f, ".txt"));
7666
return true;
7767
}
7868
return false;

0 commit comments

Comments
 (0)