[Feature]: Declare a lock for the enclosing suite with `test.describe.configure({ lock })`

Open Beginner friendly
#42,782 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
testing

Research direction

Start at test.describe.configure(), which already handles mode, retries, and timeout, and compare its collection-time path with lock handling in test() and titled test.describe(). Add coverage for test.describe.configure({ lock: 'stripe' }) so the enclosing suite receives the lock and the lock remains scoped to the configured group.

Written by the indexing model from the issue text.

Description

🚀 Feature Request

Locks (1.63) can be declared in the details of test() and of a titled test.describe(). There is no way to declare one imperatively for the suite that is currently loading.

test.describe.configure() already configures the enclosing suite at collection time with mode, retries and timeout. Accepting lock there would cover this with no new API surface.

It composes with a describe-scoped test.use, so the lock covers only that group. This is not a request for shared or exclusive modes (#42594) or typed names (#42593).

Example
test.describe.configure({ lock: 'stripe' });
Motivation

Our tests select a seed with test.use({ seed }). Some seeds attach a shared live third-party account, and those tests must not run concurrently. The seed is the single fact; the lock follows from it. We wrap test.use so that a seed needing the shared account also takes the lock. Today the only way to do that is to reach into currentlyLoadingFileSuite()._locks.

Dominant language
TypeScript
Stars
96.4k
Forks
6.5k
Avg merge
1d 7h
Merged PRs (30d)
181

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/playwright

All issues in microsoft/playwright

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.