Skip to main content

Vitest

Vitest
Vitest.JestDom
Vitest.ReactTestingLibrary
Vitest.UserEvent

Vitest integrates well with the vite bundler and provides a fast and reliable testing framework for unit as well as component tests. There are even options to integrate Vitest with Storybook.

The bindings for the Vitest ecosystem are developed and maintained by the Fable Hub and used for testing in the Feliz project.

info

The Feliz template also ships with Vitest preconfigured. You can get started with Vitest right away when creating a new Feliz project using the template.

describe "FragmentComponent" <| fun _ ->
testPromise "renders multiple elements from a fragment" <| fun _ -> promise {
RTL.render (Components.FragmentComponent())
|> ignore

let first = RTL.screen.getByTestId "first"
let second = RTL.screen.getByTestId "second"

expect(first).toHaveTextContent "Hello"
expect(second).toHaveTextContent "World"
}