-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Support Vitest #4145
Comments
It seems like the export default console Might also have to export the named Console in order to be node compatible. |
Console issue you are seeing is #3625. It's a constructor that returns a console object that has stdout/stderr redirected |
Any workarounds? |
might also be worth to know that Vitest itself also have a PR, in draft, to support Bun by using ShadowRealm with this description
|
console.console is implemented in the next release |
It's progress, but I get this: vitest on main [!?]
➜ bun --bun x vitest
DEV v0.34.4 /Users/admin/repos/vitest
[bun] Warning: worker_threads.Worker option "argv" is not implemented.
[bun] Warning: worker_threads.Worker option "execArgv" is not implemented.
[bun] Warning: worker_threads.Worker option "resourceLimits" is not implemented. |
Those warning can be ignored, see https://github.com/tinylibs/tinypool/pull/70/files#diff-478191b8d0c43c3d24bfda206ff15909923b8b5a89eec9c967376feded4edfa7R9 |
have the same:
and cant ignore tests doesnt finish and get this if i want cancel need to do it 1000 times before exit:
|
I have same problem |
Hmm... if I now make a small test file like this , and run, it seems to just freeze: ➜ bun --bun x vitest
DEV v1.1.1 /Users/admin/repos/histoire-vue3-starter |
The argument implementation warning was removed in version 1.0.22, but vitest still doesn't work. |
Getting this error while running OS: Darwin 23.1.0 arm64 arm Bun v1.0.35, Vitest v1.4.0
|
Maybe interesting fact: if you take the node:20 docker image and install bun there, then our if we use the oven:bun image it just hangs. |
With the node one, does it pass with the '--bun' flag? |
Sadly |
I know bun has a competing https://2023.stateofjs.com/en-US/libraries/#tools_arrows |
Still issue with vitest 2.x / bun 1.1.22-canary.85+cacbaba52 ➜ bun --bun x vitest
DEV v2.0.5 |
+1 |
1 similar comment
+1 |
In the meantime, is there a way to run tests with vitest on a project made with bun? I'm asking here because other people coming here might find the information useful too. :) |
I'm maintainer of few modest oss packages. I'd love bun to support vitest for few reasons, but the first would be to be able to run my current packages on it. That would allow me to eventually report bugs or performance regressions related to bun . Most of my repos currently depends on vitest and run on node and @vercel/runtime-edge by default. That way I can ensure my test suite runs on the two runtimes. Adding bun would be great addition. I also use vitest to benchmark, with supporting vitest I could provide also few comparisons that might give more visibility to performance differences or regressions (they're connected to codpeed) While I love the bun integrated feature, I feel the ecosystem is converging towards vitest (storybook, playwright...). Maintaining different test suite is difficult. |
The issue running |
@nazarhussain well done! There is already vitest support in deno, so it's mainly a bun need. What's the best way to try it? |
Yes, Deno is supported as runtime with vitest. For usage first install import path from "node:path";
import { defineConfig, ViteUserConfig } from "vitest/config";
export type Runtime = "node" | "deno" | "bun";
export function getRuntime(): Runtime {
if ("bun" in process.versions) return "bun";
if ("deno" in process.versions) return "deno";
return "node";
}
export function getPoolOptions(runtime: Runtime): ViteUserConfig["test"] {
if (runtime === "node") {
return {
pool: "threads",
poolOptions: {
threads: {
singleThread: true,
minThreads: 2,
maxThreads: 10,
},
},
};
}
return {
pool: "vitest-in-process-pool",
coverage: {
enabled: false,
},
};
}
export default defineConfig({
test: {
...getPoolOptions(getRuntime()),
include: ["**/*.test.ts"],
}
}); |
Vitest - website - github
Blocked by:
node:inspector
#2445 (needed for vitest coverage reportingrun --coverage
)The text was updated successfully, but these errors were encountered: