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

failSpecWithNoExpectations to true in jasmine and karma-parallel add the extra tests #71

Open
1 task
angularfrontenders opened this issue Oct 25, 2021 · 1 comment

Comments

@angularfrontenders
Copy link

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

    • [ X ] bug report
    • feature request
  • What is the current behavior?
    When jasmine configuration set the property failSpecWithNoExpectations to true (since v.3.5.0) and karma-parallel add extra tests explained in documentation:
    Why are there extra tests in my output?
    If this plugin discovers that you have focused some tests (fit, it.only, etc...) in other browser instances, it will add an extra focused test in the current browser instance to limit the running of the tests in the given browser. Similarly, when dividing up the tests, if there are not enough tests for a given browser, it will add an extra test to prevent karma from failing due to no running tests.__

The result: has failed tests.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
  1. Set in karma.conf.js a jasmine configuration like:
    client: {
    jasmine: {
    failSpecWithNoExpectations: true
    },
    clearContext: false
    },
  2. Configure karma-parallel 4 executors
    parallelOptions: {
    executors: 4, // Defaults to cpu-count - 1
    shardStrategy: 'description-length'
    },
  3. Write only one test o focuse only one test (fit)
    4,. Execute tests (like 'ng test')
  • What is the expected behavior?
    Expect that pass the tests in all executors.

  • Please tell us about your environment:

Used Latest Version of karma-parallel 0.3.1
Jasmine version: ^3.8.0
Browser: Chrome
Language: Angular 12.2.0

  • Suggestions:
    May be add into the extra tests "expect().nothing()"?

Thanks in advance

@kaashan
Copy link

kaashan commented May 19, 2022

Submitted a PR to add expect().nothing(); in default specs added by karma-parallel.

Alternatively, to resolve this issue, we can add a minimal test that would be run on every executor instance. This will lead to karma-parallel not adding its own spec(without any assertions) for execution and the test will pass

image

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