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

[vitest] any way to disable this when running in test env (e.g. with vitest) #14

Open
ortonomy opened this issue Nov 12, 2022 · 2 comments

Comments

@ortonomy
Copy link

ortonomy commented Nov 12, 2022

I see all the eslint plugin output in my testing runs which is distracting...

@ArnaudBarre
Copy link
Collaborator

Yeah maybe this can always be disable in test env.

For now, you can update your config to disable the plugin manually

export default defineConfig((env) => ({
  plugins: [
    env.mode !== 'test' && eslintPlugin()
  ],

@daliborfilus
Copy link

This plugin hangs with vitest 1.6 when running in vitest run, resulting in the message:

...
close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting
You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters

When I enabled the hanging-process reporter, one of the processes was this:

# WORKER
node:internal/async_hooks:202                                                                                                                        
node:internal/worker:214                                                                                                                             
file:///.../node_modules/@nabla/vite-plugin-eslint/src/index.mjs:25                     
file:///.../node_modules/vitest/node_modules/vite/dist/node/chunks/dep-B8QpfTwU.js:51091
file:///.../node_modules/vitest/node_modules/vite/dist/node/chunks/dep-B8QpfTwU.js:53832

When I removed the eslintPlugin() from plugins, it doesn't hang. Thank you for the workaround, although in my case, the correct usage was this (vite.config.js):

import eslintPlugin from '@nabla/vite-plugin-eslint';
import { defineConfig } from 'vite';

export default ({ mode }) => {
  return defineConfig({
    plugins: [mode !== 'test' && eslintPlugin()],
    test: {
      reporters: ['default', 'hanging-process']
    }
  });
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants