Skip to content

Getting $RefreshReg$ is not defined error when running tests with vitest and plugin-react-oxc #500

@ChiragRupani

Description

@ChiragRupani

Related plugins

Describe the bug

After running simple Hello World app it is giving error -$RefreshReg$ is not defined and test case is failing. It is working fine with plugin-react.

FAIL src/App.test.tsx [ src/App.test.tsx ]
ReferenceError: R e f r e s h R e g is not defined
❯ src/App.tsx:9:1
3| export default function App() {
4| return <>Hello World</>;
5| }
| ^
6|
❯ src/App.test.tsx:2:1

The App is running fine

Also there is warning while running test -
Both esbuild and oxc options were set. oxc options will be used and esbuild options will be ignored.

Please feel free to close this bug if there is mistake in bug report

Reproduction

https://stackblitz.com/edit/vitejs-vite-uqmfm78m?file=src%2FApp.test.tsx&view=editor

Steps to reproduce

Run npm install followed by npm t

System Info

NA

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions