outmoded / hapi-contrib

Discussion forum for project contributors
Other
78 stars 25 forks source link

Contributing to hapi lab HTML reporter. #93

Closed ebgranger closed 7 years ago

ebgranger commented 7 years ago

I noticed that the HTML reporter hasn't been updated in a while, and it gets hard to read at work once a dev starts running a decent amount of tests.

Is this by design? Are contributions to the HTML reporter of lab encouraged, or do I need to be making a custom HTML reporter to integrate as a dependency to lab on my personal stack?

If so, are there any tutorials on how to integrate a custom HTML reporter into lab? I'm a little hesitant on where to begin.

Marsup commented 7 years ago

HTML reporter should be as feature complete as others, unfortunately it's not done every time as that requires getting to know all the reporters so there are occasional discrepancies. Contributions are always welcome.

geek commented 7 years ago

@ebgranger if you can simplify or make the current reporter easier to read then I am happy to accept a PR. Feel free to open this issue in https://github.com/hapijs/lab

If you think we should add a tutorial on how to add a custom reporter, then that is also welcome.

I would start by copying https://github.com/hapijs/lab/blob/master/lib/reporters/html.js and the html assets, then changing things as you see fit. We use handlebars and the context we pass to the template is https://github.com/hapijs/lab/blob/master/lib/reporters/html.js#L91-L100 (but you can change that in your own reporter)

ebgranger commented 7 years ago

Thank you for your help @geek. I think a tutorial would be very helpful. This is my first introduction to unit testing, as well as unit testing at an enterprise level. So an intro to adding a custom reporter to the lab pkg would be great.