Skip to content

Commit

Permalink
chore(e2e): Don't run ESM tests for Electron < 28
Browse files Browse the repository at this point in the history
  • Loading branch information
megahertz committed Dec 30, 2023
1 parent ae1f0d6 commit 9dcfda7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
9 changes: 9 additions & 0 deletions e2e/E2eApp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const { exec } = require('child_process');
const electronPackageJson = require('electron/package.json');
const fs = require('fs');
const path = require('path');
const TestLogReader = require('../src/__specs__/utils/TestLogReader');
Expand All @@ -21,6 +22,14 @@ class E2eApp {
return this.appNameCache;
}

get electronVersion() {
return Number.parseInt(electronPackageJson.version, 10);
}

isSupportEsm() {
return this.electronVersion >= 28;
}

async run({ clearLogs = true } = {}) {
if (clearLogs) {
await this.removeLogDir();
Expand Down
9 changes: 9 additions & 0 deletions e2e/esbuild-esm/main.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ const E2eApp = require('../E2eApp');
const app = new E2eApp({ appPath: __dirname });

test(app.appName, async () => {
if (!app.isSupportEsm()) {
console.info(`Skipping ESM test for Electron ${app.electronVersion}`);

Check warning on line 10 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, latest, latest, false)

Unexpected console statement

Check warning on line 10 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, 16, latest, false)

Unexpected console statement

Check warning on line 10 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, 14, latest, true)

Unexpected console statement

Check warning on line 10 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, latest, 16, true)

Unexpected console statement

Check warning on line 10 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, latest, 13, true)

Unexpected console statement

Check warning on line 10 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (macos-latest, latest, latest, true)

Unexpected console statement

Check warning on line 10 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (windows-latest, latest, latest, true)

Unexpected console statement
return;
}

const logReader = await app.run();
expect(logReader.format()).toEqual([
'log from the main process',
'log from renderer',
]);
}, app.timeout);

function electronSupportsEsm() {

Check warning on line 21 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, latest, latest, false)

'electronSupportsEsm' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 21 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, 16, latest, false)

'electronSupportsEsm' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 21 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, 14, latest, true)

'electronSupportsEsm' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 21 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, latest, 16, true)

'electronSupportsEsm' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 21 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (ubuntu-latest, latest, 13, true)

'electronSupportsEsm' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 21 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (macos-latest, latest, latest, true)

'electronSupportsEsm' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 21 in e2e/esbuild-esm/main.spec.cjs

View workflow job for this annotation

GitHub Actions / main (windows-latest, latest, latest, true)

'electronSupportsEsm' is defined but never used. Allowed unused vars must match /^_/u

}
4 changes: 0 additions & 4 deletions src/main/electronApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,3 @@ function sendIpcToRenderer(channel, message) {
}
});
}

function loadElectron() {

}

0 comments on commit 9dcfda7

Please sign in to comment.