question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling testWithSpectron() opens infinite windows

See original GitHub issue

Describe the bug Calling testWithSpectron() hangs the tests, and starts opening as many Electron windows as it can until the tests time out.

To Reproduce Run the following spec:

import testWithSpectron from "vue-cli-plugin-electron-builder/lib/testWithSpectron";
import chai, { expect } from "chai";
import chaiAsPromised from "chai-as-promised";

chai.use(chaiAsPromised);

describe("Application launch", function() {
  this.timeout(30000);

  beforeEach(function() {
    console.log("Before Each -- testWithSpectron()");
    return testWithSpectron().then(instance => {
      console.log("testWithSpectron().then");
      this.app = instance.app;
      this.stopServe = instance.stopServe;
    });
  });

  beforeEach(function() {
    console.log("Before Each -- chaiAsPromised");
    chaiAsPromised.transferPromiseness = this.app.transferPromiseness;
  });

  afterEach(function() {
    console.log("After");
    if (this.app && this.app.isRunning()) {
      return this.stopServe();
    }
  });

  it("opens a window", function() {
    console.log("opens?");
    const gwc = this.app.client.getWindowCount();
    console.log(gwc);
    return expect(gwc).to.eventually.have.at.least(1);
  });
});

Expected behavior I expected the output

> Before Each -- testWithSpectron()
> testWithSpectron().then
> Before Each -- chaiAsPromised
> opens?
> After

And for it to only open one Electron window (or maybe even 0, if it should be headless).

Instead, it opens 5-10 windows (just keeps going until Mocha times out).

Screenshots Screen Shot 2019-09-10 at 9 54 53 PM Screen Shot 2019-09-10 at 9 55 34 PM Screen Shot 2019-09-10 at 9 56 07 PM

Environment (please complete the following information):

// vue.config.js
const path = require("path");

module.exports = {
  configureWebpack: {
    resolve: {
      alias: {
        Disciplines$: path.join(__dirname, "src/assets/earthdawn/disciplines"),
        Races$: path.join(__dirname, "src/assets/earthdawn/races"),
        Skills$: path.join(__dirname, "src/assets/earthdawn/skills"),
        Talents$: path.join(__dirname, "src/assets/earthdawn/talents"),
      },
    },
  },
  chainWebpack: config => {
    config.module
      .rule("yaml")
      .test(/\.ya?ml$/)
      .use("js-yaml-loader")
      .loader("js-yaml-loader")
      .end();
  },
  pluginOptions: {
    electronBuilder: {
      chainWebpackMainProcess: config => {
        config.resolve.alias.set("@", path.join(__dirname, "src/"));
      },
    },
  },
};

Additional context N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
nklaymancommented, Jan 9, 2020

With the v2.0.0 beta, you pass the spectron module to the testWithSpectron function, so you can install the proper version of spectron to match your electron version.

2reactions
nklaymancommented, Oct 30, 2019

V2.0 of this plugin includes an upgrade to spectron. I will release it soon, but for now: yarn add -D vue-cli-plugin-electron-builder@alpha.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Electron app opening multiple windows or processes in ...
My electron app works as expected but it keeps on opening new windows when I run spectron test that tests for number ...
Read more >
Testing and Debugging | Vue CLI Plugin Electron Builder
vue-cli-plugin-electron-builder exports a testWithSpectron function. ... You will have to call app.start() and app.client.waitUntilWindowLoaded() before ...
Read more >
Build an Electron App in Under 60 Minutes - YouTube
In this video we will build a desktop application using Electron.js which allows us to build desktop apps using only JavaScript.
Read more >
Easily Build Your Vue.js App For Desktop With Electron
Open a terminal in the directory of your app created with Vue-CLI 3 or 4 (4 is ... import at the first argument...
Read more >
Deep Links | Electron
This is due to Windows requiring additional code in order to open the contents of the protocol ... This method will be called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found