Skip to content

Commit

Permalink
fix: I.say would be added to Test.steps object (#4145)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Jan 25, 2024
1 parent a445b71 commit cd4288e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ const output = require('./output');
*/
class Actor {
/**
* add print comment method`
* Print the comment on log. Also, adding a step in the `Test.steps` object
* @param {string} msg
* @param {string} color
* @inner
*
* ⚠️ returns a promise which is synchronized internally by recorder
*/
say(msg, color = 'cyan') {
return recorder.add(`say ${msg}`, () => {
async say(msg, color = 'cyan') {
const step = new Step('say', 'say');
step.status = 'passed';
return recordStep(step, [msg]).then(() => {
// this is backward compatibility as this event may be used somewhere
event.emit(event.step.comment, msg);
output.say(msg, `${color}`);
});
Expand Down
4 changes: 3 additions & 1 deletion lib/step.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ class Step {
}
let result;
try {
result = this.helper[this.helperMethod].apply(this.helper, this.args);
if (this.helperMethod !== 'say') {
result = this.helper[this.helperMethod].apply(this.helper, this.args);
}
this.setStatus('success');
} catch (err) {
this.setStatus('failed');
Expand Down

0 comments on commit cd4288e

Please sign in to comment.