feat: Enhance Electron test harness with preload script and CSP configuration

This commit is contained in:
2026-04-19 03:05:29 +10:00
parent dcc17946ef
commit 6f506c59a4
5 changed files with 98 additions and 31 deletions

View File

@@ -3,8 +3,7 @@ const path = require('path');
/**
* Creates the main application window.
* nodeIntegration is enabled so the renderer can use require() / dynamic import()
* directly against the local node_modules — appropriate for a local test harness.
* Uses a preload bridge so the renderer can stay in the safer default context.
*/
function createWindow() {
const win = new BrowserWindow({
@@ -12,8 +11,10 @@ function createWindow() {
height: 800,
backgroundColor: '#1a1a2e',
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
preload: path.join(__dirname, 'preload.js'),
sandbox: false,
nodeIntegration: false,
contextIsolation: true,
},
});