Skip to content

Commit ef4989b

Browse files
committed
feat(runtime-electron): allow to use require
1 parent e091f04 commit ef4989b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/browser-runtime-electron/src/electron-runtime.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ describe('Electron runtime', function() {
5252
expect(result.shellApiType).to.equal('ShowDatabasesResult');
5353
});
5454

55+
it('allows to use require', async() => {
56+
const result = await electronRuntime.evaluate('require("util").types.isDate(new Date())');
57+
expect(result.value).to.equal(true);
58+
});
59+
5560
it('can switch database', async() => {
5661
expect(
5762
(await electronRuntime.evaluate('db')).value

packages/browser-runtime-electron/src/electron-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class ElectronRuntime implements Runtime {
1919
}) {
2020
this.openContextRuntime = new OpenContextRuntime(
2121
serviceProvider,
22-
new ElectronInterpreterEnvironment({}),
22+
new ElectronInterpreterEnvironment({ require }),
2323
messageBus
2424
);
2525
}

0 commit comments

Comments
 (0)