Open pozil opened 2 months ago
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 :wave: 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: Salesforce Extension Version in VS Code: Salesforce CLI Version: OS and version: VS Code version: Most recent version of the extensions where this was working:
Here's an example of a set of required info that will pass the validation: Salesforce Extension Version in VS Code: 60.13.0 Salesforce CLI Version: @salesforce/cli/2.42.6 darwin-arm64 node-v18.18.2 OS and version: MacOS Sonoma 14.5 VS Code version: 1.89.1 Most recent version of the extensions where this was working: 60.11.0
A few more things to check:
Developer: Toggle Developer Tools
in the command palette.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:
https://github.com/user-attachments/assets/fa9010db-2f5c-4cce-8302-1ba3338afcc7
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