-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support patterns in outPath for NestedOutputProcessorDecorator #243
base: master
Are you sure you want to change the base?
Conversation
…elpath] [basename] outputTarget: { '*|[relpath]/[basename].txt': function () {..} }
…me tokens (e.g. [yy][mm][dd], ...) example: [relpath]/[basename]/[yyyy][mm][dd]/[basename].[HH][MM][SS].txt or [yyyy][mm][dd]_[HH][MM][SS]/[relpath]/[basename].txt
constructor(filePattern, specRoot, decoratedFactory) { | ||
const parts = filePattern.split('|'); | ||
// for pattern matching: first part of filePattern has to start with '*|' | ||
if (parts[0] === "*") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please modify the spacing to use two spaces instead of tabs ?
@@ -21,7 +29,58 @@ module.exports = class NestedOutputProcessorDecorator { | |||
} | |||
|
|||
const relativeSpec = path.relative(this.specRoot, spec); | |||
const outPath = path.join(this.root, relativeSpec.replace(new RegExp(path.extname(relativeSpec) + '$'), `.${this.ext}`)); | |||
|
|||
const parsed = path.parse(relativeSpec); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a big chunk of code that can get its own method.
Hi @JohannesMunk . This looks nice. Sorry for feedback only after 2 weeks. I wonder if we should apply this to both nested and non nested output path generation? It would make sense to keep consistency. Besides that this PR needs some test updates, +one case that is actually testing this new feature. Let me know if you need help / direction. |
Fyi I have implemented some changes and did some maintenance on certain tests that were broken. You should pull changes from origin. |
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:
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!