You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* test(sdk): pass pollIntervalSeconds:0 in cartridge import tests
Nine `addCartridge`/`removeCartridge`/`setCartridgePath` tests in `cartridges.test.ts` exercise the Business-Manager import-export fallback, which calls `waitForJob` with a default 3s poll interval. Because the MSW handler resolves the job immediately, the 3s sleep is pure dead time.
This change passes `{waitOptions: {pollIntervalSeconds: 0}}` (existing public option on `CartridgeUpdateOptions`) so the tests skip the artificial wait. No production-code change.
Metric: pnpm run test:agent 40.2s → 14.4s (-64%).
* chore: run package test suites concurrently with pnpm -r --parallel
By default `pnpm -r run` walks the workspace in topological order, so SDK + mrt run first, then CLI + MCP. None of the package test:agent commands actually need each other's build artifacts (tests import source TS via the `development` workspace condition), so we can run them all concurrently.
Metric: pnpm run test:agent 14.4s → 8.8s (-39%).
* test(cli): pass interval:0 in scapi replications wait tests
Four `scapi replications wait` tests pass `interval: 1` (one real second per poll) along with a mocked `fetch` that returns immediately. Set `interval: 0` so the in-test polling loop runs at memory speed. The flag is already integer-typed and treats 0 as a valid no-wait value.
Metric: cli package test 4s → 3s.
* feat(sdk): inject `now()` clock into waitForEnv
`waitForEnv` already accepts a custom `sleep` function for tests, but the timeout check still reads `Date.now()` directly, so the existing 'should timeout after specified duration' test waits ~1s of real wall time even though `instantSleep` is in use.
Add an optional `now?: () => number` option that mirrors the existing `sleep` injection. The MRT timeout test passes a virtual clock that advances 1s per call, making the test instant.
Metric: SDK package test 4s → 3s.
* test(sdk): run mocha --parallel --jobs 4
The SDK package has 114 unit-test files and is the wall-clock bottleneck of the workspace test run. Mocha's parallel mode shards files across worker processes; jobs=4 is empirically the sweet spot under root pnpm -r --parallel (jobs=8 oversubscribes the 16-CPU machine and degrades wall time when CLI is also running parallel workers).
Metric: pnpm run test:agent 8.9s → 5.2s (-41%).
* test(cli): run mocha --parallel with per-worker auth-store isolation
The CLI's stateful auth store is a JSON file in the oclif data directory (e.g. `~/Library/Application Support/@salesforce/b2c-cli/auth-session.json`). Under mocha --parallel, every worker process shares this file, so concurrent `setStoredSession`/`clearStoredSession` calls race and tests fail intermittently.
This change:
- Adds an optional `B2C_TEST_DATA_DIR` env override in `BaseCommand.init()` so tests can redirect the store path.
- Has the CLI test setup create a unique per-process `mkdtemp` directory, set `B2C_TEST_DATA_DIR`, and call `initializeStatefulStore(testDataDir)` for the worker. The mocha `beforeEach` hook re-asserts the path before each test (in case a test called `resetStatefulStoreForTesting`).
- Enables `mocha --parallel --jobs 4` for the CLI package.
Metric: pnpm run test:agent 5.2s → 4.5s (-13%). Cumulative: 40.2s → 4.5s (-89%).
0 commit comments