tape-testing / tape

tap-producing test harness for node and browsers
MIT License
5.77k stars 307 forks source link

String comparison (t.equals) fails on Windows alone #593

Closed paambaati closed 1 year ago

paambaati commented 1 year ago

This is one of the strangest bugs I've come across, but my tape tests fail only on Windows, and only on t.equals comparisons of identical strings.

See https://github.com/paambaati/codeclimate-action/actions/runs/4900505606/jobs/8751202125?pr=666 for an example.

Screenshot 2023-05-06 at 1 32 01 PM

I've made sure to account for line-endings.

Any clue why this might be happening?

ljharb commented 1 year ago

What's the length of both the expected and actual strings? My guess is that there's an invisible character somewhere.

paambaati commented 1 year ago

@ljharb The strings are of the same length – https://github.com/paambaati/codeclimate-action/actions/runs/4905406445/jobs/8759167878#step:5:12

ljharb commented 1 year ago
for (var i = 0; i < a.length; i++) { if (a[i] !== b[i]) { console.log(i, a[i], b[i]); } }
339 I i
340 N n
341 D d
342 O o
343 W w
344 S s
644 I i
645 N n
646 D d
647 O o
648 W w
649 S s

seems like there's some capitalization differences between the strings. Specifically, I see some WINDOWS vs Windows. Any chance you haven't looked into the case-sensitivity of the disks in question?

paambaati commented 1 year ago

Lol, that was it. CI is green now – https://github.com/paambaati/codeclimate-action/actions/runs/4905472889/jobs/8759276954?pr=666. Thank you so much!

Looks like the root cause is that folder names are case-insensitive in Windows, and the machine I developed the tests on reported the path as C:\WINDOWS, while the GitHub Actions runner machine reports it as C:\Windows.

ljharb commented 1 year ago

That suggests they're not always case-insensitve in windows :-p glad you figured it out tho.