Skip to content

Commit 70d26cd

Browse files
committed
Relax file mode and ownership assertions on Windows.
1 parent 47c95a7 commit 70d26cd

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

test/base.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,20 @@ function _spawnTest(passError, testFile, params, cb) {
3535
}
3636

3737
function _testStat(stat, mode) {
38-
assert.equal(stat.uid, process.getuid(), 'should have the same UID');
39-
assert.equal(stat.gid, process.getgid(), 'should have the same GUID');
40-
assert.equal(stat.mode, mode);
38+
// getuid() and getgid() do not exist on Windows.
39+
if (process.getuid) {
40+
assert.equal(stat.uid, process.getuid(), 'should have the same UID');
41+
}
42+
if (process.getgid) {
43+
assert.equal(stat.gid, process.getgid(), 'should have the same GUID');
44+
}
45+
// mode values do not work properly on Windows. Ignore “group” and
46+
// “other” bits then.
47+
if (process.platform == 'win32') {
48+
assert.equal(stat.mode & 0777700, mode & 0777700);
49+
} else {
50+
assert.equal(stat.mode, mode);
51+
}
4152
}
4253

4354
function _testPrefix(prefix) {

0 commit comments

Comments
 (0)