From 8c87ae6b430479445744a2f5c8eaca7f5f03d61d Mon Sep 17 00:00:00 2001 From: Julie Date: Sat, 26 Oct 2013 23:24:50 -0700 Subject: [PATCH] fix(onPrepare): onPrepare with a string argument should resolve from the config directory onPrepare can take a string, which is a filename containing a script to load adn execute before any tests run. This fixes the string to resolve the filename relative to the config file, instead of relative to the current working directory where protractor is called. --- lib/runner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/runner.js b/lib/runner.js index 50afd731a..0c9c3549a 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -214,7 +214,7 @@ var runJasmineTests = function() { if (typeof config.onPrepare == 'function') { config.onPrepare(); } else if (typeof config.onPrepare == 'string') { - require(path.resolve(process.cwd(), config.onPrepare)); + require(path.resolve(config.specFileBase, config.onPrepare)); } else { throw 'config.onPrepare must be a string or function'; }