We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
true
jsx
When I run my tests in Vitest using the jsdom environment I receive the error:
Warning: Received true for a non-boolean attribute jsx.
According to the readme, this error is fixed with styled-jsx/babel-test, but it is not working for me.
styled-jsx/babel-test
vitest.config.ts
import { defineConfig } from "vite"; import { loadEnvConfig } from "@next/env"; loadEnvConfig(process.cwd()); export default defineConfig({ test: { environment: "jsdom", }, });
Sample.test.tsx
import { createRoot } from "react-dom/client"; import * as ReactTestUtils from "react-dom/test-utils"; import { expect, test } from "vitest"; function Hello() { return ( <div> Hello <style jsx global> {` div { color: red; } `} </style> </div> ); } const root = document.createElement("div"); document.body.appendChild(root); ReactTestUtils.act(() => { createRoot(root).render( <Hello /> ); }); test("Hello", () => { expect(root.innerHTML).toBe("<div>Hello</div>"); });
.babelrc
{ "presets": ["next/babel", "@babel/preset-typescript"], "env": { "test": { "plugins": ["styled-jsx/babel-test"] } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I run my tests in Vitest using the jsdom environment I receive the error:
According to the readme, this error is fixed with
styled-jsx/babel-test
, but it is not working for me.vitest.config.ts
Sample.test.tsx
.babelrc
Environment
The text was updated successfully, but these errors were encountered: