Skip to content

Commit

Permalink
Limit to Electron v4+
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Oct 5, 2023
1 parent 4ee72b1 commit 5920fd7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/e2e-test-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const { readFileSync } = require('fs');

const versions = JSON.parse(readFileSync('./test/e2e/versions.json', 'utf8'));

// if (process.env.GITHUB_REF && process.env.GITHUB_REF.includes('release/')) {
// For release builds we test all versions
console.log(JSON.stringify(versions));
// } else {
// // Otherwise we test the oldest version and the last 10 versions
// console.log(JSON.stringify([versions[0], ...versions.slice(-10)]));
// }
if (process.env.GITHUB_REF && process.env.GITHUB_REF.includes('release/')) {
// For release builds we test all versions
console.log(JSON.stringify(versions));
} else {
// Otherwise we test the oldest version and the last 10 versions
console.log(JSON.stringify([versions[0], ...versions.slice(-10)]));
}
6 changes: 6 additions & 0 deletions src/main/anr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { enableAnrDetection as enableNodeAnrDetection } from '@sentry/node';
import { app } from 'electron';

import { ELECTRON_MAJOR_VERSION } from './electron-normalize';

interface Options {
/**
* Main process ANR options.
Expand Down Expand Up @@ -35,6 +37,10 @@ interface Options {
*/
export async function enableAnrDetection(options: Options = {}): Promise<void> {
if (options.mainProcess !== false) {
if (ELECTRON_MAJOR_VERSION < 4) {
throw new Error('Main process ANR detection is only supported on Electron v4+');
}

options.mainProcess = options.mainProcess || {};

// We need to override the entryScript option to make it work with Electron which doesn't get passed a script in
Expand Down
1 change: 1 addition & 0 deletions test/e2e/test-apps/anr/anr-main/recipe.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
description: ANR Main Event
category: ANR
command: yarn
condition: version.major >= 4

0 comments on commit 5920fd7

Please sign in to comment.