2

We are creating a 2nd gen package in Salesforce. When we try to create a new version with code coverage, so it can be promoted, I get an error on some test files.

But a few things happen:

  • If I run these test one by one, manually in vscode, then the tests pass without issue.
  • If I run all tests in developer console, All tests pass and I have a code coverage of 90%
  • If I run all tests in vscode, either with the "Run all test" in the test file, or in the Testing tab in vscode, then I get an error This class name's value is invalid: *NamespacePrefix*. Provide the name of an Apex class that has test methods.
  • The Apex tests in the Test view in VScode have the NamespacePrefix before their name.

I found that this was an issue with some experimental setting, I was told to turn the Salesforcedx-vscode-core > Experimental: Use Apex Library off but I don't have this setting, and all references seem to be from 2021 and has since been fixed.

Any idea why I can't run all tests or create a package version with the code coverage check?

  • VS code version: 1.87.2
  • SF cli version: @salesforce/cli/2.33.3 win32-x64 node-v18.13.0
1
  • This seems to suggest some form of regex match or similar for collecting all test classes is finding something it should not. Do you have some file that contains @IsTest where that file is not apex but is in the package folder structure?
    – Phil W
    Commented Apr 14 at 8:41

0

You must log in to answer this question.