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

Wrong duration using Mocha and the JSON reporter #472

Open
lieser opened this issue Jun 25, 2023 · 2 comments
Open

Wrong duration using Mocha and the JSON reporter #472

lieser opened this issue Jun 25, 2023 · 2 comments

Comments

@lieser
Copy link

lieser commented Jun 25, 2023

The JSON reporter included in Mocha reports the duration in seconds. The action assumes seconds however, resulting in a wrong duration in the published test results.

If the JSON file from Dart is using the same format but seconds for the duration, maybe it would be possible to use the difference between the included start and end as a hint for the unit of duration?

Example workflow with the issue: https://github.com/lieser/dkim_verifier/actions/runs/5306139976/jobs/9603566014

{
  "stats": {
    "suites": 72,
    "tests": 236,
    "passes": 233,
    "pending": 3,
    "failures": 0,
    "start": "2023-06-18T22:56:22.292Z",
    "end": "2023-06-18T22:56:24.033Z",
    "duration": 1741
  },
  "tests": [
    //...
  ]
}

grafik

@EnricoMi
Copy link
Owner

Good idea to detect the duration unit. I guess the unit does not change between runs of a workflow, so I guess setting time_unit: milliseconds should work here. See `Options related to reporting test results' section in README.md.

@lieser
Copy link
Author

lieser commented Jun 25, 2023

Thanks for pointing me to the time unit setting, missed that. Works without a problem now, so the issue can be closed from my site.

Would of course still be nice if it could automatically detect the correct unit.

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