Skip to content

Commit 6eec35c

Browse files
committed
fix(doctor): skip parent folder perm check if linux user is skipped
closes #405 - skip directory check if `--no-setup-linux-user` option is passed
1 parent 110bb47 commit 6eec35c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/commands/doctor/checks/install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const tasks = {
5757
'Please fix your directory permissions.'
5858
));
5959
}).then(() => {
60-
if (ctx.local || os.platform() !== 'linux') {
60+
if (ctx.local || os.platform() !== 'linux' || (ctx.argv && ctx.argv['setup-linux-user'] === false)) {
6161
return Promise.resolve();
6262
}
6363

test/unit/commands/doctor/install-spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,22 @@ describe('Unit: Doctor Checks > Install', function () {
210210
});
211211
});
212212

213+
it('skips checking parent folder permissions if --no-setup-linux-user is passed', function () {
214+
let accessStub = sinon.stub().resolves();
215+
let platformStub = sinon.stub().returns('linux');
216+
const tasks = proxyquire(modulePath, {
217+
'fs-extra': {access: accessStub},
218+
os: {platform: platformStub}
219+
}).tasks;
220+
let checkDirectoryAndAbove = sinon.stub(tasks, 'checkDirectoryAndAbove').resolves();
221+
222+
return tasks.folderPermissions({argv: {'setup-linux-user': false}}).then(() => {
223+
expect(accessStub.calledOnce).to.be.true;
224+
expect(platformStub.calledOnce).to.be.true;
225+
expect(checkDirectoryAndAbove.called).to.be.false;
226+
});
227+
});
228+
213229
it('runs checkParentAndAbove if local not set and platform is linux', function () {
214230
let accessStub = sinon.stub().resolves();
215231
let platformStub = sinon.stub().returns('linux');

0 commit comments

Comments
 (0)