diff --git a/README.md b/README.md index 9e62b11..1ae02cb 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,13 @@ https://github.com/adamgruber/mochawesome ### JUnit - Converts **<properties>**, **<system-out>** and **<system-err>** elements to Mochawesome test context. -- Nested test suites currently not supported. +- Nested test suites only supported when using `transformJunit: true` option. This will flatten nested test suites. ### NUnit - NUnit XML version 3 and higher is supported. - Converts **<properties>** elements to JUnit **<properties>**. - Converts **<output>** elements to JUnit **<system-out>**. -- Nested `test-suite` elements are flattened. ### xUnit.net @@ -88,7 +87,7 @@ https://github.com/adamgruber/mochawesome ### Usage ```bash -npm i mochawesome-converter +npm i --save-dev mochawesome-converter ``` ```js @@ -100,30 +99,32 @@ let options = { junit: true } -convert(options).then(() => console.log(`Report created: ${options.reportDir}/${options.reportFilename}`)); +convert(options).then(() => console.log(`Mochawesome report created`)); ``` ### Options -| Option | Type | Default | Description | -|:--------------------------|:--------|:--------------------------|:---------------------------------------------| -| `testFile` **(required)** | string | | Path to test file for conversion | -| `testType` **(required)** | string | | Test report type | -| `reportDir` | string | ./report | Converted report output path | -| `reportFilename` | string | mochawesome.json | Mochawesome report name | -| `junit` | boolean | false | Create JUnit report? | -| `junitReportFilename` | string | `testFile.name`-junit.xml | JUnit report file name | -| `html` | boolean | false | Create Mochawesome HTML? | -| `htmlReportFilename` | string | mochawesome.html | Mochawesome HTML file name | -| `skippedAsPending` | boolean | true | Show skipped tests as pending in Mochawesome | -| `switchClassnameAndName` | boolean | false | Switch test case classname and name | +| Option | Type | Default | Description | +|:--------------------------|:--------|:--------------------------|:--------------------------------------------------| +| `testFile` **(required)** | string | | Path to test file for conversion | +| `testType` **(required)** | string | | Test report type | +| `reportDir` | string | ./report | Converted report output path | +| `reportFilename` | string | mochawesome.json | Mochawesome report name | +| `junit` | boolean | false | Create JUnit report? | +| `junitReportFilename` | string | `testFile.name`-junit.xml | JUnit report file name | +| `transformJunit` | boolean | false | Transform JUnit test file with nested test suites | +| `html` | boolean | false | Create Mochawesome HTML? | +| `htmlReportFilename` | string | mochawesome.html | Mochawesome HTML file name | +| `skippedAsPending` | boolean | true | Show skipped tests as pending in Mochawesome | +| `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. +- `switchClassnameAndName` - Switches classname and name attributes of testcase if your test naming data is generated in reverse order. +- `transformJunit` - Uses XSLT processor to flatten any nested JUnit test suites. Setting `junit: true` will produce processed JUnit file. #### Supported `testType` options. diff --git a/src/nunit-junit.xslt b/src/nunit-junit.xslt index 78546dc..0a44b23 100644 --- a/src/nunit-junit.xslt +++ b/src/nunit-junit.xslt @@ -61,6 +61,7 @@ + diff --git a/src/xunit-junit.xslt b/src/xunit-junit.xslt index 4ae392f..3267b19 100644 --- a/src/xunit-junit.xslt +++ b/src/xunit-junit.xslt @@ -1,28 +1,12 @@ - + - - - - - - - - - - - - - - - - - + +