Closed nolanlawson closed 1 week ago
This is likely because of Vitest setting logLevel: "error"
to reduce unnecessary logs for normal Vitest use cases:
https://github.com/vitest-dev/vitest/blob/cb02be1e52a3c7fb5cdd4c1f314fccdd6ec3e9bb/packages/vitest/src/node/create.ts#L33-L34
I think this default should be fine, but to workaround this, you can use a plugin to change logLevel
. Here is an example:
https://stackblitz.com/edit/vitest-dev-vitest-or5xkk?file=vite.config.ts
{
name: 'force-vite-log',
config(config, env) {
delete config.logLevel;
},
},
Clear and concise description of the problem
As a developer using Vitest, I would like any Rollup plugins using the
this.warn
API to automatically show the warnings in the console while I am running tests, so that I know there might be issues in the plugin that I should fix.This actually seems to work out-of-the-box today with Vite (minimal repro):
However, a similar repro with Vitest does not show any warnings when running
vitest
.Suggested solution
By default, I think Rollup warnings should be shown in the console. Perhaps there could also be a way to disable this default behavior, or to handle the warnings in
vitest.config.js
.Alternative
I'm not aware of any way to surface Rollup plugin warnings using current Vitest. I apologize if I missed something in the docs!
Additional context
Validations