Skip to content

Commit 7a513dc

Browse files
author
DavertMik
committed
fixed tests
1 parent 41453d0 commit 7a513dc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/mocha/hooks.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class Hook {
1717
return this.toString() + '()';
1818
}
1919

20+
get title() {
21+
return this.ctx?.test?.title || this.name;
22+
}
23+
2024
get name() {
2125
return this.constructor.name;
2226
}

lib/mocha/scenarioConfig.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ class ScenarioConfig {
8787
this.test.tags.push(tagName);
8888
return this;
8989
}
90+
91+
/**
92+
* Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
93+
* @param {Object<string, *>} dependencies
94+
* @returns {this}
95+
*/
96+
injectDependencies(dependencies) {
97+
Object.keys(dependencies).forEach(key => {
98+
this.test.inject[key] = dependencies[key];
99+
});
100+
return this;
101+
}
90102
}
91103

92104
module.exports = ScenarioConfig;

0 commit comments

Comments
 (0)