* for each chunks in output1, if there's a chunk in output2 with the same fileName, * ensure that the chunk code is the same. if not, the chunk hash should have changed.
( output1: RolldownOutput, output2: RolldownOutput, )
| 1194 | * ensure that the chunk code is the same. if not, the chunk hash should have changed. |
| 1195 | */ |
| 1196 | function assertOutputHashContentChange( |
| 1197 | output1: RolldownOutput, |
| 1198 | output2: RolldownOutput, |
| 1199 | ) { |
| 1200 | for (const chunk of output1.output) { |
| 1201 | if (chunk.type === 'chunk') { |
| 1202 | const chunk2 = output2.output.find( |
| 1203 | (c) => c.type === 'chunk' && c.fileName === chunk.fileName, |
| 1204 | ) as OutputChunk | undefined |
| 1205 | if (chunk2) { |
| 1206 | expect( |
| 1207 | chunk.code, |
| 1208 | `the ${chunk.fileName} chunk has the same hash but different contents between builds`, |
| 1209 | ).toEqual(chunk2.code) |
| 1210 | } |
| 1211 | } |
| 1212 | } |
| 1213 | } |
| 1214 | |
| 1215 | function getOutputHashChanges( |
| 1216 | output1: RolldownOutput, |