set +e
$NXF_RUN | tee stdout
set -e

if [[ "$NXF_SYNTAX_PARSER" == "v2" ]] ; then
    # strict parser should give compile-time error
    < stdout grep "error-message.nf:19:1: \`printx\` is not defined"
else
    # legacy parser should give runtime error
    < stdout grep "Check script '.*error-message.nf' at line: 19"
fi
