Skip to content

Commit

Permalink
cherry-pick(#12250): fix(electron): do not attach external debugger w…
Browse files Browse the repository at this point in the history
…hen running Electron tests
  • Loading branch information
pavelfeldman committed Feb 20, 2022
1 parent 0037acf commit 5b17ca9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/playwright-core/src/server/electron/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,15 @@ export class Electron extends SdkObject {
const artifactsDir = await fs.promises.mkdtemp(ARTIFACTS_FOLDER);

const browserLogsCollector = new RecentLogsCollector();
const env = options.env ? envArrayToObject(options.env) : process.env;
// When debugging Playwright test that runs Electron, NODE_OPTIONS
// will make the debugger attach to Electron's Node. But Playwright
// also needs to attach to drive the automation. Disable external debugging.
delete env.NODE_OPTIONS;
const { launchedProcess, gracefullyClose, kill } = await launchProcess({
command: options.executablePath || require('electron/index.js'),
args: electronArguments,
env: options.env ? envArrayToObject(options.env) : process.env,
env,
log: (message: string) => {
progress.log(message);
browserLogsCollector.log(message);
Expand Down

0 comments on commit 5b17ca9

Please sign in to comment.