Skip to main content
Version: 1.x

Function: requireTestLocks()

requireTestLocks(): void

Asserts that the installed Playwright supports test locks.

Returns​

void

Remarks​

Call this at module scope in a spec that uses lock, so it fails at collection time rather than after the suite has already run unlocked.

Throws rather than degrading, per the policy in playwright-compat.ts: the 1.57 floor has no equivalent. fullyParallel: false is the nearest thing and is far blunter — it serialises an entire project rather than the handful of tests that touch one piece of shared state. Returning quietly would leave the caller believing they had mutual exclusion while the tests ran in parallel.

Throws​

PramanError with ERR_COMPAT_FEATURE_UNAVAILABLE below MIN_TEST_LOCKS_VERSION.

Example​

import { requireTestLocks, SAP_LOCKS } from 'playwright-praman';

requireTestLocks();

test('edits shared config', { lock: SAP_LOCKS.flpSettings }, async () => { ... });