fix: expose the built-in electron module via the ESM loader (#35930)

This commit is contained in:
Samuel Attard 2022-10-10 03:02:30 -07:00 committed by GitHub
parent a072f06168
commit 1fe21ff712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 0 deletions

View file

@ -174,4 +174,16 @@ describe('modules support', () => {
});
});
});
describe('esm', () => {
it('can load the built-in "electron" module via ESM import', async () => {
await expect(import('electron')).to.eventually.be.ok();
});
it('the built-in "electron" module loaded via ESM import has the same exports as the CJS module', async () => {
const esmElectron = await import('electron');
const cjsElectron = require('electron');
expect(Object.keys(esmElectron)).to.deep.equal(Object.keys(cjsElectron));
});
});
});