karma-parallel icon indicating copy to clipboard operation
karma-parallel copied to clipboard

Jasmine test timeout is ignored

Open provegard opened this issue 4 years ago • 1 comments

  • **I'm submitting a ... **

    • [x] bug report
    • [ ] feature request
  • Do you want to request a feature or report a bug?

Report a bug

  • What is the current behavior?

When a Jasmine test has a test timeout like this:

it("should fail quickly", () => {
  return new Promise((res, rej) => {});
}, 1);

The resulting failure uses the default Jasmine timeout of 5000 ms instead of the specified timeout of 1 ms.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

The problem is that the wrapping function ignores any parameter after the test definition:

https://github.com/joeljeske/karma-parallel/blob/master/lib/karma-parallelizer.js#L111

I can try to prepare a repro if needed.

  • What is the expected behavior?

The custom timeout specified for the test should be used.

  • Please tell us about your environment:
  • version: 0.3.1
  • Browser: all
  • Language: all
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

The suggested fix is to pass along all arguments (extracted via arguments perhaps) to the wrapped function.

provegard avatar Oct 03 '19 09:10 provegard

Had the same issue, you can work around it by setting the global timeout value:

    let timeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
    beforeEach(() => {
      jasmine.DEFAULT_TIMEOUT_INTERVAL = 30_000;
    });
    afterEach(() => {
      jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout;
    });

Klaster1 avatar Oct 31 '22 12:10 Klaster1