eslint-plugin-testing-library icon indicating copy to clipboard operation
eslint-plugin-testing-library copied to clipboard

feat(await-async-query,await-async-utils,await-fire-event): support handling promises with `jest-extended`'s `.toResolve` & `.toRejects`

Open NickBolles opened this issue 3 years ago • 7 comments

Checks

  • [x] I have read the contributing guidelines.
  • [x] If some rule is added/updated/removed, I've regenerated the rules list (npm run generate:rules-list)
  • [x] If some rule meta info is changed, I've regenerated the plugin shared configs (npm run generate:configs)

Changes

Add support for marking usage of jest-extendeds toResolve and toReject (docs) as valid handling of promises.

Context

NickBolles avatar Jul 24 '22 03:07 NickBolles

This ESLint plugin is only about @testing-library testing frameworks. If you want to have linting for jest & jest-extended, you should have a look at eslint-plugin-jest & eslint-plugin-jest-extended

MichaelDeBoey avatar Jul 24 '22 13:07 MichaelDeBoey

@MichaelDeBoey Can we rethink this? I would say this is a legit update for the rule. Such matchers can't be extended for the rule in eslint-plugin-jest or eslint-plugin-jest-extended. Since the matchers mentioned in this PR belong to jest, and the rule is tied to jest, I would say this is a valid case and should be merged.

Belco90 avatar Jul 29 '22 16:07 Belco90

Reading the rule README again, I think I misunderstood what @NickBolles was trying to do.

I indeed think this has a place in our plugin! 👍

MichaelDeBoey avatar Aug 08 '22 13:08 MichaelDeBoey

@MichaelDeBoey Great! I'll review this later.

Belco90 avatar Aug 08 '22 14:08 Belco90

@Belco90 updated! (with a copy/paste accident in the message for d1cba9c :( )

NickBolles avatar Aug 08 '22 19:08 NickBolles

@NickBolles Could you please also add tests for all these rules?

Good catch, I missed this!

Belco90 avatar Aug 08 '22 19:08 Belco90

@NickBolles Just a reminder you have some CI checks to fix!

Belco90 avatar Aug 18 '22 19:08 Belco90

@Belco90 sorry about such the delay on this. I've added tests for await-async-utils and await-fire-event, merged the latest from main and fixed the format issues.

NickBolles avatar Oct 20 '22 18:10 NickBolles

:tada: This PR is included in version 5.9.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Oct 20 '22 19:10 github-actions[bot]

@all-contributors please add @NickBolles for code,test, and doc

Belco90 avatar Oct 20 '22 19:10 Belco90

@Belco90

I've put up a pull request to add @NickBolles! :tada:

allcontributors[bot] avatar Oct 20 '22 19:10 allcontributors[bot]

:tada: This PR is included in version 6.0.0-alpha.14 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Dec 20 '22 12:12 github-actions[bot]