We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toIncludeSameMembers
Currently, if you have a test like this:
it('example', () => { const expected = Array.from({ length: 1000 }, (_, i) => ({ i, value: 'expected' })); const actual = [...expected]; const tmp = actual[200]; actual[200] = actual[201]; actual[201] = { ...tmp, value: 'hope you find me' }; expect(actual).toIncludeSameMembers(expected); });
You will get an error like this:
expect(received).toIncludeSameMembers(expected) Expected list to have the following members and no more: [{"i": 0, "value": "expected"}, {"i": 1, "value": "expected"}, {"i": 2, "value": "expected"}, {"i": 3, "value": "expected"}, {"i": 4, "value": "expected"}, {"i": 5, "value": "expected"}, {"i": 6, "value": "expected"}, {"i": 7, "value": "expected"}, {"i": 8, "value": "expected"}, {"i": 9, "value": "expected"}, …] Received: [{"i": 0, "value": "expected"}, {"i": 1, "value": "expected"}, {"i": 2, "value": "expected"}, {"i": 3, "value": "expected"}, {"i": 4, "value": "expected"}, {"i": 5, "value": "expected"}, {"i": 6, "value": "expected"}, {"i": 7, "value": "expected"}, {"i": 8, "value": "expected"}, {"i": 9, "value": "expected"}, …] 410 | actual[201] = { ...tmp, value: 'hope you find me' }; 411 | > 412 | expect(actual).toIncludeSameMembers(expected); | ^ 413 | });
which is very hard to understand so I would like to get something like this:
expect(received).toIncludeSameMembers(expected) - Expected - 1 + Received + 1 @@ -799,11 +799,11 @@ "i": 199, "value": "expected", }, Object { "i": 200, - "value": "expected", + "value": "hope you find me", }, Object { "i": 201, "value": "expected", }, 410 | actual[201] = { ...tmp, value: 'hope you find me' }; 411 | > 412 | expect(actual).toIncludeSameMembers(expected); | ^ 413 | });
version: 3.2.4
The text was updated successfully, but these errors were encountered:
includeSameMembers
Until and if the related PR gets merged I created an npm package with that matcher and the better output: https://github.com/rluvaton/expect-matchers
Sorry, something went wrong.
+100. Please address this.
@rluvaton Your repo works great, thanks!
No branches or pull requests
Currently, if you have a test like this:
You will get an error like this:
Error as text
which is very hard to understand so I would like to get something like this:
Error as text
version: 3.2.4
The text was updated successfully, but these errors were encountered: