Skip to content

Commit cd4288e

Browse files
authored
fix: I.say would be added to Test.steps object (#4145)
1 parent a445b71 commit cd4288e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/actor.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ const output = require('./output');
1313
*/
1414
class Actor {
1515
/**
16-
* add print comment method`
16+
* Print the comment on log. Also, adding a step in the `Test.steps` object
1717
* @param {string} msg
1818
* @param {string} color
1919
* @inner
2020
*
2121
* ⚠️ returns a promise which is synchronized internally by recorder
2222
*/
23-
say(msg, color = 'cyan') {
24-
return recorder.add(`say ${msg}`, () => {
23+
async say(msg, color = 'cyan') {
24+
const step = new Step('say', 'say');
25+
step.status = 'passed';
26+
return recordStep(step, [msg]).then(() => {
27+
// this is backward compatibility as this event may be used somewhere
2528
event.emit(event.step.comment, msg);
2629
output.say(msg, `${color}`);
2730
});

lib/step.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ class Step {
119119
}
120120
let result;
121121
try {
122-
result = this.helper[this.helperMethod].apply(this.helper, this.args);
122+
if (this.helperMethod !== 'say') {
123+
result = this.helper[this.helperMethod].apply(this.helper, this.args);
124+
}
123125
this.setStatus('success');
124126
} catch (err) {
125127
this.setStatus('failed');

0 commit comments

Comments
 (0)