consola icon indicating copy to clipboard operation
consola copied to clipboard

A way to allow fancy in test

Open SettingDust opened this issue 1 year ago • 1 comments

Describe the feature

Need an option to enable fancy in test

Additional information

  • [ ] Would you be willing to help implement this feature?

SettingDust avatar Jul 14 '24 14:07 SettingDust

I have same issue. I tried to use consola in my tests when debugging, but it doesn't work. So I checked and realized that consola/basic works, but fancy does not.

black7375 avatar Jul 17 '24 10:07 black7375

  • In CI or test environments, consola defaults to BasicReporter, but you can enforce FancyReporter by setting fancy: true

https://github.com/unjs/consola/blob/5ac9ed76b021c9ffc768f0727355238056aabeb1/src/index.ts#L33-L37

import { createConsola } from 'consola'

const consola = createConsola({
  fancy: true 
})
  • If you are using vitest, vitest removes ANSI color from the console by default. You should also set FORCE_COLOR=1 to enable colorful logs. https://github.com/vitest-dev/vitest/discussions/3351

Feel free to reopen this if you have any futher questions ❤️

kricsleo avatar Mar 21 '25 06:03 kricsleo