Browse Source

handle unexplained case where smokeTestModule is undefined

Brian Gough 11 years ago
parent
commit
a5d14f4ffb

+ 6 - 3
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.
 				# be in its parent, when it is loaded by mocha.addFile.
 				path = require.resolve(__dirname + "/../../../../test/smoke/js/SmokeTests.js")
 				path = require.resolve(__dirname + "/../../../../test/smoke/js/SmokeTests.js")
 				smokeTestModule = require.cache[path]
 				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
 				# remove the smokeTest from the module cache
 				delete require.cache[path]
 				delete require.cache[path]