Last updated: Apr 04, 2019 11:43
by Prasant Sutaria
An unexpected number of results in Digital Zoom's CI dashboard.
Jasmine framework provides two options to disable some specs from a spec file:
Mark all the spec with xit which needs to disable.
Mark the spec which needs to execute with fit, rest other tests are skipped.
Even though the above specs are excluded, the jasmine hooks - specStarted and specDone are still executed for the specs, which leads to an unexpected number of reports in Digital Zoom's CI dashboard. Since these hooks are used to start and end Digital Zoom reports.
Expected test count is 1 but in Digital Zoom's CI dashboard we are getting unexpected count 2 test.
To prevent unexpected reports in Digital Zoom's CI Dashboard following solution can be implemented:
- Use xit option to exclude specs in a spec file instead of fit option.
When xit option is used, Jasmine provides a pending reason - "Temporarily disabled with xit" for the excluded specs. We can use the pending reason to check whether reporting in Digital zoom should be started or not
3. The specs can have 3 states - Passed, Failed and Pending. The excluded specs have "Pending" status. We can perform no action in case of "Pending" status.
The sample project can be downloaded from here.
How to run the tests:
- Extract the project
- Open command prompt
- Execute npm install
- Execute npm test