Skip to content

Commit

Permalink
debug: reinstate dynamic imports
Browse files Browse the repository at this point in the history
  • Loading branch information
goosewobbler committed Jun 14, 2024
1 parent a16d9a3 commit 77071f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/wdio-electron-service/src/cjs/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Capabilities, Options, Services } from '@wdio/types';

// Workaround for ts-node converting dynamic imports to requires
// see https://github.com/TypeStrong/ts-node/discussions/1290
const dynamicImport = new Function('specifier', 'return import(specifier)');
// const dynamicImport = new Function('specifier', 'return import(specifier)');

export class CJSElectronLauncher {
private instance: Promise<Services.ServiceInstance>;

constructor(options: unknown, caps: unknown, config: Options.Testrunner) {
this.instance = (async () => {
const importPath = '../launcher.js';
const { default: Launcher } = await dynamicImport(importPath);
const { default: Launcher } = await import(importPath);
return new Launcher(options, caps, config);
})();
}
Expand All @@ -27,7 +27,7 @@ export class CJSElectronService {
constructor(globalOptions: unknown) {
this.instance = (async () => {
const importPath = '../service.js';
const { default: Service } = await dynamicImport(importPath);
const { default: Service } = await import(importPath);
return new Service(globalOptions);
})();
}
Expand Down

0 comments on commit 77071f7

Please sign in to comment.