Open History to see the last commit
1import * as jestDomMatchers from '@testing-library/jest-dom/matchers'
2import { expect } from 'vitest'
3import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers'
4β
5// Workaround for Vitest 5: remove once testing-library/jest-dom#742 is merged
6// and released, and go back to `import '@testing-library/jest-dom/vitest'`.
7// That entry imports `vitest` from its own install location, which can resolve
8// a different Vitest copy than the one running these tests, and its types
9// augment Vitest 4's `Assertion<T>` instead of Vitest 5's `Matchers<R, T>`.
10// Keep `jest-dom` in this file name: vite-plugin-solid only skips injecting
11// `@testing-library/jest-dom/vitest` when a setup file path contains it.
12expect.extend(jestDomMatchers)
13β
14declare module 'vitest' {
15 // Type parameter names must match Vitest's declaration for the interfaces to merge.
16 // eslint-disable-next-line @typescript-eslint/naming-convention
17 interface Matchers<R, T> extends TestingLibraryMatchers<unknown, R> {}
18}