diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95388eca..2f07c322 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,7 @@ on: env: ELECTRON_CACHE_DIR: ${{ github.workspace }} FAILURE_LOG: true + ELECTRON_ENABLE_LOGGING: true jobs: build: diff --git a/test/e2e/test-apps/native-electron/renderer-abort/addon.cc b/test/e2e/test-apps/native-electron/renderer-abort/addon.cc new file mode 100644 index 00000000..6e70b9a9 --- /dev/null +++ b/test/e2e/test-apps/native-electron/renderer-abort/addon.cc @@ -0,0 +1,26 @@ +#include +#include + +namespace demo +{ + napi_value Method(napi_env env, napi_callback_info args) + { + abort(); + return nullptr; + } + + napi_value init(napi_env env, napi_value exports) + { + napi_status status; + napi_value fn; + status = napi_create_function(env, nullptr, 0, Method, nullptr, &fn); + if (status != napi_ok) + return nullptr; + status = napi_set_named_property(env, exports, "abort", fn); + if (status != napi_ok) + return nullptr; + return exports; + } + + NAPI_MODULE(NODE_GYP_MODULE_NAME, init) +} diff --git a/test/e2e/test-apps/native-electron/renderer-abort/binding.gyp b/test/e2e/test-apps/native-electron/renderer-abort/binding.gyp new file mode 100644 index 00000000..3c79ca84 --- /dev/null +++ b/test/e2e/test-apps/native-electron/renderer-abort/binding.gyp @@ -0,0 +1,8 @@ +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} diff --git a/test/e2e/test-apps/native-electron/renderer-abort/event.json b/test/e2e/test-apps/native-electron/renderer-abort/event.json new file mode 100644 index 00000000..39b367b0 --- /dev/null +++ b/test/e2e/test-apps/native-electron/renderer-abort/event.json @@ -0,0 +1,18 @@ +{ + "method": "minidump", + "namespacedData": { + "initialScope": { + "release":"native-electron-renderer-abort@1.0.0", + "user": { + "username": "some_user" + } + } + }, + "sentryKey": "37f8a2ee37c0409d8970bc7559c7c7e4", + "appId": "277345", + "data": { + "event_id": "{{id}}", + "timestamp": 0 + }, + "attachments": [ { "attachment_type": "event.minidump" } ] +} diff --git a/test/e2e/test-apps/native-electron/renderer-abort/package.json b/test/e2e/test-apps/native-electron/renderer-abort/package.json new file mode 100644 index 00000000..3e844590 --- /dev/null +++ b/test/e2e/test-apps/native-electron/renderer-abort/package.json @@ -0,0 +1,15 @@ +{ + "name": "native-electron-renderer-abort", + "version": "1.0.0", + "main": "src/main.js", + "scripts": { + "build": "node-gyp configure build" + }, + "dependencies": { + "@sentry/electron": "3.0.0", + "sadness-generator": "0.0.2" + }, + "devDependencies": { + "node-gyp": "9.3.1" + } +} diff --git a/test/e2e/test-apps/native-electron/renderer-abort/recipe.only.yml b/test/e2e/test-apps/native-electron/renderer-abort/recipe.only.yml new file mode 100644 index 00000000..15cd1a8c --- /dev/null +++ b/test/e2e/test-apps/native-electron/renderer-abort/recipe.only.yml @@ -0,0 +1,4 @@ +description: Native Renderer Abort +category: Native (Electron Uploader) +condition: usesCrashpad && version.major >= 20 +command: yarn && yarn build diff --git a/test/e2e/test-apps/native-electron/renderer-abort/src/index.html b/test/e2e/test-apps/native-electron/renderer-abort/src/index.html new file mode 100644 index 00000000..976a96b5 --- /dev/null +++ b/test/e2e/test-apps/native-electron/renderer-abort/src/index.html @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/test/e2e/test-apps/native-electron/renderer-abort/src/main.js b/test/e2e/test-apps/native-electron/renderer-abort/src/main.js new file mode 100644 index 00000000..70c42d1a --- /dev/null +++ b/test/e2e/test-apps/native-electron/renderer-abort/src/main.js @@ -0,0 +1,27 @@ +const path = require('path'); + +const { app, BrowserWindow } = require('electron'); +const { init, Integrations } = require('@sentry/electron'); + +app.commandLine.appendSwitch('enable-crashpad'); + +init({ + dsn: '__DSN__', + debug: true, + autoSessionTracking: false, + integrations: [new Integrations.ElectronMinidump()], + initialScope: { user: { username: 'some_user' } }, + onFatalError: () => {}, +}); + +app.on('ready', () => { + const mainWindow = new BrowserWindow({ + show: false, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + }, + }); + + mainWindow.loadFile(path.join(__dirname, 'index.html')); +}); \ No newline at end of file diff --git a/test/e2e/test-apps/native-sentry/renderer-abort/addon.cc b/test/e2e/test-apps/native-sentry/renderer-abort/addon.cc new file mode 100644 index 00000000..6e70b9a9 --- /dev/null +++ b/test/e2e/test-apps/native-sentry/renderer-abort/addon.cc @@ -0,0 +1,26 @@ +#include +#include + +namespace demo +{ + napi_value Method(napi_env env, napi_callback_info args) + { + abort(); + return nullptr; + } + + napi_value init(napi_env env, napi_value exports) + { + napi_status status; + napi_value fn; + status = napi_create_function(env, nullptr, 0, Method, nullptr, &fn); + if (status != napi_ok) + return nullptr; + status = napi_set_named_property(env, exports, "abort", fn); + if (status != napi_ok) + return nullptr; + return exports; + } + + NAPI_MODULE(NODE_GYP_MODULE_NAME, init) +} diff --git a/test/e2e/test-apps/native-sentry/renderer-abort/binding.gyp b/test/e2e/test-apps/native-sentry/renderer-abort/binding.gyp new file mode 100644 index 00000000..3c79ca84 --- /dev/null +++ b/test/e2e/test-apps/native-sentry/renderer-abort/binding.gyp @@ -0,0 +1,8 @@ +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} diff --git a/test/e2e/test-apps/native-sentry/renderer-abort/event.json b/test/e2e/test-apps/native-sentry/renderer-abort/event.json new file mode 100644 index 00000000..d78dcc12 --- /dev/null +++ b/test/e2e/test-apps/native-sentry/renderer-abort/event.json @@ -0,0 +1,75 @@ +{ + "method": "envelope", + "sentryKey": "37f8a2ee37c0409d8970bc7559c7c7e4", + "appId": "277345", + "data": { + "sdk": { + "name": "sentry.javascript.electron", + "packages": [ + { + "name": "npm:@sentry/electron", + "version": "{{version}}" + } + ], + "version": "{{version}}" + }, + "contexts": { + "app": { + "app_name": "native-sentry-renderer-abort", + "app_version": "1.0.0", + "app_start_time": "{{time}}" + }, + "browser": { + "name": "Chrome" + }, + "chrome": { + "name": "Chrome", + "type": "runtime", + "version": "{{version}}" + }, + "device": { + "arch": "{{arch}}", + "family": "Desktop", + "memory_size": 0, + "free_memory": 0, + "processor_count": 0, + "processor_frequency": 0, + "cpu_description": "{{cpu}}", + "screen_resolution":"{{screen}}", + "screen_density": 1, + "language": "{{language}}" + }, + "node": { + "name": "Node", + "type": "runtime", + "version": "{{version}}" + }, + "os": { + "name": "{{platform}}", + "version": "{{version}}" + }, + "runtime": { + "name": "Electron", + "version": "{{version}}" + }, + "electron": { + "crashed_url": "app:///src/index.html" + } + }, + "release": "native-sentry-renderer-abort@1.0.0", + "environment": "development", + "user": { + "ip_address": "{{auto}}" + }, + "event_id": "{{id}}", + "timestamp": 0, + "breadcrumbs": [], + "tags": { + "event.environment": "native", + "event.origin": "electron", + "event.process": "renderer", + "event_type": "native" + } + }, + "attachments": [ { "attachment_type": "event.minidump" } ] +} diff --git a/test/e2e/test-apps/native-sentry/renderer-abort/package.json b/test/e2e/test-apps/native-sentry/renderer-abort/package.json new file mode 100644 index 00000000..5f53c275 --- /dev/null +++ b/test/e2e/test-apps/native-sentry/renderer-abort/package.json @@ -0,0 +1,15 @@ +{ + "name": "native-sentry-renderer-abort", + "version": "1.0.0", + "main": "src/main.js", + "scripts": { + "build": "node-gyp configure build" + }, + "dependencies": { + "@sentry/electron": "3.0.0", + "sadness-generator": "0.0.2" + }, + "devDependencies": { + "node-gyp": "9.3.1" + } +} diff --git a/test/e2e/test-apps/native-sentry/renderer-abort/recipe.only.yml b/test/e2e/test-apps/native-sentry/renderer-abort/recipe.only.yml new file mode 100644 index 00000000..809d8b8f --- /dev/null +++ b/test/e2e/test-apps/native-sentry/renderer-abort/recipe.only.yml @@ -0,0 +1,4 @@ +description: Native Renderer Abort +category: Native (Sentry Uploader) +condition: usesCrashpad && version.major >= 20 +command: yarn && yarn build diff --git a/test/e2e/test-apps/native-sentry/renderer-abort/src/index.html b/test/e2e/test-apps/native-sentry/renderer-abort/src/index.html new file mode 100644 index 00000000..976a96b5 --- /dev/null +++ b/test/e2e/test-apps/native-sentry/renderer-abort/src/index.html @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/test/e2e/test-apps/native-sentry/renderer-abort/src/main.js b/test/e2e/test-apps/native-sentry/renderer-abort/src/main.js new file mode 100644 index 00000000..c7d7b7f0 --- /dev/null +++ b/test/e2e/test-apps/native-sentry/renderer-abort/src/main.js @@ -0,0 +1,25 @@ +const path = require('path'); + +const { app, BrowserWindow } = require('electron'); +const { init } = require('@sentry/electron'); + +app.commandLine.appendSwitch('enable-crashpad'); + +init({ + dsn: '__DSN__', + debug: true, + autoSessionTracking: false, + onFatalError: () => {}, +}); + +app.on('ready', () => { + const mainWindow = new BrowserWindow({ + show: false, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + }, + }); + + mainWindow.loadFile(path.join(__dirname, 'index.html')); +}); \ No newline at end of file