Support using collection name as output filename #87
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #62
This adds support to name output files according to collection name. For this, new input parameter for task was added:
useCollectionNameAsFilename
. If this parameter istrue
, collection name is obtained:.json
file..json
, the filename itself is used.-
).If the obtained collection name is empty
If we have the collection name
export
input argument for given reporter:export
input argument does not have correct extension, it is used as directory, and filename based on collection name is appended to it.export
input argument for given reporter:newman
is used as the directory, and filename based on collection name is appended to it. This is to keep the default behavior, when output files are written tonewman
folder when nothing is specified. So if user turns onuseCollectionNameAsFilename
, the output files will still be in the same location, just with new names.The filename is created as
{collection name}-{reporter name}.{extension}
. So if collection name isBase tests
:Base tests-junit.xml
.Base tests-html.html
.Reporter name is there not only for clarity (as mentioned in the comment of the issue), but to make filename unique, if both HTML reporters are used.
This change should probably have some tests, but Typescript/Javascript is not my language, so I need at least some hint here. I looked at existing tests, but do not understand exactly how they work and what do they really test.