mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: apply module search paths restriction on worker and child process (#41138)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
This commit is contained in:
2
spec/fixtures/module/module-paths.js
vendored
Normal file
2
spec/fixtures/module/module-paths.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
const Module = require('node:module');
|
||||
process.send(Module._nodeModulePaths(process.resourcesPath + '/test.js'));
|
||||
@@ -23,6 +23,12 @@ describe('node feature', () => {
|
||||
const [msg] = await message;
|
||||
expect(msg).to.equal('message');
|
||||
});
|
||||
|
||||
it('Has its module searth paths restricted', async () => {
|
||||
const child = childProcess.fork(path.join(fixtures, 'module', 'module-paths.js'));
|
||||
const [msg] = await once(child, 'message');
|
||||
expect(msg.length).to.equal(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user