Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stopServe() in testWithSpectron() throws setTimeout(...).unref is not a function #647

Closed
thislooksfun opened this issue Feb 6, 2020 · 3 comments

Comments

@thislooksfun
Copy link

Describe the bug
Calling stopServe() throws an exception setTimeout(...).unref is not a function.

To Reproduce
Minimal example:

import spectron from "spectron";
import testWithSpectron from "vue-cli-plugin-electron-builder/lib/testWithSpectron";
import chai from "chai";
import chaiAsPromised from "chai-as-promised";

chai.should();
chai.use(chaiAsPromised);

describe("Application launch", function() {
  let app;
  let stopServe;

  beforeEach(function() {
    return testWithSpectron(spectron).then(instance => {
      app = instance.app;
      stopServe = instance.stopServe;
    });
  }, 30000);

  beforeEach(function() {
    chaiAsPromised.transferPromiseness = app.transferPromiseness;
  });

  afterEach(function() {
    if (app && app.isRunning()) {
      return stopServe();
    }
  });

  it("opens a window", function() {
    return app.client
      .getWindowCount()
      .should.eventually.have.at.least(1)
      .browserWindow.isMinimized()
      .should.eventually.be.false.browserWindow.isVisible()
      .should.eventually.be.true.browserWindow.getBounds()
      .should.eventually.have.property("width")
      .and.be.above(0)
      .browserWindow.getBounds()
      .should.eventually.have.property("height")
      .and.be.above(0);
  });
});

Expected behavior
Calling stopServe() should not throw an error.

Screenshots
N/A

Environment (please complete the following information):

  • OS and version: macOS 10.15.2 (19C57)
  • node version: v12.14.1
  • npm version: v6.13.4
  • yarn version (if used): N/A
  • vue-cli-plugin-electron-builder version: v2.0.0-beta.1
  • electron version: v7.1.11
  • other vue plugins used: See package.json
  • custom config for vcp-electron-builder: N/A
  • (if possible) link to your repo: https://github.com/thislooksfun/earthdawn

Additional context
This is due to a bug in execa that was fixed in v4.0.0.

@nklayman
Copy link
Owner

nklayman commented Feb 7, 2020

Unfortunately I cannot update to v4.0.0 as it requires node 10+. Since vue cli supports v8+, I don't want my plugin to be incompatible. Once vue cli requires v10+, I will upgrade execa.

@thislooksfun
Copy link
Author

This renders testWithSpectron() useless as I can't close electron after the tests complete. Do you have any planned mitigation for this?

@nklayman
Copy link
Owner

nklayman commented Feb 7, 2020

I don't think there is anything I can really do, other than wait for vue cli to drop node 8 support. This shouldn't take too long as it is already officially deprecated. In the meantime, I will leave this as a beta release and mark this as a known issue. If you are okay with dropping node 8 support, you can use yarn resolutions to use execa v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants