Skip to content

Commit

Permalink
Add test!
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Feb 14, 2025
1 parent b62cd24 commit 7c5ea0a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/e2e/test-apps/other/no-pii/events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Event } from '@sentry/core';
import { expect } from 'vitest';

import { TestServerEvent } from '../../../server';

export async function execute(events: TestServerEvent<Event>[]): Promise<void> {
expect(events.length).greaterThanOrEqual(1);

for (const event of events) {
expect(event.data.user?.ip_address).toBeUndefined();
}
}
8 changes: 8 additions & 0 deletions test/e2e/test-apps/other/no-pii/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "javascript-no-pii",
"version": "1.0.0",
"main": "src/main.js",
"dependencies": {
"@sentry/electron": "5.6.0"
}
}
3 changes: 3 additions & 0 deletions test/e2e/test-apps/other/no-pii/recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: No PII
category: JavaScript
command: yarn
19 changes: 19 additions & 0 deletions test/e2e/test-apps/other/no-pii/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
</head>
<body>
<script>
const { init } = require('@sentry/electron/renderer');

init({
debug: true,
});

setTimeout(() => {
throw new Error('Some renderer error');
}, 500);
</script>
</body>
</html>
23 changes: 23 additions & 0 deletions test/e2e/test-apps/other/no-pii/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require('path');

const { app, BrowserWindow } = require('electron');
const { init } = require('@sentry/electron/main');

init({
dsn: '__DSN__',
debug: true,
integrations: (integrations) => integrations.filter((i) => i.name !== 'MainProcessSession'),
onFatalError: () => {},
});

app.on('ready', () => {
const mainWindow = new BrowserWindow({
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
});

mainWindow.loadFile(path.join(__dirname, 'index.html'));
});

0 comments on commit 7c5ea0a

Please sign in to comment.