Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup plugin warnings are not shown #6598

Closed
4 tasks done
nolanlawson opened this issue Sep 30, 2024 · 1 comment · Fixed by #6724
Closed
4 tasks done

Rollup plugin warnings are not shown #6598

nolanlawson opened this issue Sep 30, 2024 · 1 comment · Fixed by #6724
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)

Comments

@nolanlawson
Copy link

nolanlawson commented Sep 30, 2024

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):

[plugin:custom-rollup-plugin] [plugin custom-rollup-plugin] I am warning you!! (x4)

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

$ node --version
v20.11.0
$ npm --version
10.4.0

Validations

@hi-ogawa
Copy link
Contributor

hi-ogawa commented Oct 1, 2024

This is likely because of Vitest setting logLevel: "error" to reduce unnecessary logs for normal Vitest use cases:

const config: ViteInlineConfig = {
logLevel: 'error',

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;
      },
    },

@sheremet-va sheremet-va added p2-to-be-discussed Enhancement under consideration (priority) and removed enhancement: pending triage labels Oct 1, 2024
@sheremet-va sheremet-va added p2-edge-case Bug, but has workaround or limited in scope (priority) and removed p2-to-be-discussed Enhancement under consideration (priority) labels Oct 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants