consola
consola copied to clipboard
A way to allow fancy in test
Describe the feature
Need an option to enable fancy in test
Additional information
- [ ] Would you be willing to help implement this feature?
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.
- In CI or test environments,
consoladefaults toBasicReporter, but you can enforceFancyReporterby settingfancy: 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,vitestremoves ANSI color from theconsoleby default. You should also setFORCE_COLOR=1to enable colorful logs. https://github.com/vitest-dev/vitest/discussions/3351
Feel free to reopen this if you have any futher questions ❤️