fix cucumber junit report#11131
Conversation
| this.onTestRunStarted() | ||
| } else if (envelope.pickle) { | ||
| this.onPickleAccepted(envelope.pickle) | ||
| this.onPickleAccepted({ ...envelope.pickle, uri: this.normalizeURI(envelope.pickle.uri)!! }) |
There was a problem hiding this comment.
| this.onPickleAccepted({ ...envelope.pickle, uri: this.normalizeURI(envelope.pickle.uri)!! }) | |
| this.onPickleAccepted({ ...envelope.pickle, uri: this.normalizeURI(envelope.pickle.uri) }) |
There was a problem hiding this comment.
The reason I added !! is that normalizeURI should not be left as undefined for envelope.pickle.uri. Without this, it would cause issues with data types.
There was a problem hiding this comment.
This seems to me we just suppress the case where normalizeURI would return undefined. How about we change its interface to this:
normalizeURI(uri: string) {
return path.isAbsolute(uri) ? uri : path.resolve(uri)
}given that envelope.pickle.uri is always defined as string.
There was a problem hiding this comment.
I agree with your suggestion to modify the normalizeURI function as proposed above. I'll go ahead and implement those changes now.
There was a problem hiding this comment.
My apologies, GherkinDocument has a type uri?: string, and pickle has type as uri: string. This modification cause type conflicts with GherkinDocument. Please share your opinion on this.
There was a problem hiding this comment.
for the onGherkinDocument call we could do:
this.onGherkinDocument({
...envelope.gherkinDocument,
...(envelope.gherkinDocument.uri
? { uri: this.normalizeURI(envelope.gherkinDocument.uri) }
: {}
)
})
christian-bromann
left a comment
There was a problem hiding this comment.
Awesome 👍
Really great work over the last 2 weeks or so. I am already talking with the other contributor to have you added as a member once you make 2 more PRs and reach 10 impactful contributions 🎉
Thanks! I'm glad you liked my work in the past couple of weeks. I'll aim to do two more PRs and reach 10 impactful contributions as you've suggested. Exciting times ahead! 🚀🎉 |
Proposed changes
Fix - #11125
It looks at the URI that comes from the cucumber event broadcaster to see if it's an absolute path. If it's absolute, it just uses that URI. If not then it figures out the full path and uses it.
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers