From a94a987f95724850b5660f7ad21b15ff98c59a25 Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Tue, 6 Feb 2018 12:06:40 +0100 Subject: [PATCH] fix(doctor): skip validate config check for running instances (#623) no issue - skips the validate config check when the tested instance is currently running, as it would fail for testing the server port --- lib/commands/doctor/checks/validate-config.js | 1 + test/unit/commands/doctor/checks/validate-config-spec.js | 5 +++++ test/unit/utils/resolve-version-spec.js | 1 - 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/commands/doctor/checks/validate-config.js b/lib/commands/doctor/checks/validate-config.js index bfaf0ec70..007dabec9 100644 --- a/lib/commands/doctor/checks/validate-config.js +++ b/lib/commands/doctor/checks/validate-config.js @@ -49,5 +49,6 @@ function validateConfig(ctx) { module.exports = { title: taskTitle, task: validateConfig, + skip: (ctx) => ctx.instance && ctx.instance.process.isRunning(ctx.instance.dir), category: ['start'] } diff --git a/test/unit/commands/doctor/checks/validate-config-spec.js b/test/unit/commands/doctor/checks/validate-config-spec.js index ada5d5bf6..3e58bab6e 100644 --- a/test/unit/commands/doctor/checks/validate-config-spec.js +++ b/test/unit/commands/doctor/checks/validate-config-spec.js @@ -21,6 +21,11 @@ describe('Unit: Doctor Checks > validateConfig', function () { } }); + it('skips check, when instance is currently running', function () { + const isRunningStub = sinon.stub().returns(true); + expect(validateConfig.skip({instance: {process: {isRunning: isRunningStub}}}), 'true if current instance is running').to.be.true; + }); + it('rejects if environment is passed and no config exists for that environment', function () { env = setupEnv(); const cwdStub = sandbox.stub(process, 'cwd').returns(env.dir); diff --git a/test/unit/utils/resolve-version-spec.js b/test/unit/utils/resolve-version-spec.js index ea14a3796..c1a6516b5 100644 --- a/test/unit/utils/resolve-version-spec.js +++ b/test/unit/utils/resolve-version-spec.js @@ -46,7 +46,6 @@ describe('Unit: resolveVersion', function () { }); }); - it('rejects if no versions are found', function () { stubYarn('{"data": []}');