Skip to content

Commit 2b5c520

Browse files
authoredDec 9, 2024··
feat: diff.printBasicPrototype: false by default (#7043)
1 parent 4f718a2 commit 2b5c520

File tree

9 files changed

+58
-58
lines changed

9 files changed

+58
-58
lines changed
 

‎docs/config/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,7 @@ Color of truncate annotation, default is output with no color.
25072507
#### diff.printBasicPrototype
25082508

25092509
- **Type**: `boolean`
2510-
- **Default**: `true`
2510+
- **Default**: `false`
25112511

25122512
Print basic prototype `Object` and `Array` in diff output
25132513

‎packages/utils/src/diff/normalizeDiffOptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function getDefaultOptions(): DiffOptionsNormalized {
3434
includeChangeCounts: false,
3535
omitAnnotationLines: false,
3636
patchColor: c.yellow,
37-
printBasicPrototype: true,
37+
printBasicPrototype: false,
3838
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
3939
truncateAnnotation: '... Diff result is truncated',
4040
truncateAnnotationColor: noColor,

‎test/config/test/__snapshots__/diff.test.ts.snap

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`inline diff options: { expand: false, printBasicPrototype: false } 1`] = `
3+
exports[`inline diff options: { expand: false, printBasicPrototype: true } 1`] = `
44
[
55
"- Expected
66
+ Received
77
88
@@ -1,7 +1,7 @@
9-
[
9+
Array [
1010
- 1000,
1111
+ 0,
1212
1,
@@ -39,13 +39,13 @@ exports[`inline diff options: { expand: false, printBasicPrototype: false } 1`]
3939
"- Expected
4040
+ Received
4141
42-
{
43-
"arr": [
42+
Object {
43+
"arr": Array [
4444
1,
4545
- 3,
4646
+ 2,
4747
],
48-
"obj": {
48+
"obj": Object {
4949
- "k": "bar",
5050
+ "k": "foo",
5151
},
@@ -58,7 +58,7 @@ exports[`inline diff options: undefined 1`] = `
5858
"- Expected
5959
+ Received
6060
61-
Array [
61+
[
6262
- 1000,
6363
+ 0,
6464
1,
@@ -96,13 +96,13 @@ exports[`inline diff options: undefined 1`] = `
9696
"- Expected
9797
+ Received
9898
99-
Object {
100-
"arr": Array [
99+
{
100+
"arr": [
101101
1,
102102
- 3,
103103
+ 2,
104104
],
105-
"obj": Object {
105+
"obj": {
106106
- "k": "bar",
107107
+ "k": "foo",
108108
},

‎test/config/test/diff.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { runVitest } from '../../test-utils'
44

55
test.for([
66
[undefined],
7-
[{ expand: false, printBasicPrototype: false }],
7+
[{ expand: false, printBasicPrototype: true }],
88
])(`inline diff options: %o`, async ([options]) => {
99
const { ctx } = await runVitest({
1010
root: './fixtures/diff',

‎test/core/test/__snapshots__/jest-expect.test.ts.snap

+11-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exports[`asymmetric matcher error 3`] = `
2626
"diff": "- Expected
2727
+ Received
2828
29-
Object {
29+
{
3030
- "foo": StringContaining "xx",
3131
+ "foo": "hello",
3232
}",
@@ -45,7 +45,7 @@ exports[`asymmetric matcher error 4`] = `
4545
"diff": "- Expected
4646
+ Received
4747
48-
Object {
48+
{
4949
- "foo": StringNotContaining "ll",
5050
+ "foo": "hello",
5151
}",
@@ -90,7 +90,7 @@ exports[`asymmetric matcher error 7`] = `
9090
"diff": "- Expected
9191
+ Received
9292
93-
Object {
93+
{
9494
- "foo": stringContainingCustom<xx>,
9595
+ "foo": "hello",
9696
}",
@@ -109,7 +109,7 @@ exports[`asymmetric matcher error 8`] = `
109109
"diff": "- Expected
110110
+ Received
111111
112-
Object {
112+
{
113113
- "foo": not.stringContainingCustom<ll>,
114114
+ "foo": "hello",
115115
}",
@@ -161,7 +161,7 @@ exports[`asymmetric matcher error 12`] = `
161161
+ Received
162162
163163
- ObjectContaining {
164-
+ Object {
164+
+ {
165165
"k": "v",
166166
- "k3": "v3",
167167
+ "k2": "v2",
@@ -184,7 +184,7 @@ exports[`asymmetric matcher error 13`] = `
184184
+ Received
185185
186186
- ArrayContaining [
187-
+ Array [
187+
+ [
188188
"a",
189189
- "c",
190190
+ "b",
@@ -333,7 +333,7 @@ exports[`diff 2`] = `
333333
false
334334
335335
+ Received:
336-
Object {
336+
{
337337
"hello": "world",
338338
}",
339339
"expected": "false",
@@ -350,7 +350,7 @@ exports[`diff 3`] = `
350350
NaN
351351
352352
+ Received:
353-
Object {
353+
{
354354
"hello": "world",
355355
}",
356356
"expected": "NaN",
@@ -367,7 +367,7 @@ exports[`diff 4`] = `
367367
undefined
368368
369369
+ Received:
370-
Object {
370+
{
371371
"hello": "world",
372372
}",
373373
"expected": "undefined",
@@ -384,7 +384,7 @@ exports[`diff 5`] = `
384384
null
385385
386386
+ Received:
387-
Object {
387+
{
388388
"hello": "world",
389389
}",
390390
"expected": "null",
@@ -400,7 +400,7 @@ exports[`toHaveBeenNthCalledWith error 1`] = `
400400
"diff": "- Expected
401401
+ Received
402402
403-
Array [
403+
[
404404
- "hey",
405405
+ "Hi",
406406
]",

‎test/core/test/__snapshots__/mocked.test.ts.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ Received:
4747
4848
1st spy call return:
4949
50-
Object {
50+
{
5151
- "a": "4",
5252
+ "a": "1",
5353
}
5454
5555
2nd spy call return:
5656
57-
Object {
57+
{
5858
- "a": "4",
5959
+ "a": "1",
6060
}
6161
6262
3rd spy call return:
6363
64-
Object {
64+
{
6565
- "a": "4",
6666
+ "a": "1",
6767
}

‎test/core/test/diff.test.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test('displays object diff', () => {
2828
- Expected
2929
+ Received
3030
31-
Object {
31+
{
3232
"a": 1,
3333
- "b": 2,
3434
+ "b": 3,
@@ -47,7 +47,7 @@ test('display truncated object diff', () => {
4747
- Expected
4848
+ Received
4949
50-
Object {
50+
{
5151
"a": 1,
5252
- "b": 2,
5353
- "c": 3,
@@ -137,7 +137,7 @@ test('display truncated multiple items array diff', () => {
137137
- Expected
138138
+ Received
139139
140-
Array [
140+
[
141141
- "foo",
142142
- "foo",
143143
+ "bar",
@@ -152,7 +152,7 @@ test('asymmetric matcher in object', () => {
152152
"- Expected
153153
+ Received
154154
155-
Object {
155+
{
156156
- "x": 1,
157157
+ "x": 0,
158158
"y": Anything,
@@ -171,7 +171,7 @@ test('asymmetric matcher in object with truncated diff', () => {
171171
"- Expected
172172
+ Received
173173
174-
Object {
174+
{
175175
"w": Anything,
176176
- "x": 1,
177177
+ "x": 0,
@@ -184,7 +184,7 @@ test('asymmetric matcher in array', () => {
184184
"- Expected
185185
+ Received
186186
187-
Array [
187+
[
188188
- 1,
189189
+ 0,
190190
Anything,
@@ -203,7 +203,7 @@ test('asymmetric matcher in array with truncated diff', () => {
203203
"- Expected
204204
+ Received
205205
206-
Array [
206+
[
207207
- 1,
208208
+ 0,
209209
... Diff result is truncated"
@@ -220,13 +220,13 @@ test('asymmetric matcher in nested', () => {
220220
"- Expected
221221
+ Received
222222
223-
Array [
224-
Object {
223+
[
224+
{
225225
- "x": 1,
226226
+ "x": 0,
227227
"y": Anything,
228228
},
229-
Array [
229+
[
230230
- 1,
231231
+ 0,
232232
Anything,
@@ -246,8 +246,8 @@ test('asymmetric matcher in nested with truncated diff', () => {
246246
"- Expected
247247
+ Received
248248
249-
Array [
250-
Object {
249+
[
250+
{
251251
- "x": 1,
252252
+ "x": 0,
253253
"y": Anything,
@@ -321,8 +321,8 @@ test('getter only property', () => {
321321
"- Expected
322322
+ Received
323323
324-
Object {
325-
"getOnlyProp": Object {
324+
{
325+
"getOnlyProp": {
326326
"a": "b",
327327
},
328328
- "normalProp": 2,

‎test/core/test/jest-expect.test.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ it('correctly prints diff with asymmetric matchers', () => {
11391139
"- Expected
11401140
+ Received
11411141
1142-
Object {
1142+
{
11431143
"a": Any<Number>,
11441144
- "b": Any<Function>,
11451145
+ "b": "string",
@@ -1173,7 +1173,7 @@ it('toMatchObject error diff', () => {
11731173
"- Expected
11741174
+ Received
11751175
1176-
Object {
1176+
{
11771177
- "c": 4,
11781178
+ "c": 3,
11791179
}",
@@ -1188,7 +1188,7 @@ it('toMatchObject error diff', () => {
11881188
"- Expected
11891189
+ Received
11901190
1191-
Object {
1191+
{
11921192
- "b": 3,
11931193
+ "b": 2,
11941194
}",
@@ -1203,8 +1203,8 @@ it('toMatchObject error diff', () => {
12031203
"- Expected
12041204
+ Received
12051205
1206-
Object {
1207-
"c": Object {
1206+
{
1207+
"c": {
12081208
- "d": 5,
12091209
+ "d": 4,
12101210
},
@@ -1219,7 +1219,7 @@ it('toMatchObject error diff', () => {
12191219
"- Expected
12201220
+ Received
12211221
1222-
Object {
1222+
{
12231223
"a": 1,
12241224
"b": 2,
12251225
- "c": 4,
@@ -1236,9 +1236,9 @@ it('toMatchObject error diff', () => {
12361236
"- Expected
12371237
+ Received
12381238
1239-
Object {
1239+
{
12401240
"a": 1,
1241-
"c": Object {
1241+
"c": {
12421242
- "d": 4,
12431243
+ "d": 3,
12441244
},
@@ -1254,12 +1254,12 @@ it('toMatchObject error diff', () => {
12541254
"- Expected
12551255
+ Received
12561256
1257-
Object {
1258-
"c": Object {
1257+
{
1258+
"c": {
12591259
- "d": 5,
12601260
+ "d": 4,
12611261
},
1262-
"foo": Object {
1262+
"foo": {
12631263
- "value": "biz",
12641264
+ "value": "bar",
12651265
},
@@ -1276,9 +1276,9 @@ it('toMatchObject error diff', () => {
12761276
"- Expected
12771277
+ Received
12781278
1279-
Object {
1280-
"children": Array [
1281-
Object {
1279+
{
1280+
"children": [
1281+
{
12821282
- "firstName": "Paul",
12831283
+ "firstName": "Jessica",
12841284
},
@@ -1322,7 +1322,7 @@ it('toMatchObject error diff', () => {
13221322
"- Expected
13231323
+ Received
13241324
1325-
- Object {
1325+
- {
13261326
- "value": 1,
13271327
+ Foo {
13281328
+ "value": 0,
@@ -1338,7 +1338,7 @@ it('toMatchObject error diff', () => {
13381338
13391339
- Bar {
13401340
- "value": 1,
1341-
+ Object {
1341+
+ {
13421342
+ "value": 0,
13431343
}",
13441344
]
@@ -1358,7 +1358,7 @@ it('toMatchObject error diff', () => {
13581358
"- Expected
13591359
+ Received
13601360
1361-
Object {
1361+
{
13621362
- "bad": Bar {
13631363
- "value": 2,
13641364
+ "bad": Foo {

‎test/reporters/tests/__snapshots__/junit.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ AssertionError: expected { hello: &apos;x&apos; } to deeply equal { hello: &apos
7878
- Expected
7979
+ Received
8080
81-
Object {
81+
{
8282
- &quot;hello&quot;: &quot;y&quot;,
8383
+ &quot;hello&quot;: &quot;x&quot;,
8484
}

0 commit comments

Comments
 (0)
Please sign in to comment.