How to add a custom helper ? #393
-
Hey 🤗 , I have been trying to hide some part of URL request in the report, Especially the API keys, I wanted to add an helper function to a custom template. I have done something like this. By copying the default template.
and in the HTML part something Like this But I am having this error,
Please help me, I am very new to this 💁🏻♂️ ! Thanks in anticipation 🙇🏻♂️ I have added every thing in the template.hbs file and ran this command |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
That's unfortunately not the way helpers are added to the report. They are placed inside the actual reporter code. https://github.com/DannyDainton/newman-reporter-htmlextra/blob/main/lib/index.js#L68 The report is compiled just before the end of the Collection run where it fills in all the handlebar placeholders, it's trying to di that for your helper. As you can see in the error. The template script you added would likely be throwing console errors, if you removed the placeholder and let the report be created. It wouldn't know what |
Beta Was this translation helpful? Give feedback.
That's unfortunately not the way helpers are added to the report. They are placed inside the actual reporter code.
https://github.com/DannyDainton/newman-reporter-htmlextra/blob/main/lib/index.js#L68
The report is compiled just before the end of the Collection run where it fills in all the handlebar placeholders, it's trying to di that for your helper. As you can see in the error.
The template script you added would likely be throwing console errors, if you removed the placeholder and let the report be created. It wouldn't know what
Handlebars
is in that context.