From e9b76dda6519dda5008801aabddaf87b79f6a136 Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Mon, 14 Jan 2019 13:15:01 +0100 Subject: [PATCH] fix: don't make assumptions about the input 'config' object --- lib/configuration.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/configuration.js b/lib/configuration.js index 4922345eb..ef445fc2e 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -102,13 +102,16 @@ function applyConfiguration(config) { configuration.options = applyLoggingOptions(configuration.options); - if (config.hooksData || config.options.b || config.options.sandbox) { - throw new Error('DEPRECATED: Dredd does not support ' - + 'sandboxed JS hooks anymore. Use standard JS hooks instead.'); - } - if (config.blueprintPath) { - throw new Error('DEPRECATED: Dredd does not support ' - + "the 'blueprintPath' option anymore. Use 'path' instead."); + if (config) { + if (config.hooksData + || (config.options && (config.options.b || config.options.sandbox))) { + throw new Error('DEPRECATED: Dredd does not support ' + + 'sandboxed JS hooks anymore. Use standard JS hooks instead.'); + } + if (config.blueprintPath) { + throw new Error('DEPRECATED: Dredd does not support ' + + "the 'blueprintPath' option anymore. Use 'path' instead."); + } } return configuration;