-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: find server errors and display them with FileResponse errors #210
Conversation
expect(tableStub.calledTwice).to.equal(true); | ||
expect(styledHeaderStub.firstCall.args[0]).to.contain('Test Failures [1]'); | ||
expect(styledHeaderStub.secondCall.args[0]).to.contain('Apex Code Coverage'); | ||
expect(styledHeaderStub.calledThrice).to.equal(true); |
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.
these tests were giving false positives and needed to be updated
} | ||
|
||
if (this.result?.response?.details?.componentFailures) { | ||
const deployMessages = toArray(this.result.response.details.componentFailures); |
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.
failures.push(...fileResponses); | ||
} | ||
|
||
if (this.result?.response?.details?.componentFailures) { |
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.
aren't componentFailures and fileResponses going to include some of the same errors, and so this would show duplicates?
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.
ugh. dupes 🤦
if the dupes aren't happening, looks good. |
const deployMessages = toArray(this.result.response.details.componentFailures); | ||
const deployMessages = toArray(this.result?.response?.details?.componentFailures); | ||
if (deployMessages.length > failures.length) { | ||
// if there's additional failures in the API response, find the failure and add it to the output | ||
deployMessages.map((deployMessage) => { |
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 could get really loopy on a big deployment fail (use of find within a loop where find is doing multiple string.includes)
perf suggestion: iterate failures once to build a keyed Map< type+fullName>, deployMessage>
then, you can iterate the deployMessages once and use deployMessageMap.has( type + fullName)
No would be a good sign to add it
has=true could still compare the messages (if that's actually a source of dupes)
At the very least, do the (do type and name match?) conditional first so that it mostly exits before having to do the string.includes ops
if (this.result?.response?.details?.componentFailures) { | ||
const deployMessages = toArray(this.result.response.details.componentFailures); | ||
const deployMessages = toArray(this.result?.response?.details?.componentFailures); | ||
if (deployMessages.length > failures.length) { |
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.
good idea
What does this PR do?
checks the server response for other issues not present in the
getFileResponse()
method from SDR and displays them alongside other deployment issues.What issues does this PR fix or reference?
@W-9816657@ forcedotcom/cli#1180
OLD
NEW