Skip to content

Commit 2b5c520

Browse files
authored
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 9 additions & 9 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 11 additions & 11 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 14 additions & 14 deletions
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,

0 commit comments

Comments
 (0)