-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vitest support #173
Comments
Looks like this solution should work vitest-dev/vitest#2667 (comment) |
I know, I opened that issue there, 😅 but the point of this issue here would be to avoid having figure out any config for it. It looks like it's as easy as using |
I don't use vitest so I'm not inclined to attempt to support it here. I wouldn't mind a shim for it but given we'd need some test infra of both systems to make sure it continues to work I think ultimately this would be a pretty big lift for someone to write and then continue to maintain. |
@fregante did you manage to mock webextension-polyfill in Vitest tests? If yes could you share how / the public repo that you have? Very much appreciated 🙏🏼 |
For anyone who comes here wondering how to make this library work with Vitest: // vitest.setup.ts
import { vi } from "vitest";
//@ts-ignore
globalThis.jest = vi; // vitest.config.ts
export default defineConfig({
//...
test: {
setupFiles: ["vitest.setup.ts", "jest-webextension-mock"],
sequence: { setupFiles: "list" },
environment: "jsdom"
},
//...
}); I've only been using this for mocking Chrome storage, so I can't speak for the other aspects of web extensions. |
I'm looking to switch to Vitest, do you think it would be possible to look for the
vi
global as well asjest
? I'm not sure if that's enough.Current Vitest config
Output
Related
jest
globals (jest is not defined
) vitest-dev/vitest#2667The text was updated successfully, but these errors were encountered: