-
Notifications
You must be signed in to change notification settings - Fork 407
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
Create Apex Unit Test Class command overwrites existing files with no warning #5837
Comments
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support. |
Hello @pozil 👋 It looks like you didn't provide all the required basic info in your issue. If you haven't already, please provide the following info: Here's an example of a set of required info that will pass the validation: A few more things to check:
Thank you! |
Hi @pozil , when creating a apex unit test class with a duplicate name, are you able to see a prompt like this to confirm to overwrite the existing file? |
Nope, as you can see: 2024-09-11.21-35-59.mp4 |
Hi @pozil , we understand this is a bug (and we will consider fixing this) but as per Apex test naming conventions, the tests should have Test in their names as the suffix. |
This issue has been linked to a new work item: W-16736221 |
@diyer thanks. I know about the convention, I just made a silly copy/paste mistake and forgot to add the Test suffix. This is how I found the issue :) |
Summary
When running the Create Apex Unit Test Class command with a right click on the project tree or from the command palette and specifying a class name that already exists, the command overwrites the existing file content with no warning.
Steps To Reproduce:
Sample
class and put some random code in there or a comment.Sample
for the class nameSample.cls
is replaced with the placeholder test codeExpected result
Command throws an error when file exists or prompts to confirm override
Actual result
Original file content is lost
Additional information
Salesforce Extension Version in VS Code:
Extension pack v61.12.0
Salesforce CLI Version:
@salesforce/cli/2.58.7 darwin-arm64 node-v18.17.0
OS and version:
macOs 14.6.1 (23G93)
VS Code version:
Version: 1.93.0 (Universal)
Commit: 4849ca9bdf9666755eb463db297b69e5385090e3
Date: 2024-09-04T13:02:38.431Z (1 wk ago)
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0
The text was updated successfully, but these errors were encountered: