Skip to content

Export Vitest extend-expect #439

Closed
Closed
@AndrewLeedham

Description

@AndrewLeedham

Describe the feature you'd like:

I would like to use jest-dom in Vitest.

Suggested implementation:

Since both Jest and Vitest use the same style of matchers, and have very similiar APIs, perhaps jest-dom can export a secondary entry point for Vitest, or make the matchers export a first-class API.

Describe alternatives you've considered:

I can manually add the matchers in a setup file using:

import { expect } from 'vitest';
import * as matchers from '@testing-library/jest-dom/dist/matchers';

expect.extend(matchers);

However, I am reaching into the dist folder which is not a public API, also I am using TypeScript and having to setup the types myself, rather than using @types/jest-dom.

Teachability, Documentation, Adoption, Migration Strategy:

This would just be an additional entry file just for Vitest, so should not change the functionality of jest-dom.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions