Closed novemberborn closed 6 years ago
Originally reported in https://github.com/avajs/ava/issues/1935, comparing these two strings crashes:
`<table> <tr> <td>undefined</td> <td>3</td> </tr> </table> `
`<table> <tr> <td>3</td> <td>4</td> </tr> </table>`
Error thrown in test: TypeError { message: 'Cannot read property \'substring\' of undefined', } diff_main (node_modules/fast-diff/diff.js:63:17) diffLine (node_modules/concordance/lib/primitiveValues/string.js:65:19) StringValue.diffDeep (node_modules/concordance/lib/primitiveValues/string.js:271:24) Object.diffDescriptors (node_modules/concordance/lib/diff.js:307:17) Test.is (test/222.test.js:17:5)
Note the first string has a newline after </table>. The error occurs on this line:
</table>
https://github.com/concordancejs/concordance/blob/262782ac7f9de37d05c0f5460884ddc4b92e0c85/lib/primitiveValues/string.js#L271
Presumably expectedLines[expectedIndex] is the undefined one. This should have been picked up as "actual-is-extraneous". Why it isn't requires investigation.
expectedLines[expectedIndex]
undefined one
Originally reported in https://github.com/avajs/ava/issues/1935, comparing these two strings crashes:
Note the first string has a newline after
</table>
. The error occurs on this line:https://github.com/concordancejs/concordance/blob/262782ac7f9de37d05c0f5460884ddc4b92e0c85/lib/primitiveValues/string.js#L271
Presumably
expectedLines[expectedIndex]
is theundefined one
. This should have been picked up as "actual-is-extraneous". Why it isn't requires investigation.