cypress-terminal-report icon indicating copy to clipboard operation
cypress-terminal-report copied to clipboard

Support patterns in outPath for NestedOutputProcessorDecorator

Open JohannesMunk opened this issue 1 month ago • 2 comments

Hey there! I tried to minimize changes to implement patterns in output filenames for custom output:

outputTarget: { '*|[relpath]/[basename]/[yyyy][mm][dd]/[basename].[HH][MM][SS].txt': function (allMessages) {..} } outputTarget: { '*|[relpath]/[basename].txt': function () {..} }

Supported are these tokens:

Token Example Description
[relpath] /cy/e2e relative path of spec to spec root
[basename] spec1.cy part of spec filename before extension
[H] "0" Hour of day
[HH] "00" Hour of day - with leading zero
[M] "0" Minute of hour
[MM] "00" Minute of hour - with leading zero
[S] "0" Second of minute
[SS] "00" Second of minute - with leading zero
[d] "1" day of month
[dd] "01" day of month - with leading zero
[m] "1" month of year
[mm] "01" month of year - with leading zero
[yy] "70" last 2 digits of current year
[yyyy] "1970" current year

The legacy format given as 'path-prefix|extension' outputTarget: { 'cypress-logs|txt': function () {..} } is translated to pattern: parts[0]+"/[relpath]/[basename]."+parts[1]

Hope this helps someone!

JohannesMunk avatar May 22 '24 09:05 JohannesMunk