Skip to content

Commit 5a53b8e

Browse files
committed
changing parameter name from reportFilename to reportFile, maintaining backward compatibility
1 parent 20a4df5 commit 5a53b8e

File tree

11 files changed

+635
-608
lines changed

11 files changed

+635
-608
lines changed

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@
4141
- Converts **<traits>** elements to to JUnit **<properties>**.
4242
- Converts skipped `test` **<reason>** elements to JUnit **<skipped>** with message.
4343
- Converts `test` **<failure>** elements to JUnit **<failure>** with message and stack trace.
44-
- Supports single **<assembly>** per file, if multiple assemblies are present only first will be converted.
44+
- Supports single **<assembly>** per file, if multiple assemblies are present, only the first will be converted.
4545

4646
### MSTest TRX
4747

48+
`dotnet test` generates TRX style files unless different logger is used.`
49+
50+
- Converts `Output/ErrorInfo/ErrorInfo` to JUnit **<failure>** with message.
4851
- Converts `Output/ErrorInfo/Message` to JUnit **<failure>** message.
4952
- Converts `Output/ErrorInfo/StackTrace` to JUnit **<failure>** stack trace.
5053
- Converts `Output/StdErr` to JUnit **<system-err>**.
@@ -86,25 +89,26 @@ converter.toJson(options).then((result) =>{/*do something with result*/});
8689
npm i -g junit-converter
8790
```
8891

92+
#### Convert test report to JUnit format and save to file
8993
```bash
9094
junit-converter --testFile mytests/nunit.xml --testType nunit
9195
```
9296

9397
### Options
9498

95-
| Option | Type | Default | Description |
96-
|:--------------------------|:--------|:--------------------------|:------------------------------------------------------------------------------------------------|
97-
| `testFile` **(required)** | string | | Path to test file for conversion |
98-
| `testType` **(required)** | string | | [Test report type](https://github.com/agracio/mochawesome-converter#supported-testtype-options) |
99-
| `reportDir` | string | ./report | Converted report output path when saving file |
100-
| `reportFilename` | string | `testFile.name`-junit.xml | JUnit report name when saving file |
101-
| `splitByClassname` | boolean | false | Split into multiple test suites by test classname |
102-
| `minify` | boolean | false | Minify XML result |
99+
| Option | Type | Default | Description |
100+
|:--------------------------|:--------|:--------------------------|:--------------------------------------------------|
101+
| `testFile` **(required)** | string | | Path to test file for conversion |
102+
| `testType` **(required)** | string | | [Test report type](#supported-testtype-options) |
103+
| `reportDir` | string | ./report | Converted report output path when saving file |
104+
| `reportFile` | string | `testFile.name`-junit.xml | JUnit report file name |
105+
| `splitByClassname` | boolean | false | Split into multiple test suites by test classname |
106+
| `minify` | boolean | false | Minify XML result |
103107

104108
- `testFile` - relative or absolute path to input test file.
105109
- `testType` - type of test report, not case-sensitive.
106110
- `reportDir` - will be created if path does not exist. Only used when saving to file.
107-
- `reportFilename` - JUnit file name. Only used when saving to file.
111+
- `reportFile` - JUnit file name. Only used when saving to file.
108112
- `splitByClassname` - If true, splits test cases into multiple test suites by classname.
109113
This is useful for test runners that generate tests under a single test suite such as `dotnet test` when using JUnit loggers.
110114
Should only be set to true if test report file contains single test suite.

bin/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ const argv = yargs(hideBin(process.argv))
1616
.version().argv;
1717

1818
const options = (config(argv));
19-
convert.toFile(argv).then(() => console.log(`Report created at '${options.reportDir}/${options.reportFilename}'`));
19+
convert.toFile(argv).then(() => console.log(`Report created at '${options.reportDir}/${options.reportFile}'`));
2020

bin/options.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export const yargsOptions = {
1414
describe: 'Report output directory',
1515
string: true,
1616
},
17-
reportFilename: {
17+
reportFile: {
1818
default: undefined,
19-
describe: 'JUnit report name',
19+
describe: 'JUnit report file name',
2020
string: true,
2121
},
2222
splitByClassname: {

index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ declare module 'junit-converter'{
33
testFile: string
44
testType: string
55
reportDir? : string
6+
/**
7+
* @deprecated Use reportFile instead.
8+
*/
69
reportFilename? : string
10+
reportFile? : string
711
splitByClassname?: boolean
812
minify?: boolean
913
saveIntermediateFiles?: boolean

0 commit comments

Comments
 (0)