You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I followed the (setup instructions)[https://jest-extended.jestcommunity.dev/docs/getting-started/setup] for using jest-extended with vitest. I had a typescript setup file, testSetup.ts, with:
import {expect} from "vitest";
import * as matchers from "jest-extended";
expect.extend(matchers);
and included the following in vite.config.ts
setupFiles: ["./testSetup.ts"]
However, I would receive the error 'Could not find a declaration for module 'jest-extended/all' when importing jest-extended in the testSetup.ts file.
Workaround
It appears that the root cause of this was that jest-extended does not provide type definitions for the module itself. A way around this, if you have a similar setup to me, is to replace the line in vite.config.ts where we have setupFiles: ["./testSetup"] with setupFiles: ["jest-extended/all"]. This works as the setup files is a javascript (rather than a typescript) file supplied by jest-extended, so we don't need type definitions for it.
The text was updated successfully, but these errors were encountered:
Bug
I followed the (setup instructions)[https://jest-extended.jestcommunity.dev/docs/getting-started/setup] for using jest-extended with vitest. I had a typescript setup file, testSetup.ts, with:
and included the following in vite.config.ts
However, I would receive the error 'Could not find a declaration for module 'jest-extended/all' when importing jest-extended in the testSetup.ts file.
Workaround
It appears that the root cause of this was that jest-extended does not provide type definitions for the module itself. A way around this, if you have a similar setup to me, is to replace the line in vite.config.ts where we have
setupFiles: ["./testSetup"]
withsetupFiles: ["jest-extended/all"]
. This works as the setup files is a javascript (rather than a typescript) file supplied by jest-extended, so we don't need type definitions for it.The text was updated successfully, but these errors were encountered: