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

Karma calls Jasmine twice. #2799

Open
hpufo opened this issue Aug 5, 2017 · 2 comments
Open

Karma calls Jasmine twice. #2799

hpufo opened this issue Aug 5, 2017 · 2 comments

Comments

@hpufo
Copy link

hpufo commented Aug 5, 2017

Expected behaviour

Karma calls jasmine tests once.

Actual behaviour

Everything in the describe and it functions are being called twice, causing some tests to fail.

Environment Details

I also tried this but the result was the same(If I set included to false, karma breaks):
files: [ { pattern: 'test/**/*.tsx', watched: false, served: true, included: true } ],

Steps to reproduce the behaviour

  1. I run karma start from the console
  2. Everything in the describe and it functions are called twice.
  3. Tests that calls helper functions calls it twice resulting in the wrong return and test failing

I have created a simple mock to display this problem:

function fillArray(len: number) {
  const array = new Array(len);
  for (let i = 0; i < len; i++) {
    array.push(0);
  }
  return array;
}
describe('Karma', () => {
  console.log('DESCRIBE');
  it('runs a test and prints', () => {
    const array = fillArray(1);
    console.log(array.length);
    expect(true).toBe(true);
  });
});

Here is what the above outputs in my console(I am only including the interesting parts):
image

@EzraBrooks
Copy link
Collaborator

I haven't experienced this issue with a similar setup on the most recent version from master. Are you still experiencing this issue?

@is-already-taken
Copy link
Contributor

I can reproduce this issue with the Karma API. Karma 4.0.1, Karma-Chrome-Launcher 2.2.0.

See the MCVE for a bare minimum example: https://github.com/is-already-taken/karma-runs-twice-mcve

is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 18, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 18, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 18, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Mar 30, 2019
This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
Allow the consumer to decide whether to echo the runner progress or not.

This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
Allow the consumer to decide whether to echo the runner progress or not.

This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 10, 2019
The CLI shall echo the progress, not the runner itself.

Fixes karma-runner#2121, karma-runner#2799
is-already-taken added a commit to is-already-taken/karma that referenced this issue Apr 11, 2019
The CLI shall echo the progress, not the runner itself.

Fixes karma-runner#2121, karma-runner#2799
johnjbarton pushed a commit that referenced this issue Jul 30, 2019
* feat(runner): Return emitter that forwards server data

Allow the consumer to decide whether to echo the runner progress or not.

This might be the case when Karma.run() is called inside the same
process/terminal as the server is running in (e.g. development
servers).

Fixes #2121, #2799

* feat(cli): Echo the runner progress event, don't echo in runner

The CLI shall echo the progress, not the runner itself.

Fixes #2121, #2799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants