Closed
Description
@testing-library/jest-dom
version: 5.16.1node
version: 14.17.0yarn
version: 1.22.17@testing-library/react
version: 12.1.2
I am using vitest
instead of jest
for testing a React component lib in a monorepo. I am using @testing-library/jest-dom
and @testing-library/react
and both happily work with vitest
.
However, when type checking my code I am seeing a clash between @types/jest
and vitest
. The @types/jest
dependency seems to have been pulled in by @testing-library/jest-dom
.
../node_modules/@types/jest/index.d.ts:34:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: test, describe, it, expect, beforeAll, afterAll, beforeEach, afterEach
34 declare var beforeAll: jest.Lifecycle;
~~~~~~~
../node_modules/vitest/global.d.ts:1:1
1 declare global {
~~~~~~~
Conflicts are in this file.
../node_modules/vitest/global.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: test, describe, it, expect, beforeAll, afterAll, beforeEach, afterEach
1 declare global {
~~~~~~~
../node_modules/@types/jest/index.d.ts:34:1
34 declare var beforeAll: jest.Lifecycle;
~~~~~~~
Conflicts are in this file.
Found 2 errors.
It would be great to have a workaround for this issue so the jest
types can be removed or ignored.
To reproduce this issue clone the following project (notice it uses a branch called yarn
):
https://github.com/robcaldecott/pnpm-vite-monorepo-example/tree/yarn
To see the error:
yarn install
cd components
yarn build