Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- feat(nextjs): Set `sendDefaultPii: true` by default ([#1052](https://github.com/getsentry/sentry-wizard/pull/1052))
- feat(angular): Set `sendDefaultPii: true` by default ([#1057](https://github.com/getsentry/sentry-wizard/pull/1057))

## 6.5.0

Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/angular-17.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ function checkAngularProject(
'replaysSessionSampleRate: 0.1',
'replaysOnErrorSampleRate: 1',
'enableLogs: true',
'sendDefaultPii: true',
]);
});

Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/angular-19.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function checkAngularProject(
'replaysSessionSampleRate: 0.1',
'replaysOnErrorSampleRate: 1',
'enableLogs: true',
'sendDefaultPii: true',
]);
});

Expand Down
2 changes: 2 additions & 0 deletions src/angular/codemods/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export function getInitCallArgs(
initCallArgs.enableLogs = true;
}

initCallArgs.sendDefaultPii = true;

return initCallArgs;
}

Expand Down
139 changes: 122 additions & 17 deletions test/angular/angular-wizard.test.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,135 @@
import { describe, expect, it, vi } from 'vitest';

import { buildOutroMessage } from '../../src/angular/angular-wizard';
import { getInitCallArgs } from '../../src/angular/codemods/main';

vi.mock('../../src/utils/clack/mcp-config', () => ({
offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),
}));

describe('buildOutroMessage', () => {
it('returns the correct outro message if example component was created', () => {
expect(buildOutroMessage(true)).toMatchInlineSnapshot(`
"
Successfully installed the Sentry Angular SDK!
describe('angular-wizard', () => {
describe('buildOutroMessage', () => {
it('returns the correct outro message if example component was created', () => {
expect(buildOutroMessage(true)).toMatchInlineSnapshot(`
"
Successfully installed the Sentry Angular SDK!

You can validate your setup by starting your dev environment (ng serve) and throwing an error in the example component.
You can validate your setup by starting your dev environment (ng serve) and throwing an error in the example component.

Check out the SDK documentation for further configuration:
https://docs.sentry.io/platforms/javascript/guides/angular/"
`);
Check out the SDK documentation for further configuration:
https://docs.sentry.io/platforms/javascript/guides/angular/"
`);
});
it('returns the correct outro message if example component creation was skipped', () => {
expect(buildOutroMessage(false)).toMatchInlineSnapshot(`
"
Successfully installed the Sentry Angular SDK!

Check out the SDK documentation for further configuration:
https://docs.sentry.io/platforms/javascript/guides/angular/"
`);
});
});
it('returns the correct outro message if example component creation was skipped', () => {
expect(buildOutroMessage(false)).toMatchInlineSnapshot(`
"
Successfully installed the Sentry Angular SDK!

Check out the SDK documentation for further configuration:
https://docs.sentry.io/platforms/javascript/guides/angular/"
`);

describe('getInitCallArgs', () => {
it('returns the correct init call arguments when all features are enabled', () => {
const args = getInitCallArgs('https://example.com', {
performance: true,
replay: true,
logs: true,
});
expect(args).toMatchInlineSnapshot(`
{
"dsn": "https://example.com",
"enableLogs": true,
"integrations": [
{},
{},
],
"replaysOnErrorSampleRate": 1,
"replaysSessionSampleRate": 0.1,
"sendDefaultPii": true,
"tracesSampleRate": 1,
}
`);
});

it('returns the correct init call arguments when performance is disabled', () => {
const args = getInitCallArgs('https://example.com', {
performance: false,
replay: true,
logs: true,
});

expect(args).toMatchInlineSnapshot(`
{
"dsn": "https://example.com",
"enableLogs": true,
"integrations": [
{},
],
"replaysOnErrorSampleRate": 1,
"replaysSessionSampleRate": 0.1,
"sendDefaultPii": true,
}
`);
});

it('returns the correct init call arguments when replay is disabled', () => {
const args = getInitCallArgs('https://example.com', {
performance: true,
replay: false,
logs: true,
});

expect(args).toMatchInlineSnapshot(`
{
"dsn": "https://example.com",
"enableLogs": true,
"integrations": [
{},
],
"sendDefaultPii": true,
"tracesSampleRate": 1,
}
`);
});

it('returns the correct init call arguments when logs are disabled', () => {
const args = getInitCallArgs('https://example.com', {
performance: true,
replay: true,
logs: false,
});

expect(args).toMatchInlineSnapshot(`
{
"dsn": "https://example.com",
"integrations": [
{},
{},
],
"replaysOnErrorSampleRate": 1,
"replaysSessionSampleRate": 0.1,
"sendDefaultPii": true,
"tracesSampleRate": 1,
}
`);
});

it('returns the correct init call arguments when all features are disabled', () => {
const args = getInitCallArgs('https://example.com', {
performance: false,
replay: false,
logs: false,
});

expect(args).toMatchInlineSnapshot(`
{
"dsn": "https://example.com",
"sendDefaultPii": true,
}
`);
});
});
});
Loading