How k6 return my message on check function in result summary if I add a common method for result checking?

My message will be displayed in result summary when the check is after http request directly, like below picture.

But, if I make a single function on check, test result will display the parameter name: message instead of my message, see below picture(the picture is in the first replay). I want to know how to display my message if I want to use a common function on checking, thanks.

The second picture is here, I cannot save two pictures now as I am new here :sweat_smile:

Hi @Brenda,
this is expected from a JavaScript point of view. You are creating an object with the property name message.

If you want to use the value of the message variable then you have to use the syntax for the computed property name.

check(actualResult, {
    [message]: (actualResult) => actualResult == expectedResult,

Let me know if it helps :wave: