Passer au contenu

Vitest UI

Powered by Vite, Vitest also has a dev server under the hood when running the tests. This allows Vitest to provide a beautiful UI to view and interact with your tests. The Vitest UI is optional, so you’ll need to install it with:

Fenêtre de terminal
npm i -D @vitest/ui

Then you can start the tests with UI by passing the --ui flag:

Fenêtre de terminal
vitest --ui

Then you can visit the Vitest UI at <a href=“http://localhost:51204/__vitest__/“>`http://localhost:51204/__vitest__/`</a>

<img alt=“Vitest UI” img-light src=“/ui-1-light.png”> <img alt=“Vitest UI” img-dark src=“/ui-1-dark.png”>

UI can also be used as a reporter. Use 'html' reporter in your Vitest configuration to generate HTML output and preview the results of your tests:

vitest.config.ts
export default {
test: {
reporters: ['html']
}
}

You can check your coverage report in Vitest UI: see Vitest UI Coverage for more details.