I'm new to packaging so apologies if this is an obvious question.
When running the unlocked packages tests that reference unpackaged metadata in the SUBSCRIBER ORG, are these tests expected to pass? Or do we anticipate and ignore errors?
I have tests in our unlocked packages that reference unpackaged metadata (Custom Permissions, etc). When I run those tests in our scratch org, they pass. Based on that, I'll create a package and install it in a subscriber org.
When I run the package tests in my SUBSCRIBER org, some of the tests that reference the unpackaged metadata fails. These failures right now are assertion failures.
Since the docs say this, I am leaning towards this is expected behavior:
The unpackaged metadata isn’t included in the package and isn’t installed in subscriber orgs.
Not to get too subjective, but if others have seen this, would like to hear how you design your tests so they don't fail in a subscriber org. The issue is that it creates noise. For these offending tests, one idea is checking if the user is in a subscriber or scratch org, and not running tests in the subscriber.