mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
3.0 KiB
3.0 KiB
| title |
|---|
| Assertion API | Browser Mode |
Assertion API
Vitest bundles @testing-library/jest-dom library to provide a wide range of DOM assertions out of the box. For detailed documentation, you can read the jest-dom readme:
toBeDisabledtoBeEnabledtoBeEmptyDOMElementtoBeInTheDocumenttoBeInvalidtoBeRequiredtoBeValidtoBeVisibletoContainElementtoContainHTMLtoHaveAccessibleDescriptiontoHaveAccessibleErrorMessagetoHaveAccessibleNametoHaveAttributetoHaveClasstoHaveFocustoHaveFormValuestoHaveStyletoHaveTextContenttoHaveValuetoHaveDisplayValuetoBeCheckedtoBePartiallyCheckedtoHaveRoletoHaveErrorMessage
If you are using TypeScript or want to have correct type hints in expect, make sure you have either @vitest/browser/providers/playwright or @vitest/browser/providers/webdriverio specified in your tsconfig depending on the provider you use. If you use the default preview provider, you can specify @vitest/browser/matchers instead.
::: code-group
{
"compilerOptions": {
"types": [
"@vitest/browser/matchers"
]
}
}
{
"compilerOptions": {
"types": [
"@vitest/browser/providers/playwright"
]
}
}
{
"compilerOptions": {
"types": [
"@vitest/browser/providers/webdriverio"
]
}
}
:::