We encourage the developer community to contribute to this repository. This guide has instructions to install, build, test and contribute to the framework.
- Node >= 14
git clone [email protected]:salesforce/apex-mockery.git
This will install all the tools needed to contribute
npm install
sf project deploy start
Rebuild every time you made a change in the source and you need to test locally
When developing, use apex unit testing to provide test coverage for new functionality. To run the apex tests use the following command from the root directory:
# just run test
npm run test
To execute a particular test, use the sfdx command directly
Configure your editor to use our lint and code style rules.
Prettier is a code formatter used to ensure consistent formatting across your code base. To use Prettier with Visual Studio Code, install this extension from the Visual Studio Code Marketplace. This repository provide .prettierignore and .prettierrc files to control the behaviour of the Prettier formatter.
We use sfdx-scanner
to execute code static analysis
It is automatically installed for you via npm install
The process of submitting a pull request is straightforward and generally follows the same pattern each time:
- Fork the repo
- Create a feature branch
- Make your changes
- Rebase
- Check your submission
- Create a pull request
- Update the pull request
Fork the salesforce/apex-mockery repo. Clone your fork in your local workspace and configure your remote repository settings.
git clone [email protected]:<YOUR-USERNAME>/apex-mockery.git
cd apex-mockery
git remote add upstream [email protected]:salesforce/apex-mockery.git
git checkout main
git pull origin main
git checkout -b feature/<name-of-the-feature>
Change the files, build, test, lint and commit your code using the following command:
git add <path/to/file/to/commit>
git commit ...
git push origin feature/<name-of-the-feature>
Commit your changes using a descriptive commit message
The above commands will commit the files into your feature branch. You can keep pushing new changes into the same branch until you are ready to create a pull request.
Sometimes your feature branch will get stale on the main branch, and it will must a rebase. Do not use the github UI rebase to keep your commits signed. The following steps can help:
git checkout main
git pull upstream main
git checkout feature/<name-of-the-feature>
git rebase upstream/main
note: If no conflicts arise, these commands will apply your changes on top of the main branch. Resolve any conflicts.
npm run lint
The above command may display lint issues not related to your changes. The recommended way to avoid lint issues is to configure your editor to warn you in real time as you edit the file.
Fixing all existing lint issues is a tedious task so please pitch in by fixing the ones related to the files you make changes to!
Test your change by running the unit tests and integration tests. Instructions here.
If you've never created a pull request before, follow these instructions. Pull request samples here
git fetch origin
git rebase origin/${base_branch}
# Then force push it
git push origin ${feature_branch} --force-with-lease
note: If your pull request needs more changes, keep working on your feature branch as described above.
CI validates prettifying, linting and tests
We use Conventional Comments to ensure every comment expresses the intention and is easy to understand. Pull Request comments are not enforced, it is more a way to help the reviewers and contributors to collaborate on the pull request.