-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
Large diffs on snapshots are not truncated #5073
Comments
Yes, it is!
Snapshots should show only changed lines, we use jest's diff display. Unless your whole snapshot is different, you shouldn't see it in full. |
The whole snapshot is different, yes. Perhaps this is a feature request then, rather than a bug, correct? |
I guess we can add an option to truncate diff patches somehow. It should be disabled by default though. |
I'd like to take a shot at this enhancement/feature. After tracing the codebase, I think we can add a configuration option in |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [vite-node](https://togithub.com/vitest-dev/vitest/blob/main/packages/vite-node#readme) ([source](https://togithub.com/vitest-dev/vitest/tree/HEAD/packages/vite-node)) | [`1.4.0` -> `1.5.0`](https://renovatebot.com/diffs/npm/vite-node/1.4.0/1.5.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/vite-node/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite-node/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite-node/1.4.0/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite-node/1.4.0/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>vitest-dev/vitest (vite-node)</summary> ### [`v1.5.0`](https://togithub.com/vitest-dev/vitest/releases/tag/v1.5.0) [Compare Source](https://togithub.com/vitest-dev/vitest/compare/v1.4.0...v1.5.0) ##### 🚀 Features - Add configuration for diff truncation - by [@​willieho](https://togithub.com/willieho) in [https://github.com/vitest-dev/vitest/issues/5073](https://togithub.com/vitest-dev/vitest/issues/5073) and [https://github.com/vitest-dev/vitest/issues/5333](https://togithub.com/vitest-dev/vitest/issues/5333) [<samp>(6797b)</samp>](https://togithub.com/vitest-dev/vitest/commit/6797b041) - Remove unrelated noise from diff for toMatchObject() - by [@​geersch](https://togithub.com/geersch) in [https://github.com/vitest-dev/vitest/issues/5364](https://togithub.com/vitest-dev/vitest/issues/5364) [<samp>(99276)</samp>](https://togithub.com/vitest-dev/vitest/commit/99276399) - Allow custom host for --inspect and --inspect-brk - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/5509](https://togithub.com/vitest-dev/vitest/issues/5509) [<samp>(61572)</samp>](https://togithub.com/vitest-dev/vitest/commit/6157282c) - **coverage**: V8 to ignore empty lines, comments, types - by [@​AriPerkkio](https://togithub.com/AriPerkkio) in [https://github.com/vitest-dev/vitest/issues/5457](https://togithub.com/vitest-dev/vitest/issues/5457) [<samp>(10b89)</samp>](https://togithub.com/vitest-dev/vitest/commit/10b89713) ##### 🐞 Bug Fixes - `describe` calls not taking generic type parameters - by [@​aryaemami59](https://togithub.com/aryaemami59) in [https://github.com/vitest-dev/vitest/issues/5415](https://togithub.com/vitest-dev/vitest/issues/5415) [<samp>(16bac)</samp>](https://togithub.com/vitest-dev/vitest/commit/16bacfab) - Prevent hang when `process` is mocked - by [@​AriPerkkio](https://togithub.com/AriPerkkio) in [https://github.com/vitest-dev/vitest/issues/5430](https://togithub.com/vitest-dev/vitest/issues/5430) [<samp>(0ec4d)</samp>](https://togithub.com/vitest-dev/vitest/commit/0ec4d0e0) - Don't check for "node:internal/console/" in console interceptor in case the environment is not Node.js - by [@​sheremet-va](https://togithub.com/sheremet-va) [<samp>(87d36)</samp>](https://togithub.com/vitest-dev/vitest/commit/87d36a7a) - The value received by toMatch should be a string - by [@​btea](https://togithub.com/btea) in [https://github.com/vitest-dev/vitest/issues/5428](https://togithub.com/vitest-dev/vitest/issues/5428) [<samp>(67485)</samp>](https://togithub.com/vitest-dev/vitest/commit/674851ca) - Increase stack trace limit for location, don't hardcode suite position - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/5518](https://togithub.com/vitest-dev/vitest/issues/5518) [<samp>(04b23)</samp>](https://togithub.com/vitest-dev/vitest/commit/04b234d1) - **benchmark**: - Run benchmark suites sequentially - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/5444](https://togithub.com/vitest-dev/vitest/issues/5444) [<samp>(1f548)</samp>](https://togithub.com/vitest-dev/vitest/commit/1f548340) - Fix benchmark summary of single bench suite - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/5489](https://togithub.com/vitest-dev/vitest/issues/5489) [<samp>(db981)</samp>](https://togithub.com/vitest-dev/vitest/commit/db98145f) - Table reporter for non TTY output - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/5484](https://togithub.com/vitest-dev/vitest/issues/5484) [<samp>(bea23)</samp>](https://togithub.com/vitest-dev/vitest/commit/bea234b1) - **expect**: - Fix `toHaveBeenNthCalledWith` error message when not called - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/5420](https://togithub.com/vitest-dev/vitest/issues/5420) [<samp>(e5253)</samp>](https://togithub.com/vitest-dev/vitest/commit/e5253de4) - **types**: - Pass correct type for suite factory - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/5437](https://togithub.com/vitest-dev/vitest/issues/5437) [<samp>(26718)</samp>](https://togithub.com/vitest-dev/vitest/commit/26718eb5) - **utils**: - Fix object diff with getter only property - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/5466](https://togithub.com/vitest-dev/vitest/issues/5466) [<samp>(366d9)</samp>](https://togithub.com/vitest-dev/vitest/commit/366d97c3) - **vite-node**: - Fix `isValidNodeImport` to check `"type": "module"` first - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/5416](https://togithub.com/vitest-dev/vitest/issues/5416) [<samp>(6fb15)</samp>](https://togithub.com/vitest-dev/vitest/commit/6fb15280) - **vitest**: - Correctly send console events when state changes - by [@​sheremet-va](https://togithub.com/sheremet-va) [<samp>(3463f)</samp>](https://togithub.com/vitest-dev/vitest/commit/3463f9bb) - Initiate FakeTimers on demand - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/5450](https://togithub.com/vitest-dev/vitest/issues/5450) [<samp>(e4e93)</samp>](https://togithub.com/vitest-dev/vitest/commit/e4e939ba) - Check unhighlighted code for code frame line limit - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/5465](https://togithub.com/vitest-dev/vitest/issues/5465) [<samp>(6ae7e)</samp>](https://togithub.com/vitest-dev/vitest/commit/6ae7eaa2) - Correctly filter by parent folder - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/5408](https://togithub.com/vitest-dev/vitest/issues/5408) [<samp>(91b06)</samp>](https://togithub.com/vitest-dev/vitest/commit/91b06cce) - Close inspector immediately if run is canceled - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/5519](https://togithub.com/vitest-dev/vitest/issues/5519) [<samp>(b8006)</samp>](https://togithub.com/vitest-dev/vitest/commit/b80062d7) - **workspace**: - Set CWD to config directory, allow overriding local .env - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/5476](https://togithub.com/vitest-dev/vitest/issues/5476) [<samp>(d4003)</samp>](https://togithub.com/vitest-dev/vitest/commit/d4003882) ##### [View changes on GitHub](https://togithub.com/vitest-dev/vitest/compare/v1.4.0...v1.5.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 5am every weekday" in timezone Europe/Berlin, Automerge - "after 10pm every weekday,before 5am every weekday" in timezone Europe/Berlin. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Never, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/solid-design-system/solid). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Describe the bug
I'm using
expect(result).toMatchSnapshot()
on a large array resulting in a 45.000 line snapshot.The issue is that it takes a very long time for the test runner to display the diff inside the terminal.
I was expecting the output to be truncated, using the default value of
chaiConfig.truncateThreshold
, but the full diff is printed instead.I've also tried using
chaiConfig: { showDiff: false }
which seems to have no effect.Reproduction
Is this really needed?
I've went searching through the issues, my hunch is that snapshot diffing works differently and it ignores
chaiConfig
.System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: