Beta Package Version Creation Failing Due to Apex Test Outside Package Scope
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the failure with the provided scratch-org definition and sf package version create, then run sf apex run test --class-names MyProfilePageControllerTest --synchronous to confirm the failing test. Investigate the create_package_version CI task and package-version test selection; done means beta creation is not blocked by the out-of-package MyProfilePageControllerTest failure.
Written by the indexing model from the issue text.
Description
Related to / reopening: #553
This issue was previously closed in #553 but we are still hitting the same behavior. Beta package version creation fails because Salesforce executes Apex tests that exist in the org but are not part of the package, causing the build to fail on tests we have no control over in the package context.
Description
When running sf package version create for a beta release, the command fails with an Apex Test Failure from a test class (MyProfilePageControllerTest) that is not included in the package source/branch. The test runner is picking up org-level tests beyond the package boundary, which makes the beta pipeline unreliable.
Error from CI logs:
[Error]: Package creation failed with error:
Apex Test Failure:
Class.element.MyProfilePageControllerTest.testSave: line 30,
column 1 System.AssertException: Assertion Failed
Exception in task create_package_version
Steps to Reproduce
- Create a scratch org using the following definition file:
{
"orgName": "Scratch Org",
"adminEmail": "<your-email>",
"edition": "Developer",
"features": ["EnableSetPasswordInApi", "Sites", "COMMUNITIES", "StateAndCountryPicklist"],
"settings": {
"apexSettings": {
"enableDisableParallelApexTesting": false
},
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
},
"experienceBundleSettings": {
"enableExperienceBundleMetadata": true
},
"communitiesSettings": {
"enableNetworksEnabled": true,
"enableOotbProfExtUserOpsEnable": true
},
"customAddressFieldSettings": {
"enableCustomAddressField": true
},
"externalClientAppSettings": {
"enableClientSecretInRestApiAccess": true
}
}
}
- Ensure
MyProfilePageControllerTestexists in the org. - Run the test class directly to confirm it fails:
sf apex run test --class-names MyProfilePageControllerTest --synchronous - Observe the test fails due to
MyProfilePageControllerTest.
Expected Behavior
Test should pass
Actual Behavior
The command fails with System.AssertException: Assertion Failed from MyProfilePageControllerTest.testSave (line 30).
- Dominant language
- No language data
- Stars
- 571
- Forks
- 80
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from forcedotcom/cli
-
investigating validated
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
forcedotcom/cli#3657 · 2 comments ·
-
`sf agent preview` fails with `AgentApiNotFound` against staging (aws-stage1) orgs — `stage.api.salesforce.com` missing from endpoint fallbackPossibly taken A pull request linked to this issue is open or already merged. Openarea:afdx owned by another team
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
forcedotcom/cli#3645 · 2 comments ·
-
bug investigating validated
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
forcedotcom/cli#3644 · 6 comments ·
-
sf agent mcp asset replace --assets null throws raw TypeError instead of InvalidShapePossibly taken @konkonrong-lgtm claimed this 56 days ago. Openarea:afdx bug investigating owned by another team validated
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
forcedotcom/cli#3625 · 4 comments ·
-
area:afdx bug owned by another team
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
forcedotcom/cli#3608 · 2 comments ·
Similar issues
-
bug No Code Attached Yet
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
joomla/joomla-cms#48587 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
magicmonty/bash-git-prompt#581 ·
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 Under an hour Newbie friendliness 78/100
JuliusBrussee/caveman#1214 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
joshstevens19/rindexer#483 ·
Maintainers usually reply within 1 day