Describe the bug
I try to use browser mode testing user vitest, with version 4.0.15.
I configured vitest.config.ts file with:
import { defineConfig } from "vitest/config";
import tsconfigPaths from "vite-tsconfig-paths";
import { playwright } from "@vitest/browser-playwright";
const config = defineConfig({
test: {
projects: [
{
plugins: [
tsconfigPaths({ projects: ["./tsconfig.paths.json", "../../tsconfig.base.json"], ignoreConfigErrors: true })
],
test: {
name: "Components & Hooks Unit Tests",
include: ["src/**/tests/*.test.tsx", "src/**/tests/use-*.test.ts"],
restoreMocks: true,
environment: "jsdom",
browser: {
provider: playwright(),
enabled: true,
instances: [{ browser: "chromium" }],
headless: true
}
}
}
]
}
});
export default config;
I followed the manual installation guide, https://vitest.dev/guide/browser/#manual-installation, and I'm using Playwright.
When I run vitest --run -c ./vitest.config.ts I get an error:
file:/node_modules/.pnpm/@vitest+browser@4.0.15_msw@2.10.5_@types+node@24.3.0_typescript@5.9.2__vite@7.1.12_@types+nod_nsppi3d66lnza46vhfuubbygma/node_modules/@vitest/browser/dist/index.js:2947
const state = project.browser.state;
^
TypeError: Cannot read properties of undefined (reading 'state')
Can anyone tell why?
I checked my listed dependencies, all of them are using the same version 4.0.15.
I only run this dummy test:
import { describe, it, expect } from "vitest";
describe("TEST", () => {
it("TEST", () => {
expect(true).toBe(true);
});
});
And still get the error.
Reproduction
Above, and simple test.
System Info
Used Package Manager
pnpm
Validations
Describe the bug
I try to use browser mode testing user vitest, with version
4.0.15.I configured
vitest.config.tsfile with:I followed the manual installation guide, https://vitest.dev/guide/browser/#manual-installation, and I'm using Playwright.
When I run
vitest --run -c ./vitest.config.tsI get an error:Can anyone tell why?
I checked my listed dependencies, all of them are using the same version 4.0.15.
I only run this dummy test:
import { describe, it, expect } from "vitest";
describe("TEST", () => {
it("TEST", () => {
expect(true).toBe(true);
});
});
And still get the error.
Reproduction
Above, and simple test.
System Info
Used Package Manager
pnpm
Validations