#why does logger not work in test module
15 messages · Page 1 of 1 (latest)
The default test logger is set to error only. You can modify this as needed. I think with modRef.useLogger? Haven't had to mess with that for a while'
setLogger
setLogger
useMocker
man 😅
I guess I'll propose changing setLogger to useLogger for v11 😎
Btw it's that way so it does not pollute your unit test log. I all goes well, you ideally just want a green PASS, instead of half a page of logs between each test.
Why not v10?
we would mark that api as deprecated while introducing the new one in v10
That's what I would be hoping for
yeah, we could mention this in the docs
By the way, as the method naming goes, I think it's alright. The useXx is used within the test module builder, that is, before .compile is called. This is pretty much a convention with the builder pattern. (That, and withXx)
The setXx, on the other hand, is used to set something on an already created object.
oh, indeed
never used that before
a bit confusing to me tho
Oh wait, it's the other way around??? 🤔
useLogger came from NestApplicationContext
setLogger came from TestingModuleBuilder