Skip to content

Commit

Permalink
🐛 fixed node permissions check running on local installs
Browse files Browse the repository at this point in the history
  • Loading branch information
vikaspotluri123 authored and acburdine committed Nov 11, 2024
1 parent d4082c4 commit 3595f8d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/commands/doctor/checks/node-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ See ${chalk.underline.blue('https://ghost.org/docs/faq/node-versions/')} for mor
});
}

if (ctx.local || !ctx.system.platform.linux || (ctx.argv && ctx.argv['setup-linux-user'] === false)) {
const isLocal = ctx.local || (ctx.instance && ctx.instance.process.name === 'local');
if (isLocal || !ctx.system.platform.linux || (ctx.argv && ctx.argv['setup-linux-user'] === false)) {
return;
}

Expand Down
19 changes: 19 additions & 0 deletions test/unit/commands/doctor/checks/node-version-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,25 @@ describe('Unit: Doctor Checks > nodeVersion', function () {
});
});

it('doesn\'t call checkDirectoryAndAbove for local process managers', function () {
const cliPackage = {
engines: {
node: process.versions.node // this future-proofs the test
}
};
const ctx = {local: false, instance: {process: {name: 'local'}}};

const checkDirectoryStub = sinon.stub().resolves();
const nodeVersion = proxyquire(modulePath, {
'../../../../package': cliPackage,
'./check-directory': checkDirectoryStub
}).task;

return nodeVersion(ctx, {}).then(() => {
expect(checkDirectoryStub.called).to.be.false;
});
});

it('calls checkDirectoryAndAbove if none of the three conditions are true', function () {
const cliPackage = {
engines: {
Expand Down

0 comments on commit 3595f8d

Please sign in to comment.