You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
debugEventBus.subscribe(`didLoad.page.${instance}`,({[type]: ref})=>{console.info( ... );// added this line because was not 100% sure this was called w/ karmalog.debug( ... );// added this line earlier to get some feedback in my browserpages.push(ref);console.info( ... );// had to add this to notice that "log" was undefined});
So, sure enough, I forgot to pass the log instance in my test setup. However, shouldn't we log something when subscribers throw?
The text was updated successfully, but these errors were encountered:
Since eventBus.create accepts an error-handler function as the last argument, the mock event bus should probably always configure a "loud" error handler.
Regarding general log-behaviour in tests I am on the fence:
On on hand, I like to be able to test behavior that causes log.error on purpose without being confused by red/yellow messages in terminal or browser console.
On the other hand, "mute by default" makes diagnosing actual problems much harder.
Possible solution:
allow to setup mock log "expectations" that will then be silently dropped, while all other logging goes through.
users could also be able to require no unexpected logging, turning any additional log message (above the specified level) into a test failure.
@x1B so the mock event bus currently does log the error, it's just not appearing because of the test infrastructure?
I'm not having an issue with logging in general; couldn't we just re-throw the error (or a new one with the message constructed by the event bus) when testing?
I don't think there is a legitimate use case for testing throwing subscribers. IMO subscriptions that throw should always cause tests to fail.
Just for completeness: this is not a problem in widget tests (or we would've noticed this far sooner), because laxar-mocks passes a jasmine-aware error handler to the mock event bus:
I was testing the following code:
So, sure enough, I forgot to pass the log instance in my test setup. However, shouldn't we log something when subscribers throw?
The text was updated successfully, but these errors were encountered: