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

Feature: Mochawesome skipped and pending tests no longer generate a failed result #64

Merged
merged 14 commits into from
May 10, 2024

Conversation

jmuleiro
Copy link
Contributor

@jmuleiro jmuleiro commented May 9, 2024

Context

I recently started using this tool to integrate mochawesome reports with Slack. It turns out, in my test cases I have feature flags that cause Cypress tests to be skipped. Mochawesome has two types of skipped tests: skipped and pending. But as it turns out, mocha does not. This caused the parser to interpret tests marked as skipped by Mochawesome as failures, and to list them as such.

I updated the mocha parser so that it deals with this issue if it finds skipped keys in test results/suites.

Changes

  • Updated mocha parser
    • If the raw JSON has a skipped property, it adds those tests to the list of tests marked with a pending state
  • Added mochawesome test case for results with skipped, non-pending tests
  • Renamed test file skipped-tests to pending-tests to match its behavior (and updated test description)
  • Updated GitHub Actions node-version to latest
  • Fixed ReferenceError when result type is set to unsupported parser

Sample file

Here's a sample JSON test result with which you can reproduce the unintended behavior:
flipcard-submit.json

@ASaiAnudeep
Copy link
Member

hey @jmuleiro ,

  • can we just update the existing mocha file to support your scenario.
  • please add a new test to check the combination of skipped and pending scenarios.

@jmuleiro
Copy link
Contributor Author

@ASaiAnudeep @leelaprasadv done!

@ASaiAnudeep
Copy link
Member

@jmuleiro do you mind updating the node versions to latest in build yaml file.

  • build: node-version: [18.x, 20.x]

@jmuleiro
Copy link
Contributor Author

@ASaiAnudeep done, also took the liberty of fixing a small ReferenceError that occurred when the parser type was set to an unsupported parser.

@ASaiAnudeep ASaiAnudeep merged commit 56290a4 into test-results-reporter:main May 10, 2024
6 checks passed
@ASaiAnudeep
Copy link
Member

@jmuleiro thanks a lot for your contributions. The new version v0.1.15 has been released.

Please use the latest version of testbeats to see your changes.

npx testbeats@latest publish -c path/to/config.json

@jmuleiro jmuleiro changed the title Feature: Mochawesome parser Feature: Mochawesome skipped and pending tests no longer generate a failed result May 13, 2024
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

Successfully merging this pull request may close these issues.

3 participants