Skip to content

feat(valid-expect-with-promise): add checkThenables option for custom promises - #1996

Merged
G-Rath merged 2 commits into
jest-community:mainfrom
christopher-buss:fix/valid-expect-with-promise-thenables
Jul 24, 2026
Merged

G-Rath merged 2 commits into
jest-community:mainfrom
christopher-buss:fix/valid-expect-with-promise-thenables

Conversation

@christopher-buss

Copy link
Copy Markdown
Contributor

I am using a Promise not from the default lib therefore the rule does not fire. This PR removes the requirement for a Promise to be from the default library and instead falls back to checking if it's any thenable type.

@G-Rath G-Rath left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be an option like with no-floating-promises (which is the rule I used as a reference when implementing this), since not everything with a then is a promise.

For example, Cypress has a then function which is not a promise

@G-Rath

G-Rath commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

I would also suggest checking out their implementation, as I assume it's a good default in terms of what to check for

@christopher-buss
christopher-buss force-pushed the fix/valid-expect-with-promise-thenables branch from 3d22fbd to 2f540df Compare July 22, 2026 11:46
@christopher-buss

Copy link
Copy Markdown
Contributor Author

don't think the errors here are related to me from what I can tell

@christopher-buss
christopher-buss requested a review from G-Rath July 23, 2026 15:57
@G-Rath G-Rath changed the title fix(valid-expect-with-promise): support promise types not declared in default libs feat(valid-expect-with-promise): add checkThenables option for custom promises Jul 23, 2026

@G-Rath G-Rath left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@G-Rath
G-Rath merged commit 692c748 into jest-community:main Jul 24, 2026
46 of 48 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026
# [29.16.0](v29.15.5...v29.16.0) (2026-07-24)

### Features

* **valid-expect-with-promise:** add `checkThenables` option for custom promises ([#1996](#1996)) ([692c748](692c748))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 29.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@christopher-buss
christopher-buss deleted the fix/valid-expect-with-promise-thenables branch July 24, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants