Skip to content

Commit

Permalink
updating code
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Nov 30, 2024
1 parent 883f78e commit 3efab36
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ convert(options).then(() => console.log(`Report created: ${options.reportDir}/${
| `html` | boolean | false | Create Mochawesome HTML? |
| `htmlReportFilename` | string | mochawesome.html | Mochawesome HTML file name |
| `skippedAsPending` | boolean | true | Show skipped tests as pending in HTML |
| `switchClassnameAndName` | boolean | false | Switch test case classname and name |

- `testFile` - relative or absolute path to input test file.
- `testType` - type of test report, not case-sensitive.
- `reportDir` - will be created if path does not exist.
- `skippedAsPending` - Mocha always reports skipped tests as pending and this is default behaviour of converter.
Set to `false` to display tests as skipped.
- `switchClassnameAndName` - Switches classname and name attributes of testcase in case your test naming data is generated in reverse order.

#### Supported `testType` options.

Expand Down
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@ module.exports = {
reporters: [
'default',
'github-actions',
["jest-html-reporters", {
publicPath: './tests/report',
filename: 'report.html',
darkTheme: true,
pageTitle: 'mochawesome-converter',
expand: true,
urlForTestFiles: 'https://github.com/agracio/mochawesome-converter/blob/main'
}
]
],
}
71 changes: 70 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"xslt-processor": "^3.3.1"
},
"devDependencies": {
"jest": "^29.7.0"
"jest": "^29.7.0",
"jest-html-reporters": "^3.1.7"
}
}
3 changes: 1 addition & 2 deletions src/junit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const parser = require('p3x-xml2json');
const crypto = require("crypto");
const parser = require('p3x-xml2json');
const marge = require('mochawesome-report-generator');
const xmlFormat = require('xml-formatter');
const _ = require('lodash');
Expand Down Expand Up @@ -126,7 +126,6 @@ function parseXml(options, xml){
if(options.testType === 'trx' && json.testsuites[0].testsuite[0].testcase.length !== 0){
json = parseTrx(options, json);
}
//console.log(_.sumBy(json.testsuites[0].testsuite, function(suite) { return Number(suite.tests); }));
return json.testsuites[0];
}

Expand Down

0 comments on commit 3efab36

Please sign in to comment.