From a5d14f4ffb85536123ab502a937c570e2d5f032e Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 26 May 2015 16:33:02 +0100 Subject: [PATCH] handle unexplained case where smokeTestModule is undefined --- .../Features/HealthCheck/HealthCheckController.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee b/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee index 3235b64dbd..97be776549 100644 --- a/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee +++ b/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee @@ -21,9 +21,12 @@ module.exports = HealthCheckController = # be in its parent, when it is loaded by mocha.addFile. path = require.resolve(__dirname + "/../../../../test/smoke/js/SmokeTests.js") smokeTestModule = require.cache[path] - parent = smokeTestModule.parent - while (idx = parent.children.indexOf(smokeTestModule)) != -1 - parent.children.splice(idx, 1) + if smokeTestModule? + parent = smokeTestModule.parent + while (idx = parent.children.indexOf(smokeTestModule)) != -1 + parent.children.splice(idx, 1) + else + logger.warn {path}, "smokeTestModule not defined" # remove the smokeTest from the module cache delete require.cache[path]