1.3.5 • Published 3 months ago

mochawesome-json-to-md v1.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

mochawesome-json-to-md

GitHub license GitHub issues GitHub stars

Overview

This tool converts JSON reports generated by mochawesome (including reports merged by mochawesome-merge) into editable markdown format. It provides flexibility by allowing users to create and customize their own markdown templates.

Table of Contents

Features

  • Convert mochawesome JSON reports to markdown format.
  • Customize the output using templates.

How do I get started?

Install package

npm install -g mochawesome-json-to-md

run the script

mochawesome-json-to-md -p ./your/file/path.json -o ./generated.md

that's it! You've successfuly converted json report to slick md report.

Script arguments

OptionAliasDescriptionRequiredDefault
--path-pPath to the JSON reportYes
--output-oPath to the output markdown fileNo./md-reports/output.md
--template-tPath to the markdown template fileNo./sample-template.md
--title-TTitle for the reportNoTest Report
--verbose-vVerbose modeNofalse

Templating, tags and customization

How to create a template?

You can create a template by yourself. It's just a markdown file with some tags. You can use sample-template.md as a reference. But feel free to create your own template. Below you can find all the tags and how to use them.

Singular tags

Singular tags will be replaced with the value of the tag.

TagDescription
{{title}}Title of the report
{{startDate}}Start date of the test run
{{duration}}Duration of the test run in seconds
{{totalTests}}Total number of tests
{{passedTestsCount}}Number of passed tests
{{failedTestsCount}}Number of failed tests
{{skippedTestsCount}}Number of skipped tests
{{skippedCypressTestsCount}}Number of skipped tests by Cypress
{{otherTestsCount}}Number of other tests

Block tags

Boolean tags

Boolean tags will be replaced with the content between the tags if the condition is met.

Open tagClosing tagDescription
{{#passedExists}}{{/passedExists}}If there are any passed tests, then everything between these tags will be included in the report
{{#failedExists}}{{/failedExists}}If there are any failed tests, then everything between these tags will be included in the report
{{#skippedExists}}{{/skippedExists}}If there are any skipped tests, then everything between these tags will be included in the report
{{#skippedCypressExists}}{{/skippedCypressExists}}If there are any skipped tests by Cypress, then everything between these tags will be included in the report

Loop tags

Loop tags will be replaced with the content between the tags for each test with given status.

Open tagClosing tagDescription
{{#passedTests}}{{/passedTests}}Everything between these tags will be included in the report for each passed test
{{#failedTests}}{{/failedTests}}Everything between these tags will be included in the report for each failed test
{{#skippedTests}}{{/skippedTests}}Everything between these tags will be included in the report for each skipped test
{{#skippedCypressTests}}{{/skippedCypressTests}}Everything between these tags will be included in the report for each skipped test by Cypress

Test tags

Test tags will be replaced with the value of the tag for each test with given status.

TagDescription
{{path}}Path to the test
{{title}}Title of the test
{{fullTitle}}Full title of the test
{{timedOut}}If the test timed out
{{duration}}Duration of the test in milliseconds
{{state}}State of the test
{{speed}}Speed of the test
{{pass}}If the test passed
{{fail}}If the test failed
{{pending}}If the test is pending
{{context}}Context of the test
{{code}}Code of the test (alert: it's a long string)
{{err}}Object with error information (alert: it's an object, call properties instead)
{{err.message}}Error message
{{err.estack}}Error stack
{{err.diff}}Error diff
{{uuid}}UUID of the test
{{parentUUID}}UUID of the parent test
{{isHook}}If the test is a hook
{{skipped}}If the test is skipped

Where can I get more help, if I need it?

Just write the issue. I'll try to answer as fast as possible.

How I can contribute to the project?

You can contribute to the project by opening an issue or creating a pull request.

But first, please, read the Contributing file. It contains all the rules and guidelines for the project. If you have any questions, please, ask them in the Issues section. I'll try to answer as fast as possible.

Plans and achievements for this project

  • Read and process passed arguments
  • Create function for "semi-dynamic" markdown template creation
  • Read json report
  • Grab all needed information
  • Grab all possible tests by type and store them together by type (recurrence)
  • Save markdown with created "semi-dynamic" markdown template and return there only informations passed as arguments
  • Create fully customizable markdown template with tags
  • Remove need of all arguments and depends only on customizable markdown template with tags
  • Remove need of lodash package
  • Remove/find substitute for yargs package
  • Add support for TypeScript
  • Add few samples of markdown templates to choose from
  • Add unit tests (topic started in this issue)
  • Rewrite and add more documentation
    • Readme
    • Contributing guidelines
    • Code of conduct
  • Add workflow for automated semantic versioning

License

MIT

Author

Tymoteusz 403-html Stępień

1.3.5

3 months ago

1.3.4

3 months ago

1.2.1

4 months ago

1.2.0

6 months ago

1.1.0

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago

0.7.2

9 months ago

0.7.1

1 year ago

0.6.2

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.2.2

2 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago