[Bug]: `.resolves.not` and `.rejects.not` pass when a promise settles the wrong way

オープン
#44,331 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@microsoft-playwright-automation がすでに取り組んでいます。

2026年11月24日 から。

  • #44335 @microsoft-playwright-automation による — オープン

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, node.js, typescript
領域
testing

調査の方向性

Start by running the two-test reproduction repo; it shows the two assertions that wrongly pass. Since this is a regression between 1.56.1 and 1.64.1, bisect Playwright tags in that range to find the commit that changed how .resolves/.rejects handle a promise settling the wrong way, then read the matcher code around that diff. Done means both assertions fail with the usual 'Received promise rejected instead of resolved' and 'Received promise resolved instead of rejected' errors, the matching tests under the package's test directory pass, and .not still negates only the matcher.

索引モデルが issue の本文から書いたものです。

説明

agent-triage-done
Version

1.65.1

Steps to reproduce

Clone the two-test reproduction, then run npm install and npm test. No browser installation is needed.

The two assertions are in separate tests:

await expect(Promise.reject(new Error('request failed'))).resolves.not.toBe('cached');
await expect(Promise.resolve('saved')).rejects.not.toThrow('timeout');
Expected behavior

Both tests should fail. The first promise rejects, so .resolves has no value to compare. The second fulfills, so .rejects has no rejection reason to match. Adding .not should only negate the matcher after the promise settles the expected way. This follows the documented behavior of .resolves and .rejects.

Actual behavior

The runner reports 2 passed and exits with status 0. Removing only .not from both assertions produces the expected errors: Received promise rejected instead of resolved and Received promise resolved instead of rejected.

Additional context

The same two tests fail as expected on 1.56.1. Both pass on 1.64.1, 1.65.1, and 1.66.0-alpha-2026-11-23.

Environment
OS: Debian GNU/Linux 13 (trixie), x64, Linux 6.18
Node.js: 24.22.3
npm: 11.19.1
@playwright/test: 1.65.1
主要言語
TypeScript
スター
100k
フォーク
6.9k
平均マージ
16時間 18分
マージ済み PR(30日)
281

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/playwright のほかの issue

microsoft/playwright の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。