Closed
Description
test/sequential/test-chdir.js
persistently fails on OS X 10.11 because the output of process.cwd()
doesn't match the path we're doing process.chdir()
on before.
Here's a reduced test case (npm i mkdirp hexy
):
const mkdirp = require('mkdirp');
const hex = require('hexy').hexy;
const dir = __dirname + '/weird \uc3a4\uc3ab\uc3af characters \u00e1\u00e2\u00e3';
mkdirp.sync(dir);
process.chdir(dir);
console.log(hex(new Buffer(dir)));
console.log(hex(new Buffer(process.cwd())));
console.log(dir.length, dir);
console.log(process.cwd().length, process.cwd());
The strings look identical on the terminal, but the bytes differ. Here's the output:
00000000: 2f55 7365 7273 2f73 696c 7665 7277 696e /Users/silverwin
00000010: 642f 6769 742f 6368 6469 722f 7765 6972 d/git/chdir/weir
00000020: 6420 ec8e a4ec 8eab ec8e af20 6368 6172 d.l.$l.+l./.char
00000030: 6163 7465 7273 20c3 a1c3 a2c3 a3 acters.C!C"C#
00000000: 2f55 7365 7273 2f73 696c 7665 7277 696e /Users/silverwin
00000010: 642f 6769 742f 6368 6469 722f 7765 6972 d/git/chdir/weir
00000020: 6420 e184 8ae1 85a7 e186 abe1 848a e185 d.a..a.'a.+a..a.
00000030: a7e1 86b2 e184 8ae1 85a7 e186 b620 6368 'a.2a..a.'a.6.ch
00000040: 6172 6163 7465 7273 2061 cc81 61cc 8261 aracters.aL.aL.a
00000050: cc83 L.
52 '/Users/silverwind/git/chdir/weird 쎤쎫쎯 characters áâã'
61 '/Users/silverwind/git/chdir/weird 쎤쎫쎯 characters áâã'
cc: @evanlucas