Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Support for jest 27 #39

Open
ankrut opened this issue Aug 18, 2021 · 3 comments
Open

Support for jest 27 #39

ankrut opened this issue Aug 18, 2021 · 3 comments

Comments

@ankrut
Copy link

ankrut commented Aug 18, 2021

In Jest 27 the helper jest.addMatchers has been removed. Instead it is recommended to use expect.extend which is not compatible with jest-jquery-matchers. As far as I understand comperator can be simply removed to get proper matchers.

@unindented
Copy link
Owner

I don't currently use this library, but I'm open to PRs. Feel free to submit @ankrut!

I feel it should be similar to unindented/custom-immutable-matchers#44

@ankrut
Copy link
Author

ankrut commented Aug 19, 2021

Yes, the PR would be very similar to unindented/custom-immutable-matchers#44. Unfortunately, I am not able to run the project, i.e. npm install fails and so far no luck to fix it.

Therefore, I can provide a blind PR, and maybe you can try your luck assuming you know best how run it.

However, my workaround is to extract the compare functions. For example in a jest.setup.js file.

import * as matchers from 'jest-jquery-matchers'

const jqueryMatchers = {}

for (let key in matchers) {
    jqueryMatchers[key] = matchers[key]().compare
}

expect.extend(jqueryMatchers)

@unindented
Copy link
Owner

unindented commented Aug 19, 2021

Up to you. You can submit a PR, and if it looks good and it passes all the checks I'll merge it. Or you can do your workaround.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants