fix: NODE_OPTIONS parsing for child processes on macOS (#46209)

* fix: NODE_OPTIONS parsing for child processes on macOS

* chore: temporarily disable test

* chore: apply review feedback

* chore: fix build
This commit is contained in:
Robo 2025-03-25 13:01:37 +09:00 committed by GitHub
parent abaef13c0b
commit a86e44b176
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 62 additions and 0 deletions

View file

@ -697,6 +697,29 @@ describe('node feature', () => {
expect(code).to.equal(1);
});
it('does allow --require in utility process of non-packaged apps', async () => {
const appPath = path.join(fixtures, 'apps', 'node-options-utility-process');
// App should exit with code 1.
const child = childProcess.spawn(process.execPath, [appPath]);
const [code] = await once(child, 'exit');
expect(code).to.equal(1);
});
// TODO(deepak1556): will be enabled in follow-up PR
// https://github.com/electron/electron/pull/46210
it.skip('does not allow --require in utility process of packaged apps', async () => {
const appPath = path.join(fixtures, 'apps', 'node-options-utility-process');
// App should exit with code 1.
const child = childProcess.spawn(process.execPath, [appPath], {
env: {
...process.env,
ELECTRON_FORCE_IS_PACKAGED: 'true'
}
});
const [code] = await once(child, 'exit');
expect(code).to.equal(0);
});
it('does not allow --require in packaged apps', async () => {
const appPath = path.join(fixtures, 'module', 'noop.js');
const env = {