Skip to content

Commit

Permalink
fix(doctor): skip parent folder perm check if linux user is skipped
Browse files Browse the repository at this point in the history
closes #405
- skip directory check if `--no-setup-linux-user` option is passed
  • Loading branch information
acburdine committed Jul 31, 2017
1 parent 110bb47 commit 6eec35c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/commands/doctor/checks/install.js
Expand Up @@ -57,7 +57,7 @@ const tasks = {
'Please fix your directory permissions.'
));
}).then(() => {
if (ctx.local || os.platform() !== 'linux') {
if (ctx.local || os.platform() !== 'linux' || (ctx.argv && ctx.argv['setup-linux-user'] === false)) {
return Promise.resolve();
}

Expand Down
16 changes: 16 additions & 0 deletions test/unit/commands/doctor/install-spec.js
Expand Up @@ -210,6 +210,22 @@ describe('Unit: Doctor Checks > Install', function () {
});
});

it('skips checking parent folder permissions if --no-setup-linux-user is passed', function () {
let accessStub = sinon.stub().resolves();
let platformStub = sinon.stub().returns('linux');
const tasks = proxyquire(modulePath, {
'fs-extra': {access: accessStub},
os: {platform: platformStub}
}).tasks;
let checkDirectoryAndAbove = sinon.stub(tasks, 'checkDirectoryAndAbove').resolves();

return tasks.folderPermissions({argv: {'setup-linux-user': false}}).then(() => {
expect(accessStub.calledOnce).to.be.true;
expect(platformStub.calledOnce).to.be.true;
expect(checkDirectoryAndAbove.called).to.be.false;
});
});

it('runs checkParentAndAbove if local not set and platform is linux', function () {
let accessStub = sinon.stub().resolves();
let platformStub = sinon.stub().returns('linux');
Expand Down

0 comments on commit 6eec35c

Please sign in to comment.