Testing
Every code change ships with tests in the same PR - not a follow-up. This page covers how to run them locally.
Apex tests
Against the default org (with coverage):
npm run test:apexFaster - no coverage:
npm run test:apex:nocoverageTargeted by suite (each plugin has its own):
npm run test:apex:suite:coreLWC tests
npm run test:lwcOr without coverage (faster for iteration):
npm run test:lwc:nocoverageDo not run npx jest directly. The repo uses sfdx-lwc-jest, which isolates a pre-existing test pollution issue that raw jest exposes.
Everything at once
npm testRuns test:lwc then test:apex.
Static analysis
npm run scanRuns sf code-analyzer for both Apex (PMD) and LWC (ESLint + SLDS linter). CI treats any severity 1-3 violation as failure - fix it, don’t add to the ignore list.
Individually:
npm run scan:apexnpm run scan:lwcFormatting
npm run prettier:fixRuns Prettier across the codebase. There’s a pre-commit hook, but running manually before pushing catches formatting drift early.
When touching a test, actually run it
Writing or editing a test without running the suite once before signaling “done” is not a task done - it’s a task in a broken state that the maintainer has to babysit. The rule applies to every level:
- Apex tests:
npm run test:apex:nocoverage(fast) or targetedsf apex run test --tests <ClassName>. - LWC tests:
npm run test:lwc:nocoverage. - Playwright / e2e tests (
nebula-logger/plugins/notificationsand similar):npm run test:e2e:notifications(or:headedfor local iteration).
E2e is the one that gets skipped most often because it’s slow - don’t skip it. If a spec you touched hangs or times out, that’s the bug to fix, not to hand off.
Where next
- Repo layout - where test files live.
- PR conventions - commit and PR style.