Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 8c87ae6

Browse files
committed
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.
1 parent 267d49d commit 8c87ae6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/runner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ var runJasmineTests = function() {
214214
if (typeof config.onPrepare == 'function') {
215215
config.onPrepare();
216216
} else if (typeof config.onPrepare == 'string') {
217-
require(path.resolve(process.cwd(), config.onPrepare));
217+
require(path.resolve(config.specFileBase, config.onPrepare));
218218
} else {
219219
throw 'config.onPrepare must be a string or function';
220220
}

0 commit comments

Comments
 (0)