-
Notifications
You must be signed in to change notification settings - Fork 280
Access Custom options in Hooks #215
Comments
Hi @chrislondon, this is unfortunately not possible at this moment. I consider it as very useful future feature. 👍 |
Actually, this is maybe even better then I thought initially. This could make possible to do a huge clean-up in Dredd codebase and move lot of stuff under hooks - some kind of plugin architecture. All this all functionality should be moved under hook architecture:
|
I was able to successfuly use custom options in JavaScript hooks, but it's pretty hidden feature and I don't believe it's possible in other languages as of now: var hooks = require('hooks');
var userId = hooks.configuration.options.custom.userId || {};
... Also, I don't know if this is intended or hack, so I'd be cautious when using it. We may rebuild this "feature" in the future. |
If you're using non-JS hooks, you can load the YAML file in the language of your choice and easily parse out the values yourself. It's going to take a long time until non-JS hooks will be able to access custom data from Dredd, because it means we'd need to change the protocol how Dredd communicates with the hook handlers and all the hook handlers would need to implement it. |
Update eslint to the latest version 🚀
This worked for me instead. I was getting undefined for options. I am using dredd v12.2.1. var userId = hooks.configuration.custom.userId || {}; |
Unless I'm mistaken I can't seem to find any way to access custom options in my hook file. I would like to use custom options so my hook file is more flexible. Is this possible?
The text was updated successfully, but these errors were encountered: