Closed alexandermukhin closed 1 year ago
Yes that would be possible but I'm curious about what pattern is reported by the rule in your test files? Maybe this could be an issue with the rule
Something like this
import { render } from '@testing-library/react';
import MyComponent from './MyComponent';
// here I got an error
// ESLint: Fast refresh only works when a file has exports. Move your component(s) to a separate file.(react-refresh/only-export-components)
const TestChildComponent = ({ children }) => {
return <div>{children}</div>;
};
describe('...', () => {
it('...', async () => {
const { getByText } = render(
<MyComponent>
<TestChildComponent>Demo component</TestChildComponent>
</MyComponent>
);
expect(getByText('Demo component')).toBeInTheDocument();
});
});
Oh yeah I see. Yeah this warning makes sense for App entrypoints, but not for test entrypoints. I will skip the linter for those files
Hello! Could you add test files (
*.test.*
,*.spec.*
) to ignore list?