mardi 15 août 2017

Error: cannot find module electron while testing by mocha and spectron in electron-compile app

I try to write electron app with electron-prebuilt-compile package. I installed it follow the instructions, so in my devDependencies there is not electron package. Instead of this I have electron-prebuild-compile dependency. I have a problem with my code during writing unit tests with mocha + spectron. I have module with function:

openLinkinExternalWindow( e ) {                                                                                                                                                                                                       
  shell.openExternal(this.link);
}

and I make shell import in front of module:

import { shell } from 'electron';

It works during application runtime, but if I want to test this module, there is an error:

Cannot find module 'electron'

What should I do to avoid this problem?

Aucun commentaire:

Enregistrer un commentaire