question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow `[vite] connecting...` message to be silenced

See original GitHub issue

Clear and concise description of the problem

I am trying out vite, and am using https://github.com/betaboon/vite-web-test-runner-plugin to run my tests, but I find that I get two log messages for each test that I run, which spams the console. It looks something like this:

src/components/patterns/modal/modal-header/ModalHeader.test.tsx:

 🚧 Browser logs:
      [vite] connecting...
      [vite] connected.

src/components/patterns/sidebar/nav-group/NavGroup.test.tsx:

 🚧 Browser logs:
      [vite] connecting...
      [vite] connected.

src/components/patterns/modal/modal/Modal.test.tsx:

 🚧 Browser logs:
      [vite] connecting...
      [vite] connected.

I see that those are simple console.log statements in the code, which means that they do not respect logLevel. Is there a reason that they can’t be changed to config.logger.info() calls instead?

Suggested solution

In packages/vite/src/client/client.ts, the calls to console.log should be changed to logger calls, so that they can be silenced

Alternative

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
IanVScommented, Jun 2, 2021

It turns out there is an option, filterBrowserLogs, in web-test-runner that I can use to silence these messages. Here’s a quick-and-dirty fix that seems to work for me.

filterBrowserLogs: ({ args }) => {
	  if (args[0] === '[vite] connecting...' || args[0] === '[vite] connected.') return false;
	  
	  return true;
}

I think this meets my needs without requiring any changes to Vite, so I’ll close this out. Thanks!

0reactions
github-actions[bot]commented, Jul 16, 2021

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Vite
Vite has a list of "allowed conditions" and will match the first condition that is in the allowed list. The default allowed conditions...
Read more >
dev/build silently externalizes some dependencies, leading to ...
Describe the bug. Vite has some resolver plugins that cause it to "externalize" some dependencies by name. Instead of giving an error at ......
Read more >
Use Focus on your iPhone or iPad - Apple Support (IL)
Go to Settings > Focus. Tap a provided Focus option—like Do Not Disturb, Personal, Sleep, or Work—then tap Customize Focus. Set up your...
Read more >
@nrwl/vite:dev-server | Nx
Set to false to prevent Vite from clearing the terminal screen when logging certain messages. force. boolean. Force the optimizer to ...
Read more >
how to start a conversation after a long silence
Your mind rolls around what to talk about and how to break a long silence that is ... If you want to send...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found