-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Is your feature request related to a problem?
Looking at services like @wdio/sauce-service or @wdio/browserstack-service they all have to manually manage whether the hook should be run or not based on whether the session is running on these services or not. For example: if no user and key is provided there is no reason for the service to be even imported within the worker.
Describe the solution you'd like.
I'ld suggest to allow services to export a function that receives the config object and returns either true or false which determines whether the service should be ignored in the worker. This would allow service author to determine if the service should be even loaded in the worker or not based on e.g. all defined capabilities.
At the same time we should allow a function to be run in the worker process that determines if the service should be initiated or not. Different from the solution from above, here the service author can determine the initiation of the service based on the used capability in the worker.
Describe alternatives you've considered.
Allow service to extend from a base class that could do this.
Additional context
I am reviewing some additions to the BS service and discovered the need for it.
Code of Conduct
- I agree to follow this project's Code of Conduct