Skip to content

Commit c7cfa72

Browse files
committed
Test actionTransformer and stateTransformer
1 parent c8482b9 commit c7cfa72

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

dev-packages/e2e-tests/test-applications/vue-3/src/main.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@ Sentry.init({
2525
trackComponents: ['ComponentMainView', '<ComponentOneView>'],
2626
});
2727

28-
pinia.use(Sentry.createSentryPiniaPlugin());
28+
pinia.use(
29+
Sentry.createSentryPiniaPlugin({
30+
actionTransformer: action => `Transformed: ${action}`,
31+
stateTransformer: state => ({
32+
transformed: true,
33+
...state,
34+
}),
35+
}),
36+
);
2937

3038
app.use(pinia);
3139
app.use(router);

dev-packages/e2e-tests/test-applications/vue-3/tests/pinia.test.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ test('sends pinia action breadcrumbs and state context', async ({ page }) => {
2121
const actionBreadcrumb = error.breadcrumbs?.find(breadcrumb => breadcrumb.category === 'action');
2222

2323
expect(actionBreadcrumb).toBeDefined();
24-
expect(actionBreadcrumb?.message).toBe('addItem');
24+
expect(actionBreadcrumb?.message).toBe('Transformed: addItem');
2525
expect(actionBreadcrumb?.level).toBe('info');
2626

2727
const stateContext = error.contexts?.state?.state;
2828

2929
expect(stateContext).toBeDefined();
3030
expect(stateContext?.type).toBe('pinia');
31-
expect(stateContext?.value).toEqual({ rawItems: ['item'] });
31+
expect(stateContext?.value).toEqual({
32+
transformed: true,
33+
rawItems: ['item'],
34+
});
3235
});

0 commit comments

Comments
 (0)