format is a factory function returning
a tag function
that produces a human-readable string description of a template containing
one or more answerables.
Typically, you'll want to use d and f shorthands instead, or the modern alternative - the:
the d function works best for generating a static description of a parameterised Activity
the the function works best for generating a dynamic description of a parameterised Activity
Use `the` instead of `format`
format, d and f are the original Serenity/JS string formatting functions,
still present in the framework for backwards compatibility purposes.
To generate a dynamic description of a Question or Interaction,
use the function instead.
Using format
import{ format, Question }from'@serenity-js/core' constsomeQuestion=()=> Question.about('some question', actor =>'some value') format({ markQuestions:true})`actor answers ${question()}` // returns: actor answers <<some question>> format({ markQuestions:false})`actor answers ${question()}` // returns: actor answers some question
Using d
import{ d, Question }from'@serenity-js/core' constsomeQuestion=()=> Question.about('some question', actor =>'some value') d`actor answers ${question()}` // returns: actor answers <<some question>>
Using f
import{ f, Question }from'@serenity-js/core' constsomeQuestion=()=> Question.about('some question', actor =>'some value') f`actor answers ${question()}` // returns: actor answers <<some question>> format({ markQuestions:false})`actor answers ${question()}` // returns: actor answers <<some question>>
Parameters
externalconfig: { markQuestions: boolean }
markQuestions: boolean - if set to true, descriptions of questions passed in as arguments will be surrounded with double angled brackets, i.e. <<description>>
format
is a factory function returning a tag function that produces a human-readablestring
description of a template containing one or more answerables.Typically, you'll want to use
d
andf
shorthands instead, or the modern alternative -the
:d
function works best for generating a static description of a parameterisedActivity
f
function is better suited for debuggingthe
function works best for generating a dynamic description of a parameterisedActivity
format
,d
andf
are the original Serenity/JS string formatting functions, still present in the framework for backwards compatibility purposes.To generate a dynamic description of a
Question
orInteraction
, usethe
function instead.Using
format
Using
d
Using
f