Skip to content

Commit

Permalink
feat: diff.printBasicPrototype: false by default
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 7, 2024
1 parent 3c18ecf commit 9d12a3e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2507,7 +2507,7 @@ Color of truncate annotation, default is output with no color.
#### diff.printBasicPrototype

- **Type**: `boolean`
- **Default**: `true`
- **Default**: `false`

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

Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/diff/normalizeDiffOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function getDefaultOptions(): DiffOptionsNormalized {
includeChangeCounts: false,
omitAnnotationLines: false,
patchColor: c.yellow,
printBasicPrototype: true,
printBasicPrototype: false,
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
truncateAnnotation: '... Diff result is truncated',
truncateAnnotationColor: noColor,
Expand Down
22 changes: 11 additions & 11 deletions test/core/test/__snapshots__/jest-expect.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports[`asymmetric matcher error 3`] = `
"diff": "- Expected
+ Received
Object {
{
- "foo": StringContaining "xx",
+ "foo": "hello",
}",
Expand All @@ -45,7 +45,7 @@ exports[`asymmetric matcher error 4`] = `
"diff": "- Expected
+ Received
Object {
{
- "foo": StringNotContaining "ll",
+ "foo": "hello",
}",
Expand Down Expand Up @@ -90,7 +90,7 @@ exports[`asymmetric matcher error 7`] = `
"diff": "- Expected
+ Received
Object {
{
- "foo": stringContainingCustom<xx>,
+ "foo": "hello",
}",
Expand All @@ -109,7 +109,7 @@ exports[`asymmetric matcher error 8`] = `
"diff": "- Expected
+ Received
Object {
{
- "foo": not.stringContainingCustom<ll>,
+ "foo": "hello",
}",
Expand Down Expand Up @@ -161,7 +161,7 @@ exports[`asymmetric matcher error 12`] = `
+ Received
- ObjectContaining {
+ Object {
+ {
"k": "v",
- "k3": "v3",
+ "k2": "v2",
Expand All @@ -184,7 +184,7 @@ exports[`asymmetric matcher error 13`] = `
+ Received
- ArrayContaining [
+ Array [
+ [
"a",
- "c",
+ "b",
Expand Down Expand Up @@ -333,7 +333,7 @@ exports[`diff 2`] = `
false
+ Received:
Object {
{
"hello": "world",
}",
"expected": "false",
Expand All @@ -350,7 +350,7 @@ exports[`diff 3`] = `
NaN
+ Received:
Object {
{
"hello": "world",
}",
"expected": "NaN",
Expand All @@ -367,7 +367,7 @@ exports[`diff 4`] = `
undefined
+ Received:
Object {
{
"hello": "world",
}",
"expected": "undefined",
Expand All @@ -384,7 +384,7 @@ exports[`diff 5`] = `
null
+ Received:
Object {
{
"hello": "world",
}",
"expected": "null",
Expand All @@ -400,7 +400,7 @@ exports[`toHaveBeenNthCalledWith error 1`] = `
"diff": "- Expected
+ Received
Array [
[
- "hey",
+ "Hi",
]",
Expand Down
6 changes: 3 additions & 3 deletions test/core/test/__snapshots__/mocked.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ Received:
1st spy call return:
Object {
{
- "a": "4",
+ "a": "1",
}
2nd spy call return:
Object {
{
- "a": "4",
+ "a": "1",
}
3rd spy call return:
Object {
{
- "a": "4",
+ "a": "1",
}
Expand Down
28 changes: 14 additions & 14 deletions test/core/test/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('displays object diff', () => {
- Expected
+ Received
Object {
{
"a": 1,
- "b": 2,
+ "b": 3,
Expand All @@ -47,7 +47,7 @@ test('display truncated object diff', () => {
- Expected
+ Received
Object {
{
"a": 1,
- "b": 2,
- "c": 3,
Expand Down Expand Up @@ -137,7 +137,7 @@ test('display truncated multiple items array diff', () => {
- Expected
+ Received
Array [
[
- "foo",
- "foo",
+ "bar",
Expand All @@ -152,7 +152,7 @@ test('asymmetric matcher in object', () => {
"- Expected
+ Received
Object {
{
- "x": 1,
+ "x": 0,
"y": Anything,
Expand All @@ -171,7 +171,7 @@ test('asymmetric matcher in object with truncated diff', () => {
"- Expected
+ Received
Object {
{
"w": Anything,
- "x": 1,
+ "x": 0,
Expand All @@ -184,7 +184,7 @@ test('asymmetric matcher in array', () => {
"- Expected
+ Received
Array [
[
- 1,
+ 0,
Anything,
Expand All @@ -203,7 +203,7 @@ test('asymmetric matcher in array with truncated diff', () => {
"- Expected
+ Received
Array [
[
- 1,
+ 0,
... Diff result is truncated"
Expand All @@ -220,13 +220,13 @@ test('asymmetric matcher in nested', () => {
"- Expected
+ Received
Array [
Object {
[
{
- "x": 1,
+ "x": 0,
"y": Anything,
},
Array [
[
- 1,
+ 0,
Anything,
Expand All @@ -246,8 +246,8 @@ test('asymmetric matcher in nested with truncated diff', () => {
"- Expected
+ Received
Array [
Object {
[
{
- "x": 1,
+ "x": 0,
"y": Anything,
Expand Down Expand Up @@ -321,8 +321,8 @@ test('getter only property', () => {
"- Expected
+ Received
Object {
"getOnlyProp": Object {
{
"getOnlyProp": {
"a": "b",
},
- "normalProp": 2,
Expand Down
34 changes: 17 additions & 17 deletions test/core/test/jest-expect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ it('correctly prints diff with asymmetric matchers', () => {
"- Expected
+ Received
Object {
{
"a": Any<Number>,
- "b": Any<Function>,
+ "b": "string",
Expand Down Expand Up @@ -1173,7 +1173,7 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
{
- "c": 4,
+ "c": 3,
}",
Expand All @@ -1188,7 +1188,7 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
{
- "b": 3,
+ "b": 2,
}",
Expand All @@ -1203,8 +1203,8 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
"c": Object {
{
"c": {
- "d": 5,
+ "d": 4,
},
Expand All @@ -1219,7 +1219,7 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
{
"a": 1,
"b": 2,
- "c": 4,
Expand All @@ -1236,9 +1236,9 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
{
"a": 1,
"c": Object {
"c": {
- "d": 4,
+ "d": 3,
},
Expand All @@ -1254,12 +1254,12 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
"c": Object {
{
"c": {
- "d": 5,
+ "d": 4,
},
"foo": Object {
"foo": {
- "value": "biz",
+ "value": "bar",
},
Expand All @@ -1276,9 +1276,9 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
"children": Array [
Object {
{
"children": [
{
- "firstName": "Paul",
+ "firstName": "Jessica",
},
Expand Down Expand Up @@ -1322,7 +1322,7 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
- Object {
- {
- "value": 1,
+ Foo {
+ "value": 0,
Expand All @@ -1338,7 +1338,7 @@ it('toMatchObject error diff', () => {
- Bar {
- "value": 1,
+ Object {
+ {
+ "value": 0,
}",
]
Expand All @@ -1358,7 +1358,7 @@ it('toMatchObject error diff', () => {
"- Expected
+ Received
Object {
{
- "bad": Bar {
- "value": 2,
+ "bad": Foo {
Expand Down

0 comments on commit 9d12a3e

Please sign in to comment.