joeljeske / karma-parallel

A Karma JS Framework to support sharding tests to run in parallel across multiple browsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

angularfrontenders opened this issue · comments

  • **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

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