Skip to content

Commit f342065

Browse files
authored
fix: set diff.expand: false as default (#7697)
1 parent 5659a0e commit f342065

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

packages/utils/src/diff/normalizeDiffOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function getDefaultOptions(): DiffOptionsNormalized {
3030
compareKeys: undefined,
3131
contextLines: DIFF_CONTEXT_DEFAULT,
3232
emptyFirstOrLastLinePlaceholder: '',
33-
expand: true,
33+
expand: false,
3434
includeChangeCounts: false,
3535
omitAnnotationLines: false,
3636
patchColor: c.yellow,

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`inline diff options: { expand: false, printBasicPrototype: true } 1`] = `
3+
exports[`inline diff options: { expand: true } 1`] = `
44
[
55
"- Expected
66
+ Received
77
8-
@@ -1,7 +1,7 @@
9-
Array [
8+
[
109
- 1000,
1110
+ 0,
1211
1,
1312
2,
1413
3,
1514
4,
1615
5,
17-
@@ -12,11 +12,11 @@
16+
6,
17+
7,
18+
8,
19+
9,
1820
10,
1921
11,
2022
12,
@@ -27,7 +29,9 @@ exports[`inline diff options: { expand: false, printBasicPrototype: true } 1`] =
2729
18,
2830
19,
2931
20,
30-
@@ -26,7 +26,7 @@
32+
21,
33+
22,
34+
23,
3135
24,
3236
25,
3337
26,
@@ -39,37 +43,35 @@ exports[`inline diff options: { expand: false, printBasicPrototype: true } 1`] =
3943
"- Expected
4044
+ Received
4145
42-
Object {
43-
"arr": Array [
46+
{
47+
"arr": [
4448
1,
4549
- 3,
4650
+ 2,
4751
],
48-
"obj": Object {
52+
"obj": {
4953
- "k": "bar",
5054
+ "k": "foo",
5155
},
5256
}",
5357
]
5458
`;
5559

56-
exports[`inline diff options: undefined 1`] = `
60+
exports[`inline diff options: { printBasicPrototype: true } 1`] = `
5761
[
5862
"- Expected
5963
+ Received
6064
61-
[
65+
@@ -1,7 +1,7 @@
66+
Array [
6267
- 1000,
6368
+ 0,
6469
1,
6570
2,
6671
3,
6772
4,
6873
5,
69-
6,
70-
7,
71-
8,
72-
9,
74+
@@ -12,11 +12,11 @@
7375
10,
7476
11,
7577
12,
@@ -82,9 +84,7 @@ exports[`inline diff options: undefined 1`] = `
8284
18,
8385
19,
8486
20,
85-
21,
86-
22,
87-
23,
87+
@@ -26,7 +26,7 @@
8888
24,
8989
25,
9090
26,
@@ -96,13 +96,13 @@ exports[`inline diff options: undefined 1`] = `
9696
"- Expected
9797
+ Received
9898
99-
{
100-
"arr": [
99+
Object {
100+
"arr": Array [
101101
1,
102102
- 3,
103103
+ 2,
104104
],
105-
"obj": {
105+
"obj": Object {
106106
- "k": "bar",
107107
+ "k": "foo",
108108
},

test/config/test/diff.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { expect, test } from 'vitest'
33
import { runVitest } from '../../test-utils'
44

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ function snapshotError(f: () => unknown) {
16181618
f()
16191619
}
16201620
catch (error) {
1621-
const e = processError(error)
1621+
const e = processError(error, { expand: true })
16221622
expect({
16231623
message: stripVTControlCharacters(e.message),
16241624
diff: e.diff ? stripVTControlCharacters(e.diff) : e.diff,

0 commit comments

Comments
 (0)