Don't expand large diffs by default
Clear and concise description of the problem
Calling toEqual on large objects generates a very large diff error difficult to understand and often cut by the max terminal output length, this can be prevented by passing expand: false to the diff function
Suggested solution
Pass expand: false for large objects and strings
Alternative
Add an expand option in the vitest configuration or always use expand false
Additional context
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
what is the supposed workaround right now? killing my productivity right now. cant see which tests are failing and passing
You can pass down your own diff config - https://vitest.dev/config/#diff
We decided to allow objects in the diff property (it has expand). The documentation should also contain more information about available diff fields.
When it's an object, you can use --diff.expand=false flag or set diff.expand to false in the config:
export default defineConfig({
test: {
diff: {
expand: false,
},
},
})