Skip to content

fix(test): clarify error for test() after await in async describe#41145

Open
yury-s wants to merge 3 commits into
microsoft:mainfrom
yury-s:fix-41132
Open

fix(test): clarify error for test() after await in async describe#41145
yury-s wants to merge 3 commits into
microsoft:mainfrom
yury-s:fix-41132

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented Jun 4, 2026

Summary

  • test() calls made after an await in an async test.describe() callback run after test collection has finished, producing the misleading "Playwright Test did not expect test() to be called here" error.
  • Add an explicit reason to that error covering this case, with a hint to declare tests before any await or move async work into a hook.

Fixes #41132

When a test.describe() callback awaits before declaring tests, collection
has already finished and test() throws the generic "did not expect test()
to be called here" error, which is misleading. Add an explicit reason
covering this case.

Fixes: microsoft#41132
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread packages/playwright/src/common/testType.ts Outdated
yury-s added 2 commits June 4, 2026 15:03
Use a stricter, single-line reason: async test.describe() blocks are
not supported, only sync ones.
Pin the message to the call that failed and keep it consistent with the
other reasons in the list.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Test results for "MCP"

1 failed
❌ [firefox] › mcp/http.spec.ts:103 › http transport browser lifecycle (isolated) @mcp-ubuntu-latest-firefox

7229 passed, 1103 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Test results for "tests 1"

4 flaky ⚠️ [chromium-library] › library/video.spec.ts:682 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-page] › page/workers.spec.ts:190 › should attribute network activity for worker inside iframe to the iframe `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:476 › screencast › should capture static page in persistent context @smoke `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`

39553 passed, 771 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: async import breaks test in CJS

2 participants