Skip to content

Commit 152a13a

Browse files
author
John Doherty
committed
cleaned up world.js
1 parent 63bf16d commit 152a13a

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

runtime/world.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ function consoleInfo() {
6464
console.log(output);
6565
}
6666

67-
function World() {
67+
/**
68+
* Creates a list of variables to expose globally and therefore accessible within each step definition
69+
* @returns {void}
70+
*/
71+
function createWorld() {
6872

69-
// create a list of variables to expose globally and therefore accessible within each step definition
7073
var runtime = {
7174
driver: null, // the browser object
7275
selenium: selenium, // the raw nodejs selenium driver
@@ -88,7 +91,11 @@ function World() {
8891
});
8992
}
9093

91-
function createGlobalObjects() {
94+
/**
95+
* Import shared objects, pages object and helpers into global scope
96+
* @returns {void}
97+
*/
98+
function importSupportObjects() {
9299

93100
// import shared objects from multiple paths (after global vars have been created)
94101
if (global.sharedObjectPaths && Array.isArray(global.sharedObjectPaths) && global.sharedObjectPaths.length > 0) {
@@ -127,10 +134,12 @@ function createGlobalObjects() {
127134

128135
// export the "World" required by cucumber to allow it to expose methods within step def's
129136
module.exports = function () {
130-
World();
131-
createGlobalObjects();
132137

133-
this.World = World;
138+
createWorld();
139+
importSupportObjects();
140+
141+
// this.World must be set!
142+
this.World = createWorld;
134143

135144
// set the default timeout for all tests
136145
this.setDefaultTimeout(global.DEFAULT_TIMEOUT);

0 commit comments

Comments
 (0)