Skip to content
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: push-on-save working as expected, diagnostics cleared after successful push #4975

Merged
merged 13 commits into from
Jul 18, 2023

Conversation

CristiCanizales
Copy link
Contributor

What does this PR do?

Makes push on save work as expected (push every time you save) and fixes issue with push errors not being cleared from the problems panel after a successful push

What issues does this PR fix or reference?

#4942, @ W-13749253@

Functionality Before

  • with push on save setting enabled, push on save was triggered only once, not the subsequent times
  • diagnostics were kept in the problems tab even after successful push

Functionality After

  • with push on save setting enabled, push is triggered every time you save
  • diagnostics are cleared from the problems tab after successful push

@CristiCanizales CristiCanizales requested a review from a team as a code owner July 12, 2023 20:00
@CristiCanizales CristiCanizales linked an issue Jul 12, 2023 that may be closed by this pull request
@CristiCanizales CristiCanizales self-assigned this Jul 18, 2023
Copy link
Member

@RitamAgrawal RitamAgrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good Cristi! I have posted few questions for better understanding.

@@ -128,6 +128,7 @@ export class DeployQueue {
default:
displayError(e.message);
}
} finally {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeployQueue.locked is set to false. What does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this unlocks the queue in order to let the subsequent pushes on save be triggered

mockDeployResult
);
expect(deployRetrieveExecutorClearSpy).toHaveBeenCalled();
expect(sfdxCommandletExecutorClearSpy).toHaveBeenCalled();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the sequence in which the error collection is cleared important?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, but I did it different in the 2 files I implemented this according to the file... e.g: in baseDeployRetrieve I clear first the deploy errors, and in forceSourcePush I clear first the push errors

const executor = new TestDeployExecutor(
'testDeploy',
'force_source_deploy_with_sourcepath_beta'
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are we specifying that we have a failure while deploying in this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not specifying/defining the result nor the success.. thus it's a failure

@@ -569,62 +569,6 @@ describe('Base Deploy Retrieve Commands', () => {
expect(appendLineStub.calledOnce).to.equal(true);
expect(appendLineStub.firstCall.args[0]).to.equal(expectedOutput);
});

xit('should report any diagnostics if deploy failed', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we trying to test the same behavior in 'should unlock queue on failure'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized I was missing a case. Thanks!

expect(deployRetrieveExecutorClearSpy).toHaveBeenCalled();
expect(sfdxCommandletExecutorClearSpy).toHaveBeenCalled();
expect(unlockSpy).toHaveBeenCalled();
expect(mockUnlock).toHaveBeenCalled();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mockUnlock is returnedValue of unlockSpy. Do we need this expect statement? Also mockUnlock should be a boolean, right?

);
});

describe('postOperation', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate describe block for postOperation! Good Work on keeping the separation of concerns in mind! 🎉

Copy link
Member

@RitamAgrawal RitamAgrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QE Notes :
✅ With Prefer Deploy on save setting On, It runs the Deploy command after every save.
✅ Errors are disappearing after successful deploy
✅ Errors are disappearing after successful push
✅ With Prefer deploy on Save setting OFF, It runs push after every save.

@CristiCanizales CristiCanizales merged commit 7bcc49a into develop Jul 18, 2023
@CristiCanizales CristiCanizales deleted the cristi/fix-push-on-save branch July 18, 2023 23:25
@CristiCanizales CristiCanizales linked an issue Jul 19, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Push or deploy on save not working as expected Errors dissapear when other file deploys
2 participants