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
If you run this test.
describe('diff test', () => { it('should compare 2 objects', () => { const a = { a: 1, b: 2, c: { d: 4 } }; const b = { b: 3 }; expect(a).toMatchObject(b); }); });
You get the following output.
It would be clearer if it would strip properties that are not relevant. For example, see getObjectSubset in @jest/expect-utils.
getObjectSubset
@jest/expect-utils
After patching the processError function (@vitest/utils) locally.
processError
@vitest/utils
export function processError(err: any, diffOptions?: DiffOptions) { ... if (err.showDiff || (err.showDiff === undefined && err.expected !== undefined && err.actual !== undefined)) { ... const actualSubset = getObjectSubset(replacedActual, replacedExpected); err.actual = actualSubset; err.diff = diff(replacedExpected, actualSubset, { ...diffOptions, ...err.diffOptions }); ... } ... }
I get this output instead.
Which makes it a lot easier to spot the difference.
The output with the VSCode plugin looks like this now.
Perhaps it would be useful to also add this into Vitest?
Extract a subset of properties from the actual and report that as output.
No response
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Clear and concise description of the problem
If you run this test.
You get the following output.
It would be clearer if it would strip properties that are not relevant. For example, see
getObjectSubset
in@jest/expect-utils
.getObjectSubset
After patching the
processError
function (@vitest/utils
) locally.I get this output instead.
Which makes it a lot easier to spot the difference.
The output with the VSCode plugin looks like this now.
Perhaps it would be useful to also add this into Vitest?
Suggested solution
Extract a subset of properties from the actual and report that as output.
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: