facebook-atom / jest-electron-runner

custom test runner for Jest that allows tests to be run in Electron environment
MIT License
189 stars 33 forks source link

pending() fails with timeout in async tests #35

Closed kayahr closed 5 years ago

kayahr commented 5 years ago

The following test fails with a timeout when run in Jest Electron environment. Works correctly in Node environment:

describe("foo", () => {
    it("bar", async () => {
        pending("Disabled");
        expect(await Promise.resolve("23")).toBe("23");
    });
});

Output is:

 FAIL  lib/test/support/foo.test.js (5.351s)
  foo
    ✕ bar (5005ms)

  ● foo › bar

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

      1 | describe("foo", () => {
    > 2 |     it("bar", async () => {
        |     ^
      3 |         pending("Disabled");
      4 |         expect(await Promise.resolve("23")).toBe("23");
      5 |     });

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:92:20)
      at Suite.it (lib/test/support/foo.test.js:2:5)

I'm using Jest 24.1.0 and Electron Runner 1.1.1.

aaronabramov commented 5 years ago

what is pending('disabled') in your case? i don't think it's a default global method. i just added an async test and it passes on my laptop and CI https://github.com/facebook-atom/jest-electron-runner/pull/46

kayahr commented 5 years ago

pending() is a standard Jasmine feature and therefor also available in Jest.

aaronabramov commented 5 years ago

Jest is not using standard jasmine and i don't think it's available in the standard build. since i can run an async test in master i'll close this issue, but if you can provide a repro i can look at i'll be happy to debug the issue!