Skip to content

Conversation

@Anemy
Copy link
Member

@Anemy Anemy commented Nov 19, 2025

COMPASS-10060

Description

Adds an eslint plugin packages to configs.

It then adds an eslint rule to the plugin,no-expect-method-without-call which will lint error when a chai expect is used with a method assertion and the method is not called. An example of something that would throw:

expect("pineapple").to.include

This is because include is intended to be called. We're making this change as we had a lot of .throw / .throws uses in Compass which weren't testing anything.

Adding this in devtools instead of Compass as we'll get some value in all of our tools - mongosh also has an occurence of .throw; Thanks Anna for the suggestion!

In a follow up I'll add anther rule intended to catch passing async methods to these assertions which don't handle promises.

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.

2 participants