Skip to content

Commit bf169ca

Browse files
committed
Added init globals function and version bump
1 parent 3020108 commit bf169ca

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.3.3
2+
3+
* Added `initGLobals()` function to API of [custom runner](https://codecept.io/hooks/#custom-runner).
4+
15
## 1.3.2
26

37
* Interactve Shell improvements for `pause()`

docs/hooks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ let codecept = new Codecept(config, opts);
398398
// create helpers, support files, mocha
399399
Container.create(config, opts);
400400

401+
// initialize codeceptjs in current dir
402+
codecept.initGlobals(__dirname);
403+
401404
// initialize listeners
402405
codecept.bootstrap();
403406

lib/codecept.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,18 @@ class Codecept {
3232
* @param {*} callback
3333
*/
3434
init(dir, callback) {
35-
// preparing globals
35+
this.initGlobals(dir);
36+
// initializing listeners
37+
Container.create(this.config, this.opts);
38+
this.bootstrap(callback);
39+
}
40+
41+
/**
42+
* Creates global variables
43+
*
44+
* @param {*} dir
45+
*/
46+
initGlobals(dir) {
3647
global.codecept_dir = dir;
3748
global.output_dir = fsPath.resolve(dir, this.config.output);
3849

@@ -51,10 +62,6 @@ class Codecept {
5162
global.When = stepDefinitions.When;
5263
global.Then = stepDefinitions.Then;
5364
}
54-
55-
// initializing listeners
56-
Container.create(this.config, this.opts);
57-
this.bootstrap(callback);
5865
}
5966

6067
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeceptjs",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"description": "Modern Era Acceptance Testing Framework for NodeJS",
55
"keywords": [
66
"acceptance",

0 commit comments

Comments
 (0)