-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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/browser fails to run when the dependent package has chai v5 #5332
Comments
Chai 5 is not supported at the moment. |
I have the same issue after upgrading to v1.3.1 from v1.2.1, regardless the presence of chai 5. |
I think this is yet another case of missing In your reproduction, adding this should should help for the time being. import { defineConfig } from "vitest/config";
export default defineConfig({
optimizeDeps: {
include: ["vitest > @vitest/expect > chai"]
},
test: { ... }
}); As mentioned in #5332 (comment), currently Vitest uses chai v4, so same chai instance won't be shared when using it like below. But I suppose the issue is not expecting such use case, so probably we can fix import * as chai from "chai"; // project uses chai v5
import { expect } from "vitest"; // internally uses a different copy of chai v4 |
Hmm, maybe this might be tricky since
Maybe original reproduction works only because of flat node modules, so |
This should be fixed with Vitest 2 |
Describe the bug
If a project has chai v5 as a dependency, tests that used to succeed will now fail.
Test case:
Error message:
Reproduction
https://github.com/odan-sandbox/vitest-browser-issue-with-chai-v5
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: