[Bug]: `.resolves.not` and `.rejects.not` pass when a promise settles the wrong way
Les mainteneurs répondent en général sous 1 jour
@microsoft-playwright-automation y travaille déjà.
Depuis le 24/11/2026.
- #44335 par @microsoft-playwright-automation — ouverte
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- javascript, node.js, typescript
- Domaine
- testing
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- TypeScript
- Étoiles
- 100k
- Forks
- 6.9k
- Merge moyen
- 16 h 18 min
- PR mergées (30 j)
- 281
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/playwright
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
microsoft/playwright#44340 ·
Les mainteneurs répondent en général sous 1 jour
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Peut-être pris @lazerg l’a pris il y a 2 jours. Ouverteagent-triage-done
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
microsoft/playwright#44289 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: expose per-project workers on FullProject for reportersPeut-être pris @microsoft-playwright-automation l’a pris aujourd’hui. Ouverteagent-triage-done
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
microsoft/playwright#44264 · 5 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: Test runner captures and source-maps stacks that it never usesPeut-être pris @microsoft-playwright-automation l’a pris aujourd’hui. Ouverteagent-triage-done
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
microsoft/playwright#44334 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: Skip PNG decode and diff when a screenshot matches its baseline byte for bytePeut-être pris @microsoft-playwright-automation l’a pris aujourd’hui. Ouverteagent-triage-done
Difficulté 2/5 1-3 heures Accessibilité débutants 30/100
microsoft/playwright#44333 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de microsoft/playwright
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
External sources always come back in English: `lc` isn't passed to `/api/v3/external_sources`Peut-être pris @Anurag1428 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
openfoodfacts/openfoodfacts-explorer#2264 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
cloudflare/workers-sdk#17139 ·
Les mainteneurs répondent en général sous 1 jour
-
area: editor P3 type: feature
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
halisonworks/mod-codeling#290 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
colinhacks/zod#6776 ·
Les mainteneurs répondent en général sous 1 jour