Closed jmuleiro closed 2 months ago
Note: Feel free to suggest a better name for the flag, skipped_tests_passed
was the best I could come up with.
Note 2: I'm using a custom-built version of the packages in the meantime, so there's no rush to get this feature in from my end.
I believe this is something mocha reporter should support natively.
I believe this is something mocha reporter should support natively.
@ASaiAnudeep I agree, though for the time being, it doesn't.
Closing this as for now. Will come up with a better way to handle extensions.
Context
I have a few tests that are skipped via feature flags that are evaluated in Cypress' code. Because of what the resulting JSON looks like, the
parser
interprets the results as ifpassed tests < total tests
. Though this is technically correct, because the tests themselves didn't run, you can't exactly say they failed (or passed, for that matter). But with my use case, I need those skipped tests to be ignored and not considered for the pass rate.Because this feels like such a niche scenario, I decided to implement flag into the parser's configuration, that would look like this in
testbeats
' configuration:The flag, set to
false
by default, lets themocha
parser completely ignoreskipped
andpending
tests, subtracting them from thetotal
metric, which leads totestbeats
showing an appropriate pass rate (of 100% in my case).Changes
skipped_tests_passed
flag toParseOptions
interfaceskipped_tests_passed
logic tomocha
parserskipped_tests_passed=true
,result.skipped
will be subtracted fromresult.total
to not considerskipped
tests for the total pass ratemocha
JSON test case for whenskipped_tests_passed=true
mochawesome
test case for whenskipped_tests_passed=true
getTestSuite
: Now checks ifrawSuite
has a property ofskipped
, and sums its length tosuite.skipped
if it does. This is to prevent nested tests from being set toFAIL
even when they were actually skipped (related to PR #64).