fix: self.module.paths not working in web workers (#29955)

* fix: global.module.paths in workers

* spec: add a regression test
This commit is contained in:
Shelley Vohr 2021-07-05 01:48:46 +02:00 committed by GitHub
parent 20c1f504ae
commit af991123f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 87 additions and 0 deletions

View file

@ -682,6 +682,26 @@ describe('chromium features', () => {
});
});
describe('web workers', () => {
let appProcess: ChildProcess.ChildProcessWithoutNullStreams | undefined;
afterEach(() => {
if (appProcess && !appProcess.killed) {
appProcess.kill();
appProcess = undefined;
}
});
it('Worker with nodeIntegrationInWorker has access to self.module.paths', async () => {
const appPath = path.join(__dirname, 'fixtures', 'apps', 'self-module-paths');
appProcess = ChildProcess.spawn(process.execPath, [appPath]);
const [code] = await emittedOnce(appProcess, 'exit');
expect(code).to.equal(0);
});
});
describe('form submit', () => {
let server: http.Server;
let serverUrl: string;