vue-cli-plugin-electron-builder icon indicating copy to clipboard operation
vue-cli-plugin-electron-builder copied to clipboard

Unable to run electron unit test

Open ShubhamPalriwala opened this issue 2 years ago • 0 comments

Describe the bug The auto-generated electron.spec.js returns an error as follows:

Summary of all failing tests
 FAIL  tests/unit/electron.spec.js (53.491s)
  ● Window Loads Properly

    : Timeout - Async callback was not invoked within the 50000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 50000ms timeout specified by jest.setTimeout.Error:

       6 | jest.setTimeout(50000);
       7 |
    >  8 | test("Window Loads Properly", async () => {
         | ^
       9 |     // Wait for dev server to start
      10 |     const { app, stopServe } = await testWithSpectron(spectron);
      11 |     const win = app.browserWindow;

      at new Spec (node_modules/.pnpm/[email protected]/node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
      at Object.<anonymous> (tests/unit/electron.spec.js:8:1)

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  • Go to my fork here
  • Clone and make sure you are in the electron-wrapper branch
  • Do a cd td.vue to get into the vue code directory
  • Do a pnpm i to get all the dependencies
  • Now do a yarn run test:unit

Expected behavior The auto-generated spectron test should pass as default!

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • custom config for vcp-electron-builder:
  • (if possible) link to your repo: https://github.com/ShubhamPalriwala/threat-dragon/tree/electron-wrapper
  • terminal output from running vue info:
Environment Info:

  System:
    OS: Linux 5.16 Archcraft
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  Binaries:
    Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
    Yarn: 1.22.17 - /usr/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 96.0.3
  npmPackages:
    @antv/x6-vue-shape: ^1.2.10 => 1.2.10
    @fortawesome/vue-fontawesome: ^2.0.2 => 2.0.6
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.15
    @vue/cli-plugin-e2e-cypress: ^4.5.13 => 4.5.15
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.15
    @vue/cli-plugin-router: ~4.5.0 => 4.5.15
    @vue/cli-plugin-unit-jest: ~4.5.0 => 4.5.15
    @vue/cli-plugin-vuex: ~4.5.0 => 4.5.15
    @vue/cli-service: ~4.5.0 => 4.5.15
    @vue/eslint-config-standard: ^5.1.2 => 5.1.2
    @vue/test-utils: ^1.0.3 => 1.3.0
    bootstrap-vue: ^2.21.2 => 2.21.2
    eslint-plugin-vue: ^6.2.2 => 6.2.2
    portal-vue: ^2.1.7 => 2.1.7
    typescript: ^4.5.4 => 4.5.4
    vue: ^2.6.11 => 2.6.14
    vue-cli-plugin-bootstrap-vue: ~0.7.0 => 0.7.0
    vue-cli-plugin-electron-builder: ^2.1.1 => 2.1.1
    vue-cli-plugin-style-resources-loader: ~0.1.5 => 0.1.5
    vue-eslint-parser:  7.11.0
    vue-i18n: ^8.26.1 => 8.26.7
    vue-router: ^3.2.0 => 3.5.3
    vue-template-compiler: ^2.6.11 => 2.6.14
    vue-toastification: ^1.7.11 => 1.7.14
    vuex: ^3.4.0 => 3.6.2
    vuex-persist: ^3.1.3 => 3.1.3
  npmGlobalPackages:
    @vue/cli: Not Found

Additional context I have upgraded Electron to the latest v17.0.0 and Spectron to v19.0.0. I tried with the latest alpha pre-release too but it still fails

ShubhamPalriwala avatar Feb 07 '22 20:02 ShubhamPalriwala