Skip to content

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

Closed
@thislooksfun

Description

@thislooksfun

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions