@@ -1976,7 +1976,7 @@ describe('DiffParser', () => {
1976
1976
` ) ;
1977
1977
} ) ;
1978
1978
1979
- it ( 'should stop parsing file and mark it as `isTooBig` if `diffMaxChanges` is set and excedeed' , ( ) => {
1979
+ it ( 'should work when `diffMaxChanges` is set and excedeed' , ( ) => {
1980
1980
const diff =
1981
1981
'diff --git a/src/core/init.js b/src/core/init.js\n' +
1982
1982
'index e49196a..50f310c 100644\n' +
@@ -2006,50 +2006,132 @@ describe('DiffParser', () => {
2006
2006
expect ( result ) . toMatchInlineSnapshot ( `
2007
2007
Array [
2008
2008
Object {
2009
- "addedLines": 1 ,
2009
+ "addedLines": 0 ,
2010
2010
"blocks": Array [
2011
2011
Object {
2012
- "header": "@@ -101,7 +101,7 @@ var rootjQuery,",
2012
+ "header": "Diff too big to be displayed",
2013
+ "lines": Array [],
2014
+ "newStartLine": 0,
2015
+ "oldStartLine": 0,
2016
+ "oldStartLine2": null,
2017
+ },
2018
+ ],
2019
+ "checksumAfter": "50f310c",
2020
+ "checksumBefore": "e49196a",
2021
+ "deletedLines": 0,
2022
+ "isCombined": false,
2023
+ "isGitDiff": true,
2024
+ "isTooBig": true,
2025
+ "language": "js",
2026
+ "mode": "100644",
2027
+ "newName": "src/core/init.js",
2028
+ "oldName": "src/core/init.js",
2029
+ },
2030
+ Object {
2031
+ "addedLines": 0,
2032
+ "blocks": Array [
2033
+ Object {
2034
+ "header": "@@ -1,6 +1,5 @@",
2013
2035
"lines": Array [
2014
2036
Object {
2015
- "content": " // HANDLE: $(function) ",
2016
- "newNumber": 101 ,
2017
- "oldNumber": 101 ,
2037
+ "content": " define([ ",
2038
+ "newNumber": 1 ,
2039
+ "oldNumber": 1 ,
2018
2040
"type": "context",
2019
2041
},
2020
2042
Object {
2021
- "content": " // Shortcut for document ready ",
2022
- "newNumber": 102 ,
2023
- "oldNumber": 102 ,
2043
+ "content": " \\"./core\\", ",
2044
+ "newNumber": 2 ,
2045
+ "oldNumber": 2 ,
2024
2046
"type": "context",
2025
2047
},
2026
2048
Object {
2027
- "content": " } else if ( jQuery.isFunction( selector ) ) {",
2028
- "newNumber": 103,
2029
- "oldNumber": 103,
2049
+ "content": "- \\"./var/strundefined\\",",
2050
+ "newNumber": undefined,
2051
+ "oldNumber": 3,
2052
+ "type": "delete",
2053
+ },
2054
+ Object {
2055
+ "content": " \\"./var/rnotwhite\\",",
2056
+ "newNumber": 3,
2057
+ "oldNumber": 4,
2030
2058
"type": "context",
2031
2059
},
2032
2060
Object {
2033
- "content": "- return typeof rootjQuery.ready !== \\"undefined \\" ? ",
2034
- "newNumber": undefined ,
2035
- "oldNumber": 104 ,
2036
- "type": "delete ",
2061
+ "content": " \\"./var/hasOwn \\", ",
2062
+ "newNumber": 4 ,
2063
+ "oldNumber": 5 ,
2064
+ "type": "context ",
2037
2065
},
2038
2066
Object {
2039
- "content": "+ return rootjQuery.ready !== undefined ? ",
2040
- "newNumber": 104 ,
2041
- "oldNumber": undefined ,
2042
- "type": "insert ",
2067
+ "content": " \\"./var/slice\\", ",
2068
+ "newNumber": 5 ,
2069
+ "oldNumber": 6 ,
2070
+ "type": "context ",
2043
2071
},
2044
2072
],
2045
- "newStartLine": 101,
2046
- "oldStartLine": 101,
2073
+ "newStartLine": 1,
2074
+ "oldStartLine": 1,
2075
+ "oldStartLine2": null,
2076
+ },
2077
+ ],
2078
+ "checksumAfter": "6183f70",
2079
+ "checksumBefore": "7336f4d",
2080
+ "deletedLines": 1,
2081
+ "isCombined": false,
2082
+ "isGitDiff": true,
2083
+ "language": "js",
2084
+ "mode": "100644",
2085
+ "newName": "src/event.js",
2086
+ "oldName": "src/event.js",
2087
+ },
2088
+ ]
2089
+ ` ) ;
2090
+ } ) ;
2091
+
2092
+ it ( 'should work when `diffMaxChanges` is set and excedeed, and `diffTooBigMessage` is set' , ( ) => {
2093
+ const diff =
2094
+ 'diff --git a/src/core/init.js b/src/core/init.js\n' +
2095
+ 'index e49196a..50f310c 100644\n' +
2096
+ '--- a/src/core/init.js\n' +
2097
+ '+++ b/src/core/init.js\n' +
2098
+ '@@ -101,7 +101,7 @@ var rootjQuery,\n' +
2099
+ ' // HANDLE: $(function)\n' +
2100
+ ' // Shortcut for document ready\n' +
2101
+ ' } else if ( jQuery.isFunction( selector ) ) {\n' +
2102
+ '- return typeof rootjQuery.ready !== "undefined" ?\n' +
2103
+ '+ return rootjQuery.ready !== undefined ?\n' +
2104
+ ' rootjQuery.ready( selector ) :\n' +
2105
+ ' // Execute immediately if ready is not present\n' +
2106
+ ' selector( jQuery );\n' +
2107
+ 'diff --git a/src/event.js b/src/event.js\n' +
2108
+ 'index 7336f4d..6183f70 100644\n' +
2109
+ '--- a/src/event.js\n' +
2110
+ '+++ b/src/event.js\n' +
2111
+ '@@ -1,6 +1,5 @@\n' +
2112
+ ' define([\n' +
2113
+ ' "./core",\n' +
2114
+ '- "./var/strundefined",\n' +
2115
+ ' "./var/rnotwhite",\n' +
2116
+ ' "./var/hasOwn",\n' +
2117
+ ' "./var/slice",\n' ;
2118
+ const result = parse ( diff , { diffMaxChanges : 1 , diffTooBigMessage : ( i : number ) => `Custom ${ i } ` } ) ;
2119
+ expect ( result ) . toMatchInlineSnapshot ( `
2120
+ Array [
2121
+ Object {
2122
+ "addedLines": 0,
2123
+ "blocks": Array [
2124
+ Object {
2125
+ "header": "Custom 0",
2126
+ "lines": Array [],
2127
+ "newStartLine": 0,
2128
+ "oldStartLine": 0,
2047
2129
"oldStartLine2": null,
2048
2130
},
2049
2131
],
2050
2132
"checksumAfter": "50f310c",
2051
2133
"checksumBefore": "e49196a",
2052
- "deletedLines": 1 ,
2134
+ "deletedLines": 0 ,
2053
2135
"isCombined": false,
2054
2136
"isGitDiff": true,
2055
2137
"isTooBig": true,
0 commit comments